Skip to content

integration

Retrieve an integration by its ID, including its name, type, and all registered webhook subscriptions.

Required scope: view_integrations


Query

graphql
query GetIntegration($id: String!) {
  integration(id: $id) {
    id
    name
    type
    webhooks {
      id
      type
      health
      endPoint
    }
  }
}

Arguments

ArgumentTypeRequiredDescription
idStringThe internal UUID of the integration

Example Variables

json
{
  "id": "int_550e8400-e29b-41d4-a716-446655440000"
}

Example Response

json
{
  "data": {
    "integration": {
      "id": "int_550e8400-e29b-41d4-a716-446655440000",
      "name": "My ERP Integration",
      "type": "PRIVATE",
      "webhooks": [
        {
          "id": "wh_abc123",
          "type": "order/created",
          "health": "HEALTHY",
          "endPoint": "https://my-erp.example.com/hooks/orders"
        },
        {
          "id": "wh_def456",
          "type": "shipment/shipping_event",
          "health": "HEALTHY",
          "endPoint": "https://my-erp.example.com/hooks/tracking"
        }
      ]
    }
  }
}

Code Examples

bash
curl -X POST https://api-v3.happycolis.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "query": "query GetIntegration($id: String!) { integration(id: $id) { id name type webhooks { id type health endPoint } } }",
    "variables": {
      "id": "int_550e8400-e29b-41d4-a716-446655440000"
    }
  }'
js
async function getIntegration(accessToken, id) {
  const response = await fetch('https://api-v3.happycolis.com/graphql', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${accessToken}`,
    },
    body: JSON.stringify({
      query: `
        query GetIntegration($id: String!) {
          integration(id: $id) {
            id
            name
            type
            webhooks {
              id
              type
              health
              endPoint
            }
          }
        }
      `,
      variables: { id },
    }),
  });

  const { data, errors } = await response.json();
  if (errors) throw new Error(errors[0].message);
  return data.integration;
}

const integration = await getIntegration(
  process.env.ACCESS_TOKEN,
  'int_550e8400-e29b-41d4-a716-446655440000',
);
console.log(integration.webhooks);
python
import os
import requests

def get_integration(access_token: str, integration_id: str) -> dict:
    query = """
    query GetIntegration($id: String!) {
      integration(id: $id) {
        id
        name
        type
        webhooks {
          id
          type
          health
          endPoint
        }
      }
    }
    """
    response = requests.post(
        'https://api-v3.happycolis.com/graphql',
        headers={
            'Authorization': f'Bearer {access_token}',
            'Content-Type': 'application/json',
        },
        json={'query': query, 'variables': {'id': integration_id}},
    )
    result = response.json()
    if 'errors' in result:
        raise Exception(result['errors'][0]['message'])
    return result['data']['integration']

integration = get_integration(
    os.environ['ACCESS_TOKEN'],
    'int_550e8400-e29b-41d4-a716-446655440000',
)
print(integration['webhooks'])
php
<?php
$query = <<<'GQL'
query GetIntegration($id: String!) {
  integration(id: $id) {
    id
    name
    type
    webhooks {
      id
      type
      health
      endPoint
    }
  }
}
GQL;

$payload = json_encode([
    'query'     => $query,
    'variables' => ['id' => 'int_550e8400-e29b-41d4-a716-446655440000'],
]);

$ch = curl_init('https://api-v3.happycolis.com/graphql');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => $payload,
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
        'Authorization: Bearer ' . getenv('ACCESS_TOKEN'),
    ],
]);

$result = json_decode(curl_exec($ch), true);
curl_close($ch);

print_r($result['data']['integration']['webhooks']);
go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
)

func getIntegration(accessToken, id string) (map[string]any, error) {
	query := `
		query GetIntegration($id: String!) {
			integration(id: $id) {
				id
				name
				type
				webhooks {
					id
					type
					health
					endPoint
				}
			}
		}`

	body, _ := json.Marshal(map[string]any{
		"query":     query,
		"variables": map[string]any{"id": id},
	})

	req, _ := http.NewRequest("POST", "https://api-v3.happycolis.com/graphql", bytes.NewBuffer(body))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", "Bearer "+accessToken)

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	var result map[string]any
	json.NewDecoder(resp.Body).Decode(&result)

	if errs, ok := result["errors"]; ok {
		return nil, fmt.Errorf("graphql error: %v", errs)
	}
	data := result["data"].(map[string]any)
	return data["integration"].(map[string]any), nil
}

func main() {
	integration, err := getIntegration(
		os.Getenv("ACCESS_TOKEN"),
		"int_550e8400-e29b-41d4-a716-446655440000",
	)
	if err != nil {
		panic(err)
	}
	fmt.Println(integration["webhooks"])
}

HappyColis API Documentation