Skip to content

integrationWebhookRemove

Removes a webhook subscription from an integration app context. After removal, HappyColis will stop sending events to the associated endpoint for this webhook registration.

Required scope: edit_integrations


Mutation

graphql
mutation IntegrationWebhookRemove($id: String!) {
  integrationWebhookRemove(id: $id) {
    id
  }
}

Arguments

ArgumentTypeRequiredDescription
idStringThe UUID of the webhook to remove

Example Variables

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

Example Response

json
{
  "data": {
    "integrationWebhookRemove": {
      "id": "wh_550e8400-e29b-41d4-a716-446655440000"
    }
  }
}

Code Examples

bash
curl -X POST https://api-v3.happycolis.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "query": "mutation IntegrationWebhookRemove($id: String!) { integrationWebhookRemove(id: $id) { id } }",
    "variables": {
      "id": "wh_550e8400-e29b-41d4-a716-446655440000"
    }
  }'
js
async function removeIntegrationWebhook(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: `
        mutation IntegrationWebhookRemove($id: String!) {
          integrationWebhookRemove(id: $id) {
            id
          }
        }
      `,
      variables: { id },
    }),
  });

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

const result = await removeIntegrationWebhook(
  process.env.ACCESS_TOKEN,
  'wh_550e8400-e29b-41d4-a716-446655440000',
);
console.log(`Removed webhook: ${result.id}`);
python
import os
import requests

def remove_integration_webhook(access_token: str, webhook_id: str) -> dict:
    mutation = """
    mutation IntegrationWebhookRemove($id: String!) {
      integrationWebhookRemove(id: $id) {
        id
      }
    }
    """
    response = requests.post(
        'https://api-v3.happycolis.com/graphql',
        headers={
            'Authorization': f'Bearer {access_token}',
            'Content-Type': 'application/json',
        },
        json={'query': mutation, 'variables': {'id': webhook_id}},
    )
    result = response.json()
    if 'errors' in result:
        raise Exception(result['errors'][0]['message'])
    return result['data']['integrationWebhookRemove']

result = remove_integration_webhook(
    os.environ['ACCESS_TOKEN'],
    'wh_550e8400-e29b-41d4-a716-446655440000',
)
print(f"Removed webhook: {result['id']}")
php
<?php
$mutation = <<<'GQL'
mutation IntegrationWebhookRemove($id: String!) {
  integrationWebhookRemove(id: $id) {
    id
  }
}
GQL;

$payload = json_encode([
    'query'     => $mutation,
    'variables' => ['id' => 'wh_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);

echo 'Removed webhook: ' . $result['data']['integrationWebhookRemove']['id'];
go
package main

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

func removeIntegrationWebhook(accessToken, id string) (map[string]any, error) {
	mutation := `
		mutation IntegrationWebhookRemove($id: String!) {
			integrationWebhookRemove(id: $id) {
				id
			}
		}`

	body, _ := json.Marshal(map[string]any{
		"query":     mutation,
		"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["integrationWebhookRemove"].(map[string]any), nil
}

func main() {
	result, err := removeIntegrationWebhook(
		os.Getenv("ACCESS_TOKEN"),
		"wh_550e8400-e29b-41d4-a716-446655440000",
	)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Removed webhook: %s\n", result["id"])
}

HappyColis API Documentation