Interface WebhooksAPI

interface WebhooksAPI {
    clearCache: () => void;
    createWebhook: (
        body: WebhookPost,
        options?: ApiCallOptions,
    ) => Promise<CreateWebhookHttpResponse>;
    deleteWebhook: (
        id: string,
        options?: ApiCallOptions,
    ) => Promise<DeleteWebhookHttpResponse>;
    getWebhook: (
        id: string,
        options?: ApiCallOptions,
    ) => Promise<GetWebhookHttpResponse>;
    getWebhookDeliveries: (
        id: string,
        query: {
            eventType?: string;
            limit?: number;
            next?: string;
            prev?: string;
            sort?:
                | "status"
                | "+status"
                | "-status"
                | "triggeredAt"
                | "+triggeredAt"
                | "-triggeredAt";
            status?: "success"
            | "fail";
        },
        options?: ApiCallOptions,
    ) => Promise<GetWebhookDeliveriesHttpResponse>;
    getWebhookDelivery: (
        id: string,
        deliveryId: string,
        options?: ApiCallOptions,
    ) => Promise<GetWebhookDeliveryHttpResponse>;
    getWebhookEventTypes: (
        options?: ApiCallOptions,
    ) => Promise<GetWebhookEventTypesHttpResponse>;
    getWebhooks: (
        query: {
            createdByUserId?: string;
            enabled?: boolean;
            eventTypes?: string;
            level?: string;
            limit?: number;
            name?: string;
            next?: string;
            origins?: "api" | "automations" | "management-console";
            ownerId?: string;
            prev?: string;
            sort?:
                | "url"
                | "name"
                | "-name"
                | "+name"
                | "+createdAt"
                | "-createdAt"
                | "+updatedAt"
                | "-updatedAt"
                | "createdAt"
                | "updatedAt"
                | "+url"
                | "-url";
            updatedByUserId?: string;
            url?: string;
        },
        options?: ApiCallOptions,
    ) => Promise<GetWebhooksHttpResponse>;
    patchWebhook: (
        id: string,
        body: WebhookPatch[],
        options?: ApiCallOptions,
    ) => Promise<PatchWebhookHttpResponse>;
    resendWebhookDelivery: (
        id: string,
        deliveryId: string,
        options?: ApiCallOptions,
    ) => Promise<ResendWebhookDeliveryHttpResponse>;
    updateWebhook: (
        id: string,
        body: WebhookBase,
        options?: ApiCallOptions,
    ) => Promise<UpdateWebhookHttpResponse>;
}
Index

Properties

clearCache: () => void

Clears the cache for webhooks api requests.

Type declaration

    • (): void
    • Clears the cache for webhooks api requests.

      Returns void

createWebhook: (
    body: WebhookPost,
    options?: ApiCallOptions,
) => Promise<CreateWebhookHttpResponse>

Creates a new webhook. User must be assigned the TenantAdmin role to create tenant level webhooks.

Type declaration

an object with the body content

CreateWebhookHttpError

deleteWebhook: (
    id: string,
    options?: ApiCallOptions,
) => Promise<DeleteWebhookHttpResponse>

Deletes a specific webhook.

Type declaration

The webhook's unique identifier.

DeleteWebhookHttpError

getWebhook: (
    id: string,
    options?: ApiCallOptions,
) => Promise<GetWebhookHttpResponse>

Returns details for a specific webhook.

Type declaration

The webhook's unique identifier.

GetWebhookHttpError

getWebhookDeliveries: (
    id: string,
    query: {
        eventType?: string;
        limit?: number;
        next?: string;
        prev?: string;
        sort?:
            | "status"
            | "+status"
            | "-status"
            | "triggeredAt"
            | "+triggeredAt"
            | "-triggeredAt";
        status?: "success"
        | "fail";
    },
    options?: ApiCallOptions,
) => Promise<GetWebhookDeliveriesHttpResponse>

Returns deliveries for a specific webhook. Delivery history is stored for 1 week.

Type declaration

    • (
          id: string,
          query: {
              eventType?: string;
              limit?: number;
              next?: string;
              prev?: string;
              sort?:
                  | "status"
                  | "+status"
                  | "-status"
                  | "triggeredAt"
                  | "+triggeredAt"
                  | "-triggeredAt";
              status?: "success"
              | "fail";
          },
          options?: ApiCallOptions,
      ): Promise<GetWebhookDeliveriesHttpResponse>
    • Returns deliveries for a specific webhook. Delivery history is stored for 1 week.

      Parameters

      • id: string

        The webhook's unique identifier.

      • query: {
            eventType?: string;
            limit?: number;
            next?: string;
            prev?: string;
            sort?:
                | "status"
                | "+status"
                | "-status"
                | "triggeredAt"
                | "+triggeredAt"
                | "-triggeredAt";
            status?: "success"
            | "fail";
        }

        an object with query parameters

        • OptionaleventType?: string

          Filter resources by event-type

        • Optionallimit?: number

          Maximum number of deliveries to retrieve

        • Optionalnext?: string

          Cursor to the next page

        • Optionalprev?: string

          Cursor to previous next page

        • Optionalsort?:
              | "status"
              | "+status"
              | "-status"
              | "triggeredAt"
              | "+triggeredAt"
              | "-triggeredAt"

          Field to sort by, prefix with -/+ to indicate order

        • Optionalstatus?: "success" | "fail"

          Filter resources by status (success or fail)

      • Optionaloptions: ApiCallOptions

      Returns Promise<GetWebhookDeliveriesHttpResponse>

      GetWebhookDeliveriesHttpError

The webhook's unique identifier.

an object with query parameters

GetWebhookDeliveriesHttpError

getWebhookDelivery: (
    id: string,
    deliveryId: string,
    options?: ApiCallOptions,
) => Promise<GetWebhookDeliveryHttpResponse>

Returns details for a specific delivery.

Type declaration

The webhook's unique identifier.

The delivery's unique identifier.

GetWebhookDeliveryHttpError

getWebhookEventTypes: (
    options?: ApiCallOptions,
) => Promise<GetWebhookEventTypesHttpResponse>

Lists event-types that are possible to subscribe to.

Type declaration

GetWebhookEventTypesHttpError

getWebhooks: (
    query: {
        createdByUserId?: string;
        enabled?: boolean;
        eventTypes?: string;
        level?: string;
        limit?: number;
        name?: string;
        next?: string;
        origins?: "api" | "automations" | "management-console";
        ownerId?: string;
        prev?: string;
        sort?:
            | "url"
            | "name"
            | "-name"
            | "+name"
            | "+createdAt"
            | "-createdAt"
            | "+updatedAt"
            | "-updatedAt"
            | "createdAt"
            | "updatedAt"
            | "+url"
            | "-url";
        updatedByUserId?: string;
        url?: string;
    },
    options?: ApiCallOptions,
) => Promise<GetWebhooksHttpResponse>

Retrieves all webhooks entries for a tenant that the user has access to. Users assigned the TenantAdmin role can retrieve all webhooks. A user can have up to 150 webhooks at one time.

Type declaration

    • (
          query: {
              createdByUserId?: string;
              enabled?: boolean;
              eventTypes?: string;
              level?: string;
              limit?: number;
              name?: string;
              next?: string;
              origins?: "api" | "automations" | "management-console";
              ownerId?: string;
              prev?: string;
              sort?:
                  | "url"
                  | "name"
                  | "-name"
                  | "+name"
                  | "+createdAt"
                  | "-createdAt"
                  | "+updatedAt"
                  | "-updatedAt"
                  | "createdAt"
                  | "updatedAt"
                  | "+url"
                  | "-url";
              updatedByUserId?: string;
              url?: string;
          },
          options?: ApiCallOptions,
      ): Promise<GetWebhooksHttpResponse>
    • Retrieves all webhooks entries for a tenant that the user has access to. Users assigned the TenantAdmin role can retrieve all webhooks. A user can have up to 150 webhooks at one time.

      Parameters

      • query: {
            createdByUserId?: string;
            enabled?: boolean;
            eventTypes?: string;
            level?: string;
            limit?: number;
            name?: string;
            next?: string;
            origins?: "api" | "automations" | "management-console";
            ownerId?: string;
            prev?: string;
            sort?:
                | "url"
                | "name"
                | "-name"
                | "+name"
                | "+createdAt"
                | "-createdAt"
                | "+updatedAt"
                | "-updatedAt"
                | "createdAt"
                | "updatedAt"
                | "+url"
                | "-url";
            updatedByUserId?: string;
            url?: string;
        }

        an object with query parameters

        • OptionalcreatedByUserId?: string

          Filter resources by user that created it

        • Optionalenabled?: boolean

          Filter resources by enabled true/false

        • OptionaleventTypes?: string

          Filter resources by event-type/types, a single webhook item can have multiple event-types

        • Optionallevel?: string

          Filter resources by level that user has access to (either user or level)

        • Optionallimit?: number

          Maximum number of webhooks to retrieve

        • Optionalname?: string

          Filter resources by name (wildcard and case insensitive)

        • Optionalnext?: string

          Cursor to the next page

        • Optionalorigins?: "api" | "automations" | "management-console"

          Filter resources by origins, supports multiorigin

        • OptionalownerId?: string

          Filter resources by user that owns it, only applicable for user level webhooks

        • Optionalprev?: string

          Cursor to previous next page

        • Optionalsort?:
              | "url"
              | "name"
              | "-name"
              | "+name"
              | "+createdAt"
              | "-createdAt"
              | "+updatedAt"
              | "-updatedAt"
              | "createdAt"
              | "updatedAt"
              | "+url"
              | "-url"

          Field to sort by, prefix with -/+ to indicate order

        • OptionalupdatedByUserId?: string

          Filter resources by user that last updated the webhook

        • Optionalurl?: string

          Filter resources by url (wildcard and case insensitive)

      • Optionaloptions: ApiCallOptions

      Returns Promise<GetWebhooksHttpResponse>

      GetWebhooksHttpError

an object with query parameters

GetWebhooksHttpError

patchWebhook: (
    id: string,
    body: WebhookPatch[],
    options?: ApiCallOptions,
) => Promise<PatchWebhookHttpResponse>

Patches a webhook to update one or more properties.

Type declaration

The webhook's unique identifier.

an object with the body content

PatchWebhookHttpError

resendWebhookDelivery: (
    id: string,
    deliveryId: string,
    options?: ApiCallOptions,
) => Promise<ResendWebhookDeliveryHttpResponse>

Resends the delivery with the same payload.

Type declaration

The webhook's unique identifier.

The delivery's unique identifier.

ResendWebhookDeliveryHttpError

updateWebhook: (
    id: string,
    body: WebhookBase,
    options?: ApiCallOptions,
) => Promise<UpdateWebhookHttpResponse>

Updates a webhook, any omitted fields will be cleared, returns updated webhook.

Type declaration

The webhook's unique identifier.

an object with the body content

UpdateWebhookHttpError