Skip to content

Webhook GraphQL API

The GraphQL API provides a way to interact with your webhooks.

Reading your webhooks

The webhooks connection provides paginated and filterable access to your webhook configurations.

query webhooks {
webhooks(filters: {isActive: false}) {
edges {
node {
id
label
isActive
failures
subscriptions {
id
isActive
eventType
deviceType
campsite { id }
}
}
}
}
}

Reading delivery attempts

You can also get any attempted deliveries with the webhookDeliveryAttempts connection. This will list any request that has happened as a response to one of your webhook configurations.

webhookEvents on the other hand provides the events that have triggered your webhooks.

Creating a webhook

Use the createWebhook mutation to create a webhook.

mutation createWebhook {
createWebhook(
data: {
label: "My Webhook",
url: "https://example.com",
isActive: true,
secretKey: "secret",
subscriptions: [{eventType: NewDeviceCommandEvent, deviceType: SocketMaster, isActive: true}]
}
) {
... on Webhook {
id
}
... on OperationInfo {
messages {
kind
message
field
code
}
}
}
}

Updating a webhook

Similarly, you can update a webhook using the updateWebhook mutation.

mutation updateWebhook {
updateWebhook(
data: {id: "V2ViaG9vazpiNTQzYzM2ZS0yNGYxLTRhODMtYjRiNi1jMjYwNmI4MmE2ODg=", label: "test"}
) {
... on Webhook {
id
label
}
... on OperationInfo {
messages {
field
message
code
kind
}
}
}
}

Use the createWebhookSubscription mutation to add a new subscription to an existing webhook.

Use updateWebhookSubscription to modify an existing subscription.

Use deleteWebhookSubscription to delete an existing subscription.

Use deleteWebhook to completely delete a webhook.