For datasets that use the ElasticStore to track results, use Data Update Alerts to raise alerts when the data is not updated upon an expected interval. For example, if a query isn’t executed as scheduled, this will trigger an alert that can be sent via email/webhook/Slack.
Sections
- Creating a Data Update Alert
- Creating a Query Error Alert
- Alert Actions: Email
- Alert Actions: Webhook
- Alert Actions: Slack
- Alert Actions: Teams
Creating a Data Update Alert
This outlines the initial steps to create the alert.
-
From any dashboard, click the Alerts icon on the left sidebar
-
In the Alerts Management screen, Click Add Data Update Alerts +.
-
This opens the Alerts Options window.
-
Give your Alert a name. This is how it will be displayed in Alerts Management.
-
In the Dataset dropdown, select the dataset to create an alert for.
- Adding Filters: Users can add filters to the query. Click + to add a filter and - to remove. There are two modes to choose from: Query Parameter and Filter on Query Results.
- Query Parameter - Applicable for "Direct Query" modes, the parameters selected will be automatically passed on to this user. The field name must be in the format $c9_XXX$ or $c9_XXX(defaultVal)$, where the default value will be passed at runtime if the value is empty. To add multiple values, add the value and hit enter.
- Filter on Query Results - Applies the filter on top of the query results to limit the data. The field name is the field name to filter by (without $c9_). Enter the value, data type, and operation type.
-
In the Run Every section, schedule the alert to run at a chosen interval.
- Skip Alert if data is same as last alert: Check this box to skip this alert If the data is the same as the last alert. Useful to avoid repetitive alerts.
- Select an Alert Action to configure an alert to be sent via email/webhook/Slack/Teams.
Creating a Query Error Alert
Follow these steps to notify users of a query failure.
- Click Queries from the left sidebar.
- Click Query Details from any of the queries.
- On the query's dataset management page, click More...
- Click Add Query Error Alert. Alternatively, you can go to Alerts on the left menu bar and click Add Query Error Alerts +.
- Give the alert a name on the Create Alert page, and choose the dataset.
- Adding Filters: Users can add filters to the query. Click + to add a filter and - to remove. There are two modes to choose from: Query Parameter and Filter on Query Results.
- Query Parameter - Applicable for "Direct Query" modes, the parameters selected will be automatically passed on to this user. The field name must be in the format $c9_XXX$ or $c9_XXX(defaultVal)$, where the default value will be passed at runtime if the value is empty. To add multiple values, add the value and hit enter.
- Filter on Query Results - Applies the filter on top of the query results to limit the data. The field name is the field name to filter by (without $c9_). Enter the value, data type, and operation type.
- Set up the alert notification to receive an alert whenever the query fails via email, webhook, slack, or Teams. For more details, refer to Alert Actions.
- In addition, you can add tokens that would help provide better context on the query failure in the email body.
Tokens:
%QUERY_ERROR_MESSAGE%: Returns the query error message
%QUERY_ERROR_STACK_TRACE%: returns the query error stack trace as a string.
Note: This is available for non-direct queries only
Alert Actions
Email Alerts allows you to send the alert via email along with a CSV attachment of results to a list of recipients.
To set up an Email Alert:
- Under Alert Actions, select the Send Email tab.
- Enter the Email Subject that will be displayed.
- Click on the Add Email From to enter the email address that the email will be sent from (support@knowi.com by default). This address will appear as the sender of the email when received in your inbox.
- Under Recipient List, enter the email address of the recipient(s). Comma separated for multiple recipients.
- Under Email Template, enter the Email Body. (optional) Write custom HTML to customize the email template.
- Click Test Run (optional) to send a test email alert to the chosen recipient(s).
- Once the configuration is complete, click Save.
Webhook
Webhook Alerts allow you to send an alert directly to your application (or third-party applications). We'll send a POST request with a JSON payload of the data, which you can use to drive actions within your application.
The data in the POST will be a JSON formatted dataset of the full raw dataset for which the alert is generated.
To set up a Webhook Alert:
- Under Alert Actions, select Webhook and click on the + Add Webhook to open the Add Webhook window.
- Under Name, enter the name of the webhook.
- Under URL to Invoke, enter the endpoint in your application that can accept a post request with JSON (Array of Objects). For example: https://webhook.site
- Under the Authentication URL, enter the authentication endpoint to get a token, which can be passed into each subsequent query. Only required if the API requires it. This is an absolute URL.
- Under Headers, enter any headers for HTTP requests to the “URL to Invoke” endpoint. There can be one header per line.
Knowi also provides the following C9 tokens which can be used to identify the alert on the Webhook headers.
$c9_taskDate$: It denotes the date of the alert in the (yyyy-mm-dd) format
$c9_taskName$: It defines the name of the webhook alert. For example: Test webhook
$c9_taskId$: It denotes any Id of the alert. For example: 2971
$c9_taskType$: This can be either “report” or “alert” - Under Auth Headers, enter any optional authentication-related headers. One header per line.
-
Under the Custom POST Body, the user can pass data tokens through the webhook using the POST Body field. Enter a custom post body to be sent out. Data tokens can pass field values from data. If left empty, the post body for the webhook will contain the conditional data saved as JSON or just a default message with the dataset name triggered.
For example,
For sending activity samples, we can type %opened% or %customer%, etc., and it will be replaced with the value of the fields of the first row of triggered data.
Note: The data of token only can pass first record of triggered alert/report data (or conditional data alerted) - Click Save.
- Click Test Run (optional) to send a test webhook alert to the chosen application. Here is an example of the results in JSON form:
- Once the configuration is complete, click Save.
Slack
Slack integration allows you to trigger actions in your Slack channel(s) for a given condition triggered by an alert. When the condition is triggered, we'll send a message to a predefined channel(s) including the attachment of full data or conditional data depending on the options selected.
To set up a Slack Alert:
- Under Alert Actions, select the Slack tab.
- If this is your first time connecting Knowi to Slack, click the New Team icon. Follow the prompts to give Knowi access to your Slack account.
- Click + Add Slack. This opens up the Add Slack sidebar.
- Give your Alert a name.
- Under Alert Message, enter a user-defined message that will show up when the Alert is received in Slack. If left blank, it will send a default message.
- In the Alert Team dropdown, choose the Slack workspace to send the Alert to.
- In the Alert Channels dropdown, choose the Slack channel to publish the Alert notifications to.
- Attach Full Dataset as CSV (optional): Check this box to attach the full underlying dataset as a CSV to the Slack Alert.
- Send a slack message for each row of alert data (optional): Check this box to send a slack message for each row of alert data.
- Click Save.
- Click Test Run (optional) to send a test Slack alert to the chosen channel(s). Here’s how the Alert will show up in your Slack channel:
- Once the configuration is complete, click Save.
Teams
MS Teams integration allows you to trigger actions in your Teams channel(s) for a given condition triggered by an alert. When the condition is triggered, we'll send a message to a predefined channel(s) including the attachment of full data or conditional data depending on the options selected.
To set up a Teams Alert:
- Under Alert Actions, select the Teams tab.
- Click + Add Teams. This opens up the Add Teams window.
- Give your Alert a name.
- Under Alert Message, enter a user-defined message that will show up when the Alert is received in Teams. If left blank, it will send a default message.
- In the Alert Team dropdown, choose the Teams workspace to send the Alert to.
- In the Alert Channels dropdown, choose the Teams channel to publish the Alert notifications to.
- In Cloud9QL filter before POST text box, enter any additional manipulation to the data that will be sent to Teams.
- Attach Full Dataset as CSV (optional): Check this box to attach the full underlying dataset as a CSV to the Teams Alert.
- Attach Results after Cloud9QL as CSV (optional): Check this box to attach the results after the Alert condition as a CSV to the email.
- Click Save.
- Click Test Run (optional) to send a test Teams alert to the chosen channel(s).
- Once the configuration is complete, click Save.