Skip to main content

Webhook Management API

Authentication: every request needs an IdToken — see Authentication. Error shapes: Errors.

Endpoint: POST https://api.xemelgo.com/graphql

Queries​

webhooks​

Lists all webhook subscriptions registered for your account.

query Webhooks {
webhooks {
webhooks {
creationDate
endpoint
id
lastUpdatedDate
topics
}
}
}
Example variables
{}
Example response
{
"data": {
"webhooks": {
"webhooks": [
{
"creationDate": 1719792000000,
"endpoint": "https://example.com/webhooks",
"id": "webhook-001",
"lastUpdatedDate": 1719792000000,
"topics": [
"inventory.cycle_count"
]
}
]
}
}
}

Arguments​

This operation takes no arguments.

Returns​

WebhooksPayload!

WebhooksPayload​

Webhook subscriptions registered for your Xemelgo account.

FieldTypeDescription
webhooks[WebhookSubscription!]!All webhook subscriptions registered for your account.

Mutations​

registerWebhook​

Registers an HTTPS endpoint to receive one or more webhook event topics. The signing secret is stored securely and is not returned.

mutation RegisterWebhook($input: RegisterWebhookInput!) {
registerWebhook(input: $input) {
webhook {
creationDate
endpoint
id
lastUpdatedDate
topics
}
}
}
Example variables
{
"input": {
"endpoint": "https://example.com/webhooks",
"secret": "replace-with-a-random-high-entropy-secret",
"topics": [
"inventory.cycle_count"
]
}
}
Example response
{
"data": {
"registerWebhook": {
"webhook": {
"creationDate": 1719792000000,
"endpoint": "https://example.com/webhooks",
"id": "webhook-001",
"lastUpdatedDate": 1719792000000,
"topics": [
"inventory.cycle_count"
]
}
}
}
}

Arguments​

input · RegisterWebhookInput!

RegisterWebhookInput​

Input for registering a webhook subscription.

FieldTypeDescription
endpointString!Publicly resolvable HTTPS endpoint that will receive webhook deliveries. IP addresses and private or reserved destinations are not accepted.
secretString!Random, high-entropy secret used to sign deliveries. Must contain 20 to 256 characters and should be stored securely.
topics[String!]!One or more valid webhook event topic identifiers to subscribe to.

Returns​

RegisterWebhookPayload!

RegisterWebhookPayload​

Result of registering a webhook subscription.

FieldTypeDescription
webhookWebhookSubscription!The newly registered webhook subscription.

triggerWebhookTestEvent​

Queues a representative example event for delivery. An accepted request does not confirm that the endpoint received it.

mutation TriggerWebhookTestEvent($input: TriggerWebhookTestEventInput!) {
triggerWebhookTestEvent(input: $input) {
accepted
topicId
webhookId
}
}
Example variables
{
"input": {
"topicId": "inventory.cycle_count",
"webhookId": "webhook-001"
}
}
Example response
{
"data": {
"triggerWebhookTestEvent": {
"accepted": true,
"topicId": "inventory.cycle_count",
"webhookId": "webhook-001"
}
}
}

Arguments​

input · TriggerWebhookTestEventInput!

TriggerWebhookTestEventInput​

Input for queuing a representative test event for a webhook subscription.

FieldTypeDescription
topicIdString!Enabled event topic that belongs to the webhook subscription and has an example payload.
webhookIdID!Unique identifier of the webhook subscription to test.

Returns​

TriggerWebhookTestEventPayload!

TriggerWebhookTestEventPayload​

Result of queuing a webhook test event for delivery.

FieldTypeDescription
acceptedBoolean!Whether the test event was accepted for asynchronous delivery. Acceptance does not confirm successful delivery.
topicIdString!Event topic used for the test delivery.
webhookIdID!Unique identifier of the webhook subscription being tested.

unregisterWebhook​

Removes a webhook subscription and prevents new deliveries from being queued. Deliveries already queued can still arrive.

mutation UnregisterWebhook($input: UnregisterWebhookInput!) {
unregisterWebhook(input: $input) {
webhook {
creationDate
endpoint
id
lastUpdatedDate
topics
}
}
}
Example variables
{
"input": {
"id": "webhook-001"
}
}
Example response
{
"data": {
"unregisterWebhook": {
"webhook": {
"creationDate": 1719792000000,
"endpoint": "https://example.com/webhooks",
"id": "webhook-001",
"lastUpdatedDate": 1719792000000,
"topics": [
"inventory.cycle_count"
]
}
}
}
}

Arguments​

input · UnregisterWebhookInput!

UnregisterWebhookInput​

Input for unregistering a webhook subscription.

FieldTypeDescription
idID!Unique identifier of the webhook subscription to remove.

Returns​

UnregisterWebhookPayload!

UnregisterWebhookPayload​

Result of unregistering a webhook subscription.

FieldTypeDescription
webhookWebhookSubscription!The webhook subscription that was removed.

updateWebhook​

Updates one or more webhook settings for newly created deliveries. Supplying topics replaces the subscription's complete topic set.

mutation UpdateWebhook($input: UpdateWebhookInput!) {
updateWebhook(input: $input) {
webhook {
creationDate
endpoint
id
lastUpdatedDate
topics
}
}
}
Example variables
{
"input": {
"endpoint": "https://example.com/webhooks",
"id": "webhook-001",
"secret": "replace-with-a-random-high-entropy-secret",
"topics": [
"inventory.cycle_count"
]
}
}
Example response
{
"data": {
"updateWebhook": {
"webhook": {
"creationDate": 1719792000000,
"endpoint": "https://example.com/webhooks",
"id": "webhook-001",
"lastUpdatedDate": 1719792000000,
"topics": [
"inventory.cycle_count"
]
}
}
}
}

Arguments​

input · UpdateWebhookInput!

UpdateWebhookInput​

Input for updating a webhook subscription. Provide at least one of endpoint, topics, or secret.

FieldTypeDescription
endpointStringReplacement publicly resolvable HTTPS delivery endpoint.
idID!Unique identifier of the webhook subscription to update.
secretStringReplacement signing secret for deliveries created after the update. Deliveries already queued can still use the previous secret. Must contain 20 to 256 characters.
topics[String!]Complete replacement set of valid webhook event topic identifiers. At least one topic is required.

Returns​

UpdateWebhookPayload!

UpdateWebhookPayload​

Result of updating a webhook subscription.

FieldTypeDescription
webhookWebhookSubscription!The updated webhook subscription.

Shared types​

Entity types used across multiple operations on this page. Type names throughout link here.

WebhookSubscription​

A webhook subscription that delivers selected Xemelgo events to an HTTPS endpoint.

FieldTypeDescription
creationDateAWSTimestamp!Epoch-millisecond timestamp when the subscription was created.
endpointString!HTTPS endpoint that receives webhook event deliveries.
idString!Unique identifier of the webhook subscription.
lastUpdatedDateAWSTimestampEpoch-millisecond timestamp when the subscription was last updated.
topics[String!]!Event topics delivered to this endpoint.