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": "69ceac2e81222b01710003c5",
    "name": "Default webhooks",
    "url": "https://example.com/trybe-webhooks",
    "method": "post",
    "events": [
      "basket.submitted",
      "basket.submitted",
      "basket.submitted"
    ],
    "notification_emails": [
      "jane@example.com",
      "jane@example.com",
      "jane@example.com",
      "jane@example.com",
      "jane@example.com"
    ],
    "enabled": false,
    "site_id": "c5522956-2a37-11d8-74b7-6b96f85ea333",
    "organisation_id": "cb31bb84-24a2-23c9-76d1-f21f5804f125"
  },
  "meta": {
    "events": [
      {
        "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": "69ceac2e81222b017100039a",
    "name": "Default webhooks",
    "url": "https://example.com/trybe-webhooks",
    "method": "post",
    "events": [
      "basket.submitted",
      "basket.submitted",
      "basket.submitted",
      "basket.submitted",
      "basket.submitted"
    ],
    "notification_emails": [
      "jane@example.com",
      "jane@example.com",
      "jane@example.com"
    ],
    "enabled": false,
    "site_id": "46526967-cf15-9ec5-c64b-ce65283fc6b9",
    "organisation_id": "c4bf6a08-587c-405e-23ff-9d159856f627"
  },
  "meta": {
    "events": []
  }
}
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": "69ceac2e81222b01710003c6",
    "name": "Default webhooks",
    "url": "https://example.com/trybe-webhooks",
    "method": "get",
    "secret": "gldyACJS7uyraHPpuoTV4JIh",
    "events": [
      "basket.submitted"
    ],
    "notification_emails": [
      "jane@example.com",
      "jane@example.com",
      "jane@example.com",
      "jane@example.com",
      "jane@example.com"
    ],
    "enabled": true,
    "site_id": "e7e9862b-b50f-6a90-559c-23bc1362f64b",
    "organisation_id": "5a20528b-86a7-5176-8201-119967ca49e7"
  },
  "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"
      }
    ]
  }
}
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": "69ceac2e81222b017100039b",
    "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",
      "jane@example.com"
    ],
    "enabled": false,
    "site_id": "0fc14dff-f0ae-c384-10d4-662c84381bf4",
    "organisation_id": "e4cac4b3-e66d-8745-3fdd-d14958893248"
  },
  "meta": {
    "events": [
      {
        "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"
}