Create or Replace webhooks

POST https://chatapps.8x8.com/api/v1/accounts/:accountId/webhooks

Sending a POST request on this endpoint allows to add a new webhook for an account or modify the configuration of an existing one .

Webhooks can be given an account-wide and/or a type-wide scope using the * character

For example: if a webhook is created with subAccount=* , this webhook will receive events across all the subaccounts of an account.

Request

Path Parameters

    accountId stringrequired

    Possible values: >= 32 characters and <= 36 characters, Value must match regular expression ^[0-9A-Fa-f]{8}[-]?(?:[0-9A-Fa-f]{4}[-]?){3}[0-9A-Fa-f]{12}$

    You must replace {accountId} with the accountid that you want to use.

Body array

  • Array [
  • subAccountIdstringrequired
    • Sets the subaccount scope of the webhook.
    • Use * to receive events across all subAccounts.
    • Use the subAccountId to receive events for a specific subaccount.
    Example: Onion_Marketing
    urlstring<uri>required

    The url to use for the webhook (8x8 platform will send events to this URL).

    Example: http://example.com
    httpAuthorizationstring

    A static value sent as the HTTP Authorization header with every webhook request. Use this for static credentials such as API keys or pre-shared tokens.

    Example — Basic Authorization:

    • Encode user:password in base64 (e.g. dXNlcjpwYXNzd29yZA==)
    • Set this field to Basic dXNlcjpwYXNzd29yZA==

    For OAuth 2.0 Client Credentials flow, leave this field empty and use the oauth property instead.

    Example: Bearer 9QQhlsEb8VY
    enabledboolean

    Use this flag to enable or disable a Webhook.

    Default value: true
    Example: false
    typestring

    This parameter is not mandatory.

    • Sets the type of webhook to be added/updated.
    • Possible values are:
      • CADR for delivery receipts
      • MSG for inbound messages
      • CABM for Messaging Apps Business Management Updates
    • When not provided, webhooks will be added/updated for only CADR and MSG.

    Possible values: [CADR, MSG, CABM]

    oauth object

    OAuth 2.0 Client Credentials configuration for webhook authentication. When configured, the platform will obtain an access token from the specified token endpoint and include it in the webhook request.

    urlstring<uri>required

    The token endpoint URL used to obtain the OAuth access token.

    Example: https://auth.example.com/oauth/token
    clientIdstringrequired

    The client ID for OAuth authentication.

    Example: my-client-id
    clientSecretstringrequired

    The client secret for OAuth authentication.

    Example: my-client-secret
    credentialsLocationstringrequired

    Specifies where the client credentials are sent: header (HTTP Basic Auth) or body (form body).

    Possible values: [header, body]

    Example: header
    scopestring

    Optional space-separated list of OAuth scopes to request.

    Example: read write
  • ]

The webhook was created or updated successfully

Bad request error response

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":1002,
"message":"Invalid MSISDN format (not E.164 international number)",
"errorId":"b4478860-b76c-e811-814e-022a35cc1c71",
"timestamp":"2018-08-04T09:25:40.9235752+00:00"
}

Request was not authenticated response

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":1200,
"message":"Request was not authenticated properly",
"errorId":"db9dced4-3534-4d86-9d18-6b448af0d621",
"timestamp":"2018-08-02T09:42:38.8988997+00:00"
}

Internal server error

Schema

    codeintegerrequired

    Error code

    messagestring

    Error description

    errorIdstring<uuid>required

    Unique id of error. You can use it as reference when sending enquiries to 8x8 support

    timestampstring<date-time>required

    Data and time of the error occurence

{
"code":1001,
"message":"Provided subAccountId doesn't belongs to your account",
"errorId":"91b106f0-c0da-4aba-a43a-7af9c5893a80",
"timestamp":"2017-04-19T02:31:19.4297387+00:00"
}
{
"code":2000,
"message":"Internal server error",
"errorId":"db9dced4-3534-4d86-9d18-6b448af0d621",
"timestamp":"2018-07-02T09:42:38.8988997+00:00"
}

Source: https://developer.8x8.com/connect/reference/add-webhooks-1 · 8x8 CPaaS Developer Docs. Synced for support deflection.

Was this article helpful?
or
0 out of 0 found this helpful

0 Comments

Please sign in to leave a comment.

Didn't find what you were looking for?

Submit a request