Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

Configuration object

Code Block
languagejstitleJSONjson
{
    "name": "<name><webhook_configuration_name>",
    "description": "<description><webhook_configuration_description>",
    "hooksevent_id": [
    {"<event_id>",
      "type"event_guide_id": "event<event_guide_createdid>",
      "methodhooks": "POST",[
      "endpoint": "<hook_endpoint>"
    }, {
     {       "type": "event<webhook_removedtype>",
      "method": "POST",       "endpointmethod": "<hook_endpoint>POST",
    },     {       "typeendpoint": "event<external_endpoint_updatedurl>",
      "method": "POST",       "endpointorigin": "<hook_endpoint>"{
    },     {       "typemethod": "order_createdPOST",
      "method": "POST",          "endpoint": "<hook_endpoint>"https://gql.doo.net",
    },     {       "typebody": "order<graphql_removedquery>",
       "method": "POST",    }
  "endpoint": "<hook_endpoint>"     },
    {],
      "typeauthentication": "order_updated",
      "method": "POST",{
        "endpointgrant_type": "<hookclient_endpoint>"
    }credentials",
    {       "typeendpoint": "order_cancelled<external_oauth_endpoint_url>",
      "method": "POST",       "endpointcredentials": "<hook_endpoint>"{
    }
  ],   "authentication": {     "grantclient_typeid": "client_credentialsdoo",
    "endpoint": "<oauth_endpoint>",     "credentials": { 		"client_idsecret": "<client<external_client_id>secret>",
      	"client_secret": "<client_secret>" 	},
        "header_format": "Authorization",
        "header_value_format": "Bearer %ACCESS_TOKEN%"
    }
}

NOTE: in case you don't have OAuth endpoint and want to omit the authorization step with your server - don't include authentication property into the AddWebhook object

...

If the <external_endpoint_url> is not protected with OAuth, you can omit the authentication object in the configuration object. In this case, doo will send the webhook request without access_token. See Webhook requests from doo to the external system for more information.

Parameters

In the configuration object, you can see a lot more configurations than described in the table below. We do not recommend changing any parameters that are not listed in the table below.

Parameter

Required

Description

<name>

<webhook_configuration_name>

Yes

Webhook configuration name.

<description>

<webhook_configuration_description>

No

Webhook

detailed

configuration description.

<hook_endpoint>

Yes

Your server URL where you want to receive the webhook request

Can be separate for each hook type

<oauth_endpoint>

Yes

Your server OAuth endpoint URL

<client_id>

NoClient Id for your OAuth endpoint 

<client_secret>

NoClient Secret for your OAuth endpoint 

<event_id>

No

doo Event ID.

If specified, the webhook configuration will be attached only to the specified event.

If neither <event_id> nor <event_guide_id> is specified, the webhook configuration will be attached to the whole organization.

<event_guide_id>

No

doo Event Guide ID.

If specified, the webhook configuration will be attached to all the events created with the specified event guide.

If neither <event_id> nor <event_guide_id> is specified, the webhook configuration will be attached to the whole organization.

<webhook_type>

Yes

Webhook type name from Supported resources and webhook types without on_ preffix.

<external_endpoint_url>

Yes

External API endpoint where doo sends the webhook payload for the specified webhook type.

See Webhook requests from doo to the external system

<graphql_query>

Yes

GraphQL query which specifies the webhook payload structure.

See How to prepare GraphQL query for webhook configuration?

<external_oauth_endpoint_url>

Yes, if authentication object does exist in the configuration object

External authorization OAuth API endpoint where doo can retrieve the access_token.

See Webhook requests from doo to the external system

<external_client_secret>

Yes, if authentication object does exist in the configuration object

A valid OAuth Client Secret which doo will use to retrieve theaccess_token.

Example

Code Block
languagejs
titleJSON
collapsetruejson
{
    "name": "My Test Webhookwebhook",
    "description": "WebhookEvent forcreation testingand allupdates thewebhook hook typessubscription",
    "hooks": [
        {
            "type": "event_created",
            "method": "POST",
            "endpoint": "https://requestbcompany.in/123"com/receive-doo-webhooks",
    },        "origin": {
        "type": "event_removed",       "method": "POST",
                "endpoint": "https://requestb.in/123"gql.doo.net",
    },     {       "typebody": "event_updated",
      "method": "POST",
      "endpoint": "https://requestb.in/123"
    },
    {{\"operationName\":null,\"variables\":{\"eventId\":\"%EVENT_ID%\"},\"query\":\"query ($eventId: ID!) {event(id: $eventId) { id title }}\"}"
         "type": "order_created",  }
    "method": "POST",   },
   "endpoint": "https://requestb.in/123"    {
},     {       "type": "orderevent_removedupdated",
            "method": "POST",
            "endpoint": "https://requestbcompany.in/123"com/receive-doo-webhooks",
    },        "origin": {
       "type": "order_updated",         "method": "POST",
                "endpoint": "https://requestb.in/123"gql.doo.net",
    },     {       "typebody": "order_cancelled",
      "method": "POST",
      "endpoint": "https://requestb.in/123""{\"operationName\":null,\"variables\":{\"eventId\":\"%EVENT_ID%\"},\"query\":\"query ($eventId: ID!) {event(id: $eventId) { id title }}\"}"
            }
        }
    ],
    "authentication": {
        "grant_type": "client_credentials",
        "endpoint": "https://requestbcompany.in/123com/authorize-doo-webhooks",
        "credentials": {
     	       "client_id": "doo",
          	  "client_secret": "super-strong-secret"
        },
        "header_format": "Authorization",
        "header_value_format": "Bearer %ACCESS_TOKEN%"
    }
}