Depending on whether one wants to use the default payload or a GraphQL-constructed payload for webhooks, there might be two different types of views for the structure. For constructing the webhook payload, please use values defined in https://gql.doo.net. For details on how to do that, use the steps defined in Constructing GraphQL body.
Webhook Configuration for Default Payload
{ "name": "<name>", "description": "<description>", "hooks": [ { "type": "event_created", "method": "POST", "endpoint": "<hook_endpoint>" }, { "type": "event_removed", "method": "POST", "endpoint": "<hook_endpoint>" }, { "type": "event_updated", "method": "POST", "endpoint": "<hook_endpoint>" }, { "type": "order_created", "method": "POST", "endpoint": "<hook_endpoint>" }, { "type": "order_removed", "method": "POST", "endpoint": "<hook_endpoint>" }, { "type": "order_updated", "method": "POST", "endpoint": "<hook_endpoint>" }, { "type": "order_cancelled", "method": "POST", "endpoint": "<hook_endpoint>" } ], "authentication": { "grant_type": "client_credentials", "endpoint": "<oauth_endpoint>", "credentials": { "client_id": "<client_id>", "client_secret": "<client_secret>" }, "header_format": "Authorization", "header_value_format": "Bearer %ACCESS_TOKEN%" } }
Webhook Configuration for GraphQL-based Payload
{ "name": "<name>", "description": "<description>", "hooks": [ { "type": "event_created", "method": "POST", "origin":{ "method":"POST", "endpoint":"https://<some url>", "body":"{<this is body as enclosed JSON string>}" }, "endpoint": "<hook_endpoint>" } ], "authentication": { "grant_type": "client_credentials", "endpoint": "<oauth_endpoint>", "credentials": { "client_id": "<client_id>", "client_secret": "<client_secret>" }, "header_format": "Authorization", "header_value_format": "Bearer %ACCESS_TOKEN%" } }
Parameters
Parameter | Required | Description |
---|---|---|
<name> | Yes | Webhook configuration name |
<description> | No | Webhook configuration detailed description |
<hook_endpoint> | Yes | Your server URL where you want to receive the webhook Can be separate for each hook type |
<oauth_endpoint> | Yes | Your server OAuth endpoint URL |
<client_id> | No | Client Id for your OAuth endpoint |
<client_secret> | No | Client Secret for your OAuth endpoint |
Examples
Default case:
GraphQL case:
Constructing GraphQL body
Below, we will demonstrate a simple case of constructing the trigger payload using GraphQL:
- Go to https://gql.doo.net
Under the section HTTP Headers, put the Api_Key and Access Token in this format:
Provide Query Variables. Example:
Provide the body. Example:
to construct a body, one can use the Schema (green button on the right). There you pick the desired entities and then use the detailed variables to construct the payload.
- Verify the payload. To do that, simply click on the Play button and you will get a complete payload in json and potentially discover mistakes in your body query.
- Once you are satisfied and want to create a webhook configuration with your GraphQL query, don't forget to escape the query before pasting it to the AddWebhook object.