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
Webhook subscriptions registered for your Xemelgo account.
| Field | Type | Description |
|---|---|---|
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.
| Field | Type | Description |
|---|---|---|
endpoint | String! | Publicly resolvable HTTPS endpoint that will receive webhook deliveries. IP addresses and private or reserved destinations are not accepted. |
secret | String! | 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
Result of registering a webhook subscription.
| Field | Type | Description |
|---|---|---|
webhook | WebhookSubscription! | 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.
| Field | Type | Description |
|---|---|---|
topicId | String! | Enabled event topic that belongs to the webhook subscription and has an example payload. |
webhookId | ID! | Unique identifier of the webhook subscription to test. |
Returns
TriggerWebhookTestEventPayload!
TriggerWebhookTestEventPayload
Result of queuing a webhook test event for delivery.
| Field | Type | Description |
|---|---|---|
accepted | Boolean! | Whether the test event was accepted for asynchronous delivery. Acceptance does not confirm successful delivery. |
topicId | String! | Event topic used for the test delivery. |
webhookId | ID! | 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.
| Field | Type | Description |
|---|---|---|
id | ID! | Unique identifier of the webhook subscription to remove. |
Returns
UnregisterWebhookPayload
Result of unregistering a webhook subscription.
| Field | Type | Description |
|---|---|---|
webhook | WebhookSubscription! | 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.
| Field | Type | Description |
|---|---|---|
endpoint | String | Replacement publicly resolvable HTTPS delivery endpoint. |
id | ID! | Unique identifier of the webhook subscription to update. |
secret | String | Replacement 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
Result of updating a webhook subscription.
| Field | Type | Description |
|---|---|---|
webhook | WebhookSubscription! | 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.
| Field | Type | Description |
|---|---|---|
creationDate | AWSTimestamp! | Epoch-millisecond timestamp when the subscription was created. |
endpoint | String! | HTTPS endpoint that receives webhook event deliveries. |
id | String! | Unique identifier of the webhook subscription. |
lastUpdatedDate | AWSTimestamp | Epoch-millisecond timestamp when the subscription was last updated. |
topics | [String!]! | Event topics delivered to this endpoint. |