Send notifications to external applications
You can have hila send a notification to any external application that supports webhooks, such as Slack or Microsoft Teams.
-
Create the webhook in your external application. See your external application help system for how to create a webhook for that app.
-
Open the Notifications window in hila with the User > Settings > Notifications menu at the bottom of the hila left nav bar.
-
Click Add Notification.
-
Enter a name and description for the notification.
-
Select the type of connection.
-
You can build a query and specify condition for triggering a notification in Form Mode or Code Mode.
- Form Mode
- Select a table name in the Existing Table Name dropdown.
- Select a column and a function.
- Enter an alias for that column/function pair for use in building a condition for triggering the notification.
- Add another column/function pair by clicking the large plus sign (+) to the right of the column/function row.
- Under the WHERE section, select a column and comparator and then add a value.
- To add another column/comparator row to narrow the scope of the query, select AND or OR from the Boolean dropdown.
- Under the CONDITION section, select an alias and comparator and then add a value. This defines the condition for triggering the notification.
- To add another alias/comparator row to make a compound condition, select AND or OR from the Boolean dropdown.
- Code Mode
- Select the Code Mode tab.
-
Enter the query code and the condition code that you want to define the trigger for the notification. As a basic example, enter the following code to send a fixed message every time the schedule activates:
- QUERY & WHERE —
select 1 as cnt
- CONDITION —
query_result["cnt"] >= 0
- QUERY & WHERE —
- Form Mode
-
In the SCHEDULE section, specify how often you want to run the query and check the condition for sending a notification.
-
Enter the webhook URL from your external application in the REST ENDPOINT > URL text box.
-
Set Method to POST.
-
Build the payload message to send to the external application in the REST BODY TEMPLATE text box.
This message uses Jinja templates. For more information on Jinja templates, see Jinja.
-
Click Add Notification.
-
In the Notifications window, find your new notification and click the toggle to activate the notification.
Results
The notification appears in the external application at the intervals defined by the schedule.