How to Create Standup Bot Using Conductor-Slack Integration
Riza Farheen
Posted on July 7, 2023
Slack, the popular workplace communication platform, is winning hearts worldwide. However, its usage shouldn’t be limited to communications alone. There is more you can do with powerful integrations with other applications.
We used our product, “Orkes Conductor,” to automate our daily tasks in Slack. At Orkes, we solved two of our biggest challenges. We created our engineering teams' standup bot & our community channel’s welcome message through effective Slack integrations using Orkes Conductor.
In this blog post, we’ll have a walkthrough on how you can create a standup bot for posting daily updates on a Slack channel using Orkes Conductor. Orkes Conductor is a powerful orchestration platform for building distributed applications that makes it easy to incorporate integrations such as Slack in your applications seamlessly.
Creating Standup Bot
Let’s see how Orkes Conductor can be leveraged to build your standup bot.
Here is the overview of our standup bot:
- The workflow is kicked off at a specific time (e.g., 10 AM) on weekdays.
- The workflow sends a personalized message to each team member to provide an update.
- Users provide an update to the bot.
- The workflow waits for all the updates to arrive and waits for a specific time (e.g., 3 hours).
- Once all the updates are given, or the timeout occurs, all the updates are collected and posted to a shared team channel.
Boom! You’re done with the updates! 🤖
No more messing up with wrong channels; and the managers need not worry about missing the updates.
Let’s have a sneak peek at the most essential steps in building your Standup bot.
- Create a Workflow, Webhook & Scheduler in Orkes Conductor
- Create a Slack App to be integrated with your organization’s Slack Account
Creating Workflow
Let’s visualize the workflow.
You can get the JSON file for the workflow here.
In this example, we have 2 users. They are the forks of a fork-join task. These forks run in parallel to complete the workflow. For each individual, a fork is to be added, where each fork includes a sub-workflow, which is nothing but incorporating another workflow within your main workflow.
Here’s how the workflow added as sub-workflow (individual_updates) looks like:
You can get the JSON file for the workflow here.
When the main workflow is run, all the forks execute in parallel. So let’s see how each of the individual updates is processed.
- The workflow begins with an HTTP task (send_welcome_message) that sends a welcome message to the user asking for daily updates.
You can specify the Slack account’s token as secret so that your confidential data is not exposed within the workflow definitions.
workflow.secrets.slack_standup_token
- It is followed by a do-while task (loopTask) that captures the user inputs. The loop condition is checked based on the webhook task (webhook_task), which captures incoming events from Slack.
For the webhook task, you need to create a Webhook inside Conductor that can listen to events from Slack.
- A series of JSON JQ Transform tasks, then follow it.
- jq_aggregate_updates - Used to aggregate updates from the user.
- jq_convert_to_string - Used to convert the updates into CSV format.
- append_user_name - Used to append the user name with updates.
- The final output is posted to the Slack channel using an HTTP task (post_updates).
Specify the Slack channel where the update is to be posted. You can save the Slack channel name as a secret in Orkes Conductor so that your confidential data is not exposed within your workflow definition.
workflow.secrets.slack_conductor_channel_url
You can add the above workflow as sub-workflows in the fork-join tasks depending on the number of employees in your team.
In addition, you can configure the main workflow so that all the sub-workflows added as forks can be marked as optional so that the workflow can complete without waiting for all the forks. This comes into use when employees are OOO, so their updates won’t be available.
If you want to collect all the updates within a certain time, such as, let’s say, within 3 hours, you can add a timeout for the individual_updates workflow of 10,800 seconds.
Creating Webhooks
You have seen that a webhook task is utilized to collect user updates. You need to create a Webhook inside Orkes Conductor by navigating to the Webhooks option from the left menu and choosing the platform as “Slack”. Choose the standup bot workflows created in the previous step. Now, a Webhook URL will be generated.
Scheduling Workflows
The workflow should be scheduled to run at the standup time. Suppose the standup time set by your organization is 10:00 AM PT every Mon-Fri. You can create a scheduler in the Conductor that ensures the workflow runs at the scheduled time.
A Scheduler can be created from your Conductor console by navigating to Scheduler > Definitions and providing the following CRON expression.
This ensures that the workflow runs at 10:00 AM PT every Mon-Fri. The UI also displays the local browser time. While creating the scheduler, ensure to choose the workflow name & the corresponding version to be scheduled.
Sample JSON for the scheduler is as follows:
{
"name": "standup",
"cronExpression": "0 0 17 * * MON-FRI",
"startWorkflowRequest": {
"name": "standup_updates_main",
"version": "1",
"input": {}
}
}
Creating Slack App
Next, you must create a Slack App to integrate with your company’s Slack account. For this, navigate to https://api.slack.com/apps & click Create an App.
- Provide an app name and pick your workspace where this app will be integrated.
- Next, move to Features > Incoming Webhooks and turn on Activate Incoming Webhooks.
- Then, move to Features > Event Subscriptions, and turn on Enable Events. Provide your Webhook URL under the field Request URL. Under Subscribe to bot events, click Add Bot User Event & add message.im.
- Then, navigate to Features > App Home, and under the Messages Tab, enable the option Allow users to send slash commands and messages from the messages tab.
- Finally, enable permissions for the Slack app by navigating to Features > OAuth & Permissions. Under Scopes > Bot Token Scopes, add chat:write permission.
Install App to Slack Workspace
Next, we must install this Slack app in your organization’s workspace.
- From Settings > Install App, click Install to Workspace.
- Choose the channel to where the app is to be installed.
Once the app is installed in your workspace, a Bot User OAuth Token will be generated. This is to be added as a secret in Conductor.
Configuration Updates to be made
If you want to try this in your Slack workspace, create the secrets with your values in your Conductor console.
- Navigate to Secrets from the left menu and create a new secret with a name; in this example, it is slack_standup_token, and the value is the OAuth token copied right now. The workflow definition specifies this secret value so that authorization will occur.
- You also need to create another token; in this example, it is slack_conductor_channel_url with the Webhook URL copied from Slack.
Have a look at the following images for a better understanding of where you can get these values:
In the main workflow definition, for each of the sub-workflows added for the users, replace the user_name & user_id with your employee details:
{
"name": "riza_updates",
"taskReferenceName": "riza_updates",
"inputParameters": {
"user_name": "Riza",
"user_id": "XXXXXXXXXX"// Go to Slack > View the profile > Click on three dots > Copy member ID
},
"type": "SUB_WORKFLOW",
Workflow Execution
Let’s execute the workflow and see how it runs. In the actual example, the workflow would be automatically triggered during the standup time.
So, the workflow is now waiting for the user’s update. Once the users open their Slack, they can see that the bot app has requested the update from the user.
Once the updates are posted, the user must send done
towards the end. Instantly, the message would be posted on the standup channel.
On checking the workflow execution, you can see that the fork of this particular user is completed and is waiting for the updates from the other user. Once the second user posts the updates, the workflow gets completed.
And we‘re done!
Here’s a video guide for the standup bot example:
Wrapping Up
We have successfully overcome one of our daily obstacles using powerful Conductor-Slack integration. Do you have similar challenges to be addressed? Orkes Conductor, built on the battle-tested Netflix Conductor, can help!
Orkes Conductor, the powerful orchestration platform, offers the cloud version of Netflix Conductor in all major cloud providers, including AWS, Azure & GCP.
If you require any assistance or have any inquiries, please don't hesitate to contact our team on Community Slack. We are always available to support you with your requirements.
Meanwhile, if you want to try Conductor for free, leverage Orkes Playground, a free developer sandbox.
If you find the experience valuable, we would greatly appreciate it if you could give us a 🌟 on our Conductor repository!
Posted on July 7, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.