WebhookConfig

Endpoints to manage config relating to webhooks sent from Trybe

listWebhookConfigs

List webhook configs for the given site

This endpoint retrieves a list of WebhookConfigs.

Query parameters

  • site_id
    Optional

    Filter results by the site they belong to

  • When true, only archived results are returned

  • page
    Optional

    The page to retrieve results from

  • per_page
    Optional

    The number of results to return per page

Responses

  • 200

    The response to a request to list WebhookConfigs

GET/shop/webhook-configs
200
example response
{
  "data": [],
  "meta": {
    "from": 1,
    "to": 2,
    "total": 2,
    "current_page": 1,
    "last_page": 2,
    "per_page": 15,
    "path": "http://example.com/api"
  },
  "links": {
    "first": "http://example.com?page=1",
    "next": "https://example.com?page=3",
    "prev": "https://example.com?page=1",
    "last": "https://example.com?page=4"
  }
}
createWebhookConfig

Create WebhookConfig

This endpoint creates a new WebhookConfig.

Request body

  • name
    Required

    A name to identify this webhook config, for internal use.

  • url
    Nullable

    An HTTPS URL where the webhooks should be sent.

  • method
    Nullable

    The HTTP verb to be used.

    Possible values are get and post

  • secret
    Nullable

    A secret to be used to generate a signature for each webhook. Must be a minimum of 12 characters.

  • An array of string identifiers for the webhook events to be subscribed to.

  • An array of emails which should be sent a notification if the webhook has issues.

  • Whether this webhook should currently be enabled.

  • site_id
    Required

    The ID of the site this config belongs to.

Responses

  • 201

    The response to a request a single WebhookConfig

POST/shop/webhook-configs
201
example response
{
  "data": {
    "id": "69f1e799a591f10149000474",
    "name": "Default webhooks",
    "url": "https://example.com/trybe-webhooks",
    "method": "post",
    "secret": "gldyACJS7uyraHPpuoTV4JIh",
    "events": [
      "basket.submitted",
      "basket.submitted",
      "basket.submitted"
    ],
    "notification_emails": [
      "jane@example.com"
    ],
    "enabled": false,
    "site_id": "fa58abd6-0768-1b5d-9269-9b8b1e611351",
    "organisation_id": "366979be-0aec-4d0a-ca6a-f897e5ec5dca"
  },
  "meta": {
    "events": [
      {
        "event": "basket.submitted",
        "description": "Fired when a basket is submitted"
      },
      {
        "event": "basket.submitted",
        "description": "Fired when a basket is submitted"
      },
      {
        "event": "basket.submitted",
        "description": "Fired when a basket is submitted"
      },
      {
        "event": "basket.submitted",
        "description": "Fired when a basket is submitted"
      },
      {
        "event": "basket.submitted",
        "description": "Fired when a basket is submitted"
      }
    ]
  }
}
getWebhookConfig

Show a WebhookConfig

Use this endpoint to retrieve a WebhookConfig

Path parameters

Responses

  • 200

    The response to a request a single WebhookConfig

  • 404

    The resource couldn't be found

GET/shop/webhook-configs/{webhookConfigId}
200
example response
{
  "data": {
    "id": "69f1e799a591f1014900043f",
    "name": "Default webhooks",
    "url": "https://example.com/trybe-webhooks",
    "method": "post",
    "secret": "gldyACJS7uyraHPpuoTV4JIh",
    "events": [
      "basket.submitted"
    ],
    "notification_emails": [
      "jane@example.com",
      "jane@example.com",
      "jane@example.com"
    ],
    "enabled": false,
    "site_id": "bad861d7-2687-2207-5f97-ccc31e97919b",
    "organisation_id": "e735fc3c-374e-e7b8-95d8-7dbf081817fd"
  },
  "meta": {
    "events": [
      {
        "event": "basket.submitted",
        "description": "Fired when a basket is submitted"
      }
    ]
  }
}
404
example response
{
  "message": "The requested resource could not be found"
}
updateWebhookConfig

Update a WebhookConfig

Use this endpoint to update an existing WebhookConfig.

Path parameters

Request body

  • A name to identify this webhook config, for internal use.

  • url
    Nullable

    An HTTPS URL where the webhooks should be sent.

  • method
    Nullable

    The HTTP verb to be used. Defaults to `post`` if not set.

    Possible values are get and post

  • secret
    Nullable

    A secret to be used to generate a signature for each webhook. Must be a minimum of 12 characters.

  • An array of string identifiers for the webhook events to be subscribed to.

  • An array of emails which should be sent a notification if the webhook has issues.

  • Whether this webhook should currently be enabled.

  • The ID of the site this config belongs to.

Responses

  • 201

    The response to a request a single WebhookConfig

  • 404

    The resource couldn't be found

PUT/shop/webhook-configs/{webhookConfigId}
201
example response
{
  "data": {
    "id": "69f1e799a591f10149000475",
    "name": "Default webhooks",
    "url": "https://example.com/trybe-webhooks",
    "method": "post",
    "events": [
      "basket.submitted",
      "basket.submitted",
      "basket.submitted",
      "basket.submitted"
    ],
    "notification_emails": [
      "jane@example.com",
      "jane@example.com"
    ],
    "enabled": true,
    "site_id": "6f15e6a6-1974-dde8-5081-a5fe525a97ca",
    "organisation_id": "2579403d-30d0-88d2-94a9-fdda2a37c19d"
  },
  "meta": {
    "events": []
  }
}
404
example response
{
  "message": "The requested resource could not be found"
}
deleteWebhookConfig

Archive a WebhookConfig

Use this endpoint to archive a WebhookConfig.

Path parameters

Responses

  • 204

    WebhookConfig archived

  • 404

    The resource couldn't be found

DELETE/shop/webhook-configs/{webhookConfigId}
204
example response
Empty response
404
example response
{
  "message": "The requested resource could not be found"
}
restoreWebhookConfig

Restore a WebhookConfig

Use this endpoint to restore an archived WebhookConfig.

Path parameters

Responses

  • 200

    The response to a request a single WebhookConfig

  • 404

    The resource couldn't be found

POST/shop/webhook-configs/{webhookConfigId}/restore
200
example response
{
  "data": {
    "id": "69f1e799a591f10149000440",
    "name": "Default webhooks",
    "url": "https://example.com/trybe-webhooks",
    "method": "post",
    "secret": "gldyACJS7uyraHPpuoTV4JIh",
    "events": [
      "basket.submitted",
      "basket.submitted",
      "basket.submitted",
      "basket.submitted",
      "basket.submitted"
    ],
    "notification_emails": [
      "jane@example.com",
      "jane@example.com"
    ],
    "enabled": false,
    "site_id": "ad318f95-5774-9ed7-7071-4cb11c1192c2",
    "organisation_id": "a0ca7139-c901-79cf-0d67-5f29512d0298"
  },
  "meta": {
    "events": [
      {
        "event": "basket.submitted",
        "description": "Fired when a basket is submitted"
      },
      {
        "event": "basket.submitted",
        "description": "Fired when a basket is submitted"
      },
      {
        "event": "basket.submitted",
        "description": "Fired when a basket is submitted"
      },
      {
        "event": "basket.submitted",
        "description": "Fired when a basket is submitted"
      }
    ]
  }
}
404
example response
{
  "message": "The requested resource could not be found"
}