Use Cases

Practical examples of using Codatum workflows.

Sending Notifications to Slack

Scenario: Notify about recent account creations

Create a query to count accounts created within the last day, and create a workflow that sends notifications to Slack only when new accounts are created.

Creating a Query

  • Output data for the last day based on the creation date column

SELECT *
FROM `codatum-example.example.accounts`
WHERE created_at >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 DAY)
ORDER BY created_at DESC

Schedule Settings

  • Configure to execute daily at 10:00 AM

    • Repeat interval: Every day

    • Start time: 10:00 (GMT+09:00) Japan Standard Time

Step 1: Run Query

  • Select the query created above

    • If you create a workflow from the "Queries" screen, the workflow configuration will start with the selected query already entered in Step 1

Step 2: Slack (Codatum)

  • Add the integration and add the App to the Slack channel you want to notify in advance

  • Channel: notification_codatum

    • Channels with the App added will be listed

  • Message body:

    • You can check how to enter variables to use in the message based on the "First row"

      • Selecting account_name will be entered as {{ query.rows[0].account_name}}

    • To retrieve multiple rows of query execution results and display them row by row, select "</> Rows"

      • Loop processing will be automatically entered in Liquid notation

      • In each loop, the value is entered in row, so select the variable you want to enter in the form {{ row.account_name }}

  • Thread

    • When sending Slack in multiple steps, you can send messages in a thread to the message sent in the previous step

  • Include link to Codatum

    • You can add a link to the workflow

    • Viewing the workflow requires owner permissions for the workflow

  • Execution Conditions (Optional)

    • Check whether there are output results in the query of Step 1 with the following conditional expression

    • {{ query.rowCount }} > 0

      • It can be entered by selecting "Row Count" on the GUI from "</> (Insert Variable)"

      • query stores the output results of "Run Query"

        • If you have configured multiple "Run Query", an identification number such as query_1 will be added

  • If the condition is not met, the action will not be executed

Number of accounts created within the last day: {{ query.rowCount }}
Recently created accounts (displaying up to 5)
{% for row in query.rows limit:5 %}
Account name: {{ row.account_name }}
Created date: {{ row.created_at }}
{% endfor -%}

Last updated

Was this helpful?