Skip to main content
Version: v1.2.1

Create a webhook subscription

Create a webhook

POST 

https://api.cuemby.io/functions/v1/webhooks

Create a webhook subscription

  • This endpoint is used to create a webhook subscription for specific events in your organization or projects.
  • Webhooks are scoped to a level (organization, project, or environment) and require a referenceId that must exist in the corresponding scope.
  • You can also define entity-specific filters using entityFilters, allowing you to limit events to specific resource names, types, or categories.

Scopes

  • organization: Applies to all projects/environments under the organization.
  • project: Targets events within a specific project (e.g. environments, runtimes).
  • environment: Focused on events within one environment (e.g. runtimes).

Entity Filters

  • These allow you to filter only the events that match a particular pattern. For example:
    • Filter only runtimes that start with api-:
      \{ "entity": "runtime", "name": "api-%" \}
    • Only include clusters from a environment:
      \{ "entity": "environment", "name": "dev" \}

  • The combination of scope, referenceId, url, and entityFilters must be unique within an organization.

Body

  • The body property is an optional string that uses the 'mustache' template syntax. If provided, it will be used to format the webhook payload according to the specified template. For example, when integrating with Microsoft Teams, the body must follow the structure required by Teams' webhook format. If the body property is not provided, the webhook will send the full event data as a JSON object.

Headers

  • Authorization: Optional. If provided, it will be included in the webhook request headers
  • X-Custom-Header: Optional. If provided, it will be included in the webhook request headers

Request

Header Parameters

    X-Organization-Id stringrequired

    The ID of the organization (this parameter is not required when using API key authorization)

Bodyrequired

    namestringrequired
    Example: Notify Runtime Deployments
    urlurirequired
    Example: https://hooks.example.com/webhook
    scopestringrequired

    Possible values: [project, environment]

    Example: project
    referenceIdstringrequired
    Example: proj_abc123
    eventsstring[]required
    entityFilters object[]required
  • Array [
  • oneOf
    entity
    Example: runtime
    namestring

    A regex pattern to match the name of the entity. For example, use /^api-.* to match all names starting with "api-"

    Example: api-%
    typestring

    Possible values: [container]

  • ]
  • secretstring

    If provided, events will be signed using HMAC SHA-256

    Example: whsec_abc123
    bodystring

    The body property is an optional string that uses the 'mustache' template syntax. If provided, it will be used to format the webhook payload according to the specified template. For example, when integrating with Microsoft Teams, the body must follow the structure required by Teams' webhook format. If the body property is not provided, the webhook will send the full event data as a JSON object.

    Example: { 'type': 'message', 'attachments': [ { 'contentType': 'application/vnd.microsoft.card.adaptive', 'content': { '$schema': 'http://adaptivecards.io/schemas/adaptive-card.json', 'type': 'AdaptiveCard', 'version': '1.2', 'body': [ { 'type': 'TextBlock', 'text': 'CuembyPlatform runtimeId: {{ Id }}, runtimeName: {{ name }}', 'weight': 'Bolder', 'size': 'Medium' }, { 'type': 'TextBlock', 'text': 'Please, to continue, review the following item with', 'wrap': true } ] } } ] }
    headers object

    Optional headers to include in the webhook request. This can be used to pass authentication tokens or other metadata.

    Authorizationstring
    Example: Bearer xxxx
    X-Custom-Headerstring
    Example: value

Responses

Webhook created successfully

Schema
    successboolean
    Default value: true
    timestampstring
    Default value: 2024-01-01T00:00:00.000Z
    statusCodenumber
    Default value: 200
    statusTextstring
    Default value: Success
    messagestring
    Default value: Message successfully
    Example: Webhook created successfully
    localizationstring
    Default value: someone-method:success
    data object
    idstring
    namestring
    urlstring
    scopestring
    referenceIdstring
    eventsstring[]
    entityFilters object[]
  • Array [
  • oneOf
    entity
    Example: runtime
    namestring
    Example: api-%
    typestring

    Possible values: [container]

    Example: container
  • ]
  • bodystring
    headersobject
    activeboolean
    Example: true

Authorization: x-api-key

name: x-api-keytype: apiKeyin: header
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.cuemby.io/functions/v1/webhooks");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("x-api-key", "<x-api-key>");
var content = new StringContent("{\n \"name\": \"Notify Runtime Deployments\",\n \"url\": \"https://hooks.example.com/webhook\",\n \"scope\": \"project\",\n \"referenceId\": \"proj_abc123\",\n \"events\": [\n \"runtime.created\"\n ],\n \"entityFilters\": [\n {\n \"entity\": \"runtime\",\n \"name\": \"api-%\",\n \"type\": \"container\"\n }\n ],\n \"secret\": \"whsec_abc123\",\n \"body\": \"{ 'type': 'message', 'attachments': [ { 'contentType': 'application/vnd.microsoft.card.adaptive', 'content': { '$schema': 'http://adaptivecards.io/schemas/adaptive-card.json', 'type': 'AdaptiveCard', 'version': '1.2', 'body': [ { 'type': 'TextBlock', 'text': 'CuembyPlatform runtimeId: {{ Id }}, runtimeName: {{ name }}', 'weight': 'Bolder', 'size': 'Medium' }, { 'type': 'TextBlock', 'text': 'Please, to continue, review the following item with', 'wrap': true } ] } } ] }\",\n \"headers\": {\n \"Authorization\": \"Bearer xxxx\",\n \"X-Custom-Header\": \"value\"\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://api.cuemby.io/functions/v1
Auth
Parameters
— headerrequired
Body required
{
  "name": "Notify Runtime Deployments",
  "url": "https://hooks.example.com/webhook",
  "scope": "project",
  "referenceId": "proj_abc123",
  "events": [
    "runtime.created"
  ],
  "entityFilters": [
    {
      "entity": "runtime",
      "name": "api-%",
      "type": "container"
    }
  ],
  "secret": "whsec_abc123",
  "body": "{ 'type': 'message', 'attachments': [ { 'contentType': 'application/vnd.microsoft.card.adaptive', 'content': { '$schema': 'http://adaptivecards.io/schemas/adaptive-card.json', 'type': 'AdaptiveCard', 'version': '1.2', 'body': [ { 'type': 'TextBlock', 'text': 'CuembyPlatform runtimeId: {{ Id }}, runtimeName: {{ name }}', 'weight': 'Bolder', 'size': 'Medium' }, { 'type': 'TextBlock', 'text': 'Please, to continue, review the following item with', 'wrap': true } ] } } ] }",
  "headers": {
    "Authorization": "Bearer xxxx",
    "X-Custom-Header": "value"
  }
}
ResponseClear

Click the Send API Request button above and see the response here!