Create a workflow to automatically forward an incoming SMS to a Slack channel.
User Level:
Admin
Create CloudTalk App in Slack
Before sending API calls to Slack, you must create a CloudTalk app and allow it to post in designated channels.
From the Slack API apps page, select
Create an App
.Select From scratch.
Enter
CloudTalk
as the App Name and select your business Slack workspace.Create App
.Navigate to Features > Incoming Webhooks within the app pages.
Navigate to Features > OAuth & Permissions.
Navigate to Settings > Install App and select
Install to Workspace
.Choose the channel you want your CloudTalk app to post in. Allow.
When redirected back to Settings > Install App, you will be able to see the User OAuth Token and Bot User OAuth Token. You will need to copy one of these values when setting up your workflow.
If the admin configuring the workflow automation is not added to the channel you've selected to post in, the Bot User OAuth Token will need to be used for the token
value in the next steps. This is because using the User OAuth Token only allows posting in channels where the associated CloudTalk user is added.
Slack SMS Workflow
In this example, we will automate sending a notification to Slack in response to an SMS received. This one of many ways to automate workflow with CloudTalk.
Goal:
Forward a text message from an important client to the team Slack channel.
Prerequisites
You've successfully added an Essential, Expert, or Custom plan with CloudTalk
You have created a CloudTalk app in Slack and connected it to your desired Slack channel (see Create CloudTalk App in Slack).
Token permissions for your team Slack channel include chat:write permissions, meaning your workplace allows data coming in from another app to post on Slack channels in place of an individual user. You can reference the Slack API help guide to read about how Slack tokens work.
Send SMS Notification to Channel
From your dashboard, navigate to Workflow Automations.
Select +Add Workflow and name your workflow.
Start by defining a trigger. In this example, our trigger will be the receipt of an SMS. Under Object, we will select Message. For Action, we select received.
Adjust your own specifications as necessary.
Now we can choose to set up an optional condition. The condition will define an additional situation or category that must be met in order for our automated Slack notification to go out.
In our example, we only care if the SMS which was received (our trigger) was a from a particular important client. Therefore, we want to set a condition wherein the system will check if SMS sender has the same number as the important client. To populate the field correctly, click into the first input labeled Property, and view the list of available phrases to the right, labeled under Useful data for your Workflow. We will choose the phrase labeled sender.
Important: You must choose from this list of tag words in order for your condition to work correctly. You should see the Property input populate with a value that looks like the structure of the one in the picture (event.properties.tags)
In the drop-down menu labeled Operand, we will choose is equal to from the dropdown list. When selecting your own operand, make sure it fits logically into your final statement (e.g., "is greater than or equal to" would best be paired with a number value).
In the Value input, we fill in the value which we want the sender to be equal to in order for our action to occur. Refer to the paired Example Values in the Useful data for your Workflow sidebar. In our example, the suggested value will be the important client's phone number, entered in the format shown.
Click
Confirm and continue
.
We have just created a condition that will scan the CloudTalk numbers of all SMS messages received, checking if the sender number is equivalent to the important client's number.The next step is to choose an action which will happen when our conditions are met. We select the Action type Send notification to Slack.
Under Values, various Keys in each key-format-value set are prepopulated and cannot be changed. You will use the value part of these sets to configure your Slack notifications. In the configuration set where the Key refers to token, replace the x's with the actual token value to authorize communication between CloudTalk and your Slack workspace. To connect to Slack, you must use either the User OAuth Token or the Bot User OAuth Token, which can be found in your Slack app settings (see Create CloudTalk App in Slack).
The Bot User OAuth allows posting in any public Slack channel, while the User OAuth requires you to be added to the channel.
Refer to the Slack help center for additional guidance on Slack tokens.
Enter the name of your Slack channel in the Value input in the configuration set where the Key refers to channel.
In the configuration set where the Key refers to text, you can choose to enter a dynamic value—one that will be populated based on information from the system. To do this, click into the field, then select a keyword from the Useful Data for Your Workflow section, as described in step 4 of this guide..
We have chosen three dynamic values for the text or content portion of our message which will send to slack. We know the Slack notification will contain the phone number, recipient phone number and the content of the SMS received.
Click Confirm and continue to finish the action step configuration.
Click Save to finish the workflow configuration.
To activate your Slack notifications, enable your workflow by switching the toggle next to the workflow name to the On position.
We have now accomplished our goal of forwarding a text message from an important client to the team Slack channel, a process which we can later edit and toggle off or on at our choosing.
Troubleshooting Tips
When it comes to Slack:
Confirm your team's Slack app is up and running and that you are signed in
Check that you have successfully authorized Slack to access CloudTalk
Make sure your token scopes include chat:write permissions. Refer to the Slack API guides or the Slack help center for assistance.
Faulty conditions are often the result of unrecognized values in the Property input, or value in the Value input which will always result in no matches.
After clicking into the Property input, you must click one of the pre-selected keywords within the Useful data for your Workflow section to the right.
You can also refer to the Useful data for your Workflow section to validate whether the Value you entered seems to be a good match for the property you've chosen.
When setting a value for a condition that searches entered phone numbers, make sure you are using the number recognized through CloudTalk. Format matters. If the suggested value example in the Useful data for your Workflow section has a number with the format "+55 55 5555 5555" (no hyphens included) but the entered value looks like "+55 55 5555 5555" (hyphens included), your condition will never find matches.
If you have any further questions please reach out to our Support team, we are always happy to help!