Webhook Push Alerts for Cosmos DB
The Webhook Push Alerts for Cosmos DB stage allows external systems to register for push alerts when Cosmos DB data is updated.
Stage Overview
The Webhook Push Alerts for Cosmos DB stage allows for the automated creation of APIs which allow external systems to register themselves for webhook-based push alerts on data stored via a Store Cosmos DB Upsert stage, so that whenever data is updated in the Cosmos DB data store, a push-based alert to all registered systems is automatically performed by Integration Hub.
The Webhook Push Alerts for Cosmos DB stage type is only supported when deploying using Standard Logic Apps.
Stage Definition File Location
Webhook Push Alerts for Cosmos DB are deployed by creating an appropriately formatted JSON definition file in the following location:
Stage JSON Definition File Format
The JSON definition file for a Webhook Push Alerts for Cosmos DB definition is as follows:
{
"name": "stage-name",
"displayName": "Brief Stage Title",
"description": "Brief description of the stage.",
"enabled": "$env:STATUS_<INTEGRATION_NAME>",
"source": "wh-cdb-{name}-webhook-trigger",
"concurrency": 10,
"cdb": {
"databaseId": "DatabaseID-string-value",
"containerId": "ContainerID-string-value",
"connectionString": "$env:CDB_CONNECTION_STRING",
"partitionKey": "/KEY"
},
"publicAPI": false,
"additionalRetryHttpCodes": [
409
],
"retryOn4xx": {
"errorCodePath": "error.code",
"errorMessagePath": "error.message",
"errors": [
{
"errorCode": "Code_1",
"errorMessage": "Message 1."
},
{
"errorCode": "Code_2",
},
{
"errorMessage": "Message 2."
}
]
},
"retryPolicy": {
"fastRetryAttempts": 5,
"fastRetryDelay": 10,
"slowRetryAttempts": 23,
"slowRetryDelay": 60
},
"disableRetry": false,
"preLogTransformSchemaFileName": "schemas/path/to/schema/schema-name.liquid",
"preLogTransformSchemaType": "liquid|javascript",
"preLogTransformFormat": "json|xml|csv"
}
| Property | Sub-Property | Description |
|---|---|---|
name | The name of the Webhook Push Alerts for Cosmos DB definition. | |
displayName | Optional (but highly recommended). A short (3 or 4 word) "display name" for the stage, used as a "title" of the stage in the Integration Hub Portal service's self-documentation capability. | |
description | Optional (but highly recommended). A brief (10 to 15 word) description of the stage, used as a brief description of the stage's purpose in the Integration Hub Portal service's self-documentation capability. For a more detailed explanation (when needed), use the stage markdown feature. | |
enabled | Optional boolean flag (true or false). Default is true. Generally set via a DevOps variable. Controls if the stage is deployed enabled or not. | |
source | The source for a Webhook Push Alerts for Cosmos DB definition must be wh-cdb-{name}-webhook-trigger. | |
concurrency | Optional number of concurrent runs permitted for the stage. Default is 10. | |
cdb | ||
databaseId | The Cosmos DB Database ID that should be monitored for changes to data. | |
containerId | The Cosmos DB Container ID that should be monitored for changes to data. | |
connectionString | The connection string for the Cosmos DB resource. Generally set via a DevOps variable. | |
partitionKey | The Cosmos DB Partition Key for the Database/Container. | |
publicAPI | Optional boolean flag (true or false). Default is false. When true, the webhook management APIs are deployed without a requirement to be an authenticated user to call them; otherwise, a valid API Management subscription key will be required to use the webhook management APIs. | |
additionalRetryHttpCodes | An optional array of additional retry HTTP codes. By default, the stage will automatically retry sending the webhook push alert to the remote API in the event of a standard "transient error" HTTP response code being received. (See also the retryPolicy section below.)However, if required, additional HTTP response codes can be defined, and if these response codes are received from the remote API, these will also trigger a retry of the webhook push alert to the remote API. This is useful when remote APIs do not respect standard HTTP response codes. | |
retryOn4xx | An optional object to inspect HTTP 4xx error payloads, and retry the webhook push alert under defined conditions. See Outbound API Retry on HTTP 4xx Errors for more details. | |
retryPolicy | Optional object defining a custom retry policy. By default, an initial fast retry (with 5 attempts, 10 minutes apart) is followed by a slow retry (23 attempts, 60 minutes apart). Retry attempt values can be set to 0 to disable the fast and/or slow retry steps, if desired. | |
disableRetry | Optional boolean flag (true or false). Default is false. When true, the stage does not attempt to retry webhook push alert calls to the remote API if a retryable error is detected. |
Pre-Logging Transformation
This stage supports the optional pre-logging transformation feature using the following fields:
preLogTransformSchemaFileNamepreLogTransformSchemaTypepreLogTransformFormat
See the Pre-Logging Transformation for details.
Webhook Management APIs
When a Webhook Push Alerts for Cosmos DB definition is in place, Integration Hub will deploy two webhook management APIs and associated stages in the integration.
POST Management API
The POST management API allows external systems to register a webhook URL, to "subscribe" to push-based alerts that will be sent in the event of any changes in the defined Cosmos DB database/container/partition key.
When calling the POST management API, the following payload is required:
{
"callbackUrl": "https://..."
}
DELETE Management API
The DELETE management API allows external systems to de-register an existing webhook URL, to "unsubscribe" from push-based alerts.
When calling the DELETE management API, the same payload as above is required.
Last updated on