Skip to main content

Webhooks

Models

Webhook

Webhook model description.

type Webhook {
id: ID!
endpoint: String!
scope: String!
}

Fields

idID!required
endpointString!required

URL address that webhooks will be pushed.

scopeString!required

Scope of webhook that defines content of webhook.

Queries

List Webhooks

Use this query to list active webhooks of your application.

listWebhook: [Webhook!]!

Return Type

WebhookWebhook

Webhook model description.

Mutations

Save Webhook

Use this mutation to save webhooks by using multiple scope variables. After saving a webhook, ikas will start to push new webhooks to given url endpoint. If endpoint is unreachable or returns an error code other than HTTP 200 ikas will try to push webhook for 3 times then stops sending webhook.

saveWebhook(
input: WebhookInput!
): [Webhook!]

Arguments

inputWebhookInput!required

Return Type

WebhookWebhook

Webhook model description.

Delete Webhook

Use this mutation to delete webhooks by giving scope list.

deleteWebhook(
scopes: [String!]!
): Boolean!

Arguments

scopes[String!]!required

Return Type

BooleanBoolean

The Boolean scalar type represents true or false.

Examples

Retrieves a list of webhooks

curl --location --request POST 'https://api.myikas.com/api/v1/admin/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your_access_token>' \
--data-raw '{"query":"{ listWebhook { createdAt deleted endpoint id scope updatedAt }}"}'

Response

{
"data": {
"listWebhook": [
{
"createdAt": 1636366311914,
"deleted": false,
"endpoint": "https://mailchimp-dev.ikasapps.com/api/webhook/ikas",
"id": "331f40ad-58a5-4b25-b060-15e6ce57fc9f",
"scope": "store/customer/created",
"updatedAt": 1636366311914
},
{
"createdAt": 1636366311924,
"deleted": false,
"endpoint": "https://mailchimp-dev.ikasapps.com/api/webhook/ikas",
"id": "806047a2-ce1d-4e2c-8c7d-10a5407bfa6d",
"scope": "store/customer/updated",
"updatedAt": 1636366311924
}
]
}
}

Creates a webhook

curl --location --request POST 'https://api.myikas.com/api/v1/admin/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your_access_token>' \
--data-raw '{"query":"mutation { saveWebhook( input: { scopes: \"store/customer/created\" endpoint: \"https://www.google.com/\" } ) { createdAt deleted endpoint id scope updatedAt }}"}'

Response

{
"data": {
"saveWebhook": [
{
"createdAt": 1637328436979,
"deleted": false,
"endpoint": "https://www.google.com/",
"id": "e96e7c71-3521-43be-b905-1a607a1e4fa5",
"scope": "store/customer/created",
"updatedAt": 1637764765953
}
]
}
}

Deletes webhook

curl --location --request POST 'https://api.myikas.com/api/v1/admin/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your_access_token>' \
--data-raw '{"query":"mutation { deleteWebhook(scopes: [\"store/customer/created\"])}"}'

Response

{
"data": {
"deleteWebhook": true
}
}