Use Case: Slack Notification on User Specified Event
A web hook does not require user intervention to be used, it is enough that the necessary conditions defined during creation are met.
Now let’s show a practical example of a web hook execution. We want every time a user creates a date category, a Slack channel will be notified through a bot.
The configuration will be:
In the headers, we include everything that is necessary for the application to function. In the current example, we include the Content-type and the security token.
We then identify the method to use, which is POST, the URL taken from the Slack API documentation, and finally the body, defined in JSON format in this case.
In the body, it is also possible to parameterize the fields that must be filled in when the event is triggered, taking into consideration the defined body:
The “Text” field corresponds to the message that will be sent, and with the notation {{field}}, we define the fields that will be modified during the execution of the web hook. The fields must then be entered in the form under “Request Template Parameters,” as shown in the figure.
The fields defined here must then be filled in based on the user’s needs and the response of the event. To do this, you must modify the configuration of the web hook match rule.
In the “Request Template Parameters Mapping” section, you populate the parameters previously defined in the web hook creation form. The available parameters are:
resourceType: resource type (Blindata resource type) of the response resourceIdentifier: resourceId of the resource where the hook was called:
Field | Description |
---|---|
resourceName | The name of the examined resource. |
resourceType | The resource type (Blindata resource type) of the response |
resourceIdentifier | The resourceId of the resource where the hook was called |
user | The user who triggered the webhook. |
tenantName | The name of the tenant where the webhook was triggered. |
tenantUuid | The identifier of the tenant where the webhook was triggered. |
tenantSchema | The schema of the tenant where the webhook was triggered. |
eventType | The type of event (e.g., POST, PUT, etc.) that triggered the webhook. |
payload | The payload of the actual call response. In this example, it is the JSON response obtained from creating the data category (concept). |
The fields are therefore populated with ‘payload.name’ to obtain the name of the data category (concept), ‘user.displayName’ for the name of the event performer, ‘payload.uuid’ for the identifier of the created resource, ’eventType’ to understand what type of event has been triggered, and ‘payload.description’ to display the description of the resource. If we modify the Data Category “Store”, the final result will be: