Webhook-abonnementen

Een abonnement koppelt een onderwerp aan een adres. Zie Webhooks voor wat er binnenkomt en hoe je het verifieert; deze pagina gaat over het beheer.

Het WebhookSubscription-model

  • Name
    id
    Type
    ID!
    Description

    gid://rouwkaart/WebhookSubscription/b3f1a0c2-…

  • Name
    topic
    Type
    WebhookSubscriptionTopic!
    Description

    CARDS_CREATE, CARDS_UPDATE, CARDS_ORDERED of CARDS_ACTIVATED.

  • Name
    endpoint
    Type
    WebhookSubscriptionEndpoint!
    Description

    Op dit moment altijd een WebhookHttpEndpoint met een callbackUrl. Het is een union, zodat er later andere soorten bij kunnen zonder dat je query breekt.

  • Name
    format
    Type
    WebhookSubscriptionFormat!
    Description

    JSON.

  • Name
    createdAt / updatedAt
    Type
    DateTime!
    Description

MUTATIONwebhookSubscriptionCreate

Abonnement aanmaken

Argumenten

  • Name
    topic
    Type
    WebhookSubscriptionTopic!
    Description

    Eén onderwerp per abonnement. Wil je alles weten, maak er dan vier.

  • Name
    webhookSubscription.callbackUrl
    Type
    URL!
    Description

    Moet openbaar bereikbaar zijn en over https gaan.

  • Name
    webhookSubscription.format
    Type
    WebhookSubscriptionFormat
    Description

    JSON, en dat is ook de standaard.

Hetzelfde onderwerp twee keer naar hetzelfde adres geeft TAKEN: dat is een dubbele registratie, geen wens.

Verzoek

MUTATION
webhookSubscriptionCreate
mutation CreateWebhookSubscription(
  $topic: WebhookSubscriptionTopic!
  $subscription: WebhookSubscriptionInput!
) {
  webhookSubscriptionCreate(
    topic: $topic
    webhookSubscription: $subscription
  ) {
    webhookSubscription {
      id
      topic
      format
      endpoint {
        ... on WebhookHttpEndpoint {
          callbackUrl
        }
      }
      createdAt
    }
    userErrors {
      field
      message
      code
    }
  }
}

Antwoord

{
  "data": {
    "webhookSubscriptionCreate": {
      "webhookSubscription": {
        "id": "gid://rouwkaart/WebhookSubscription/b3f1a0c2-55d6-4a71-9c0e-2f7b8d4e1a90",
        "topic": "CARDS_ORDERED",
        "format": "JSON",
        "endpoint": {
          "callbackUrl": "https://herdenksamen.nl/hooks/rouwkaart"
        },
        "createdAt": "2026-09-25T10:05:00.000Z"
      },
      "userErrors": []
    }
  }
}

QUERYwebhookSubscriptions

Abonnementen opvragen

Een connectie, eventueel gefilterd op onderwerp.

  • Name
    first / after / last / before
    Type
    paginering
    Description

    Zie Paginering.

  • Name
    topics
    Type
    [WebhookSubscriptionTopic!]
    Description

    Alleen deze onderwerpen. Weglaten geeft alles.

Verzoek

QUERY
webhookSubscriptions
query WebhookSubscriptions(
  $first: Int!
  $topics: [WebhookSubscriptionTopic!]
) {
  webhookSubscriptions(first: $first, topics: $topics) {
    nodes {
      id
      topic
      endpoint {
        ... on WebhookHttpEndpoint {
          callbackUrl
        }
      }
    }
    pageInfo {
      hasNextPage
    }
  }
}

Antwoord

{
  "data": {
    "webhookSubscriptions": {
      "nodes": [
        {
          "id": "gid://rouwkaart/WebhookSubscription/b3f1a0c2-…",
          "topic": "CARDS_ORDERED",
          "endpoint": {
            "callbackUrl": "https://herdenksamen.nl/hooks/rouwkaart"
          }
        },
        {
          "id": "gid://rouwkaart/WebhookSubscription/c7d2e1f4-…",
          "topic": "CARDS_ACTIVATED",
          "endpoint": {
            "callbackUrl": "https://herdenksamen.nl/hooks/rouwkaart"
          }
        }
      ],
      "pageInfo": { "hasNextPage": false }
    }
  }
}

MUTATIONwebhookSubscriptionDelete

Abonnement opzeggen

Geeft het opgezegde id terug, zodat je het uit je eigen administratie kunt halen. Een abonnement van een andere partner geeft NOT_FOUND.

Openstaande bezorgingen voor dit abonnement stoppen meteen; wat al onderweg was kan nog binnenkomen.

Verzoek

MUTATION
webhookSubscriptionDelete
mutation DeleteWebhookSubscription($id: ID!) {
  webhookSubscriptionDelete(id: $id) {
    deletedWebhookSubscriptionId
    userErrors {
      field
      message
      code
    }
  }
}

Antwoord

{
  "data": {
    "webhookSubscriptionDelete": {
      "deletedWebhookSubscriptionId": "gid://rouwkaart/WebhookSubscription/b3f1a0c2-55d6-4a71-9c0e-2f7b8d4e1a90",
      "userErrors": []
    }
  }
}

Van adres wisselen

Er is geen update: maak het nieuwe abonnement aan en zeg daarna het oude op. In die volgorde, dan mis je niets in de tussentijd. Even twee meldingen krijgen is niet erg, want je ontdubbelt toch al op X-Rouwkaart-Webhook-Id.

Had je hier iets aan?