Skip to main content
Forward Incoming SMS to Slack

Our workflow automations allow you to forward inbound SMS messages to your company Slack.

S
Written by Shelby Glynn
Updated over a week ago

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.

  1. From the Slack API apps page, select Create an App.

  2. Select From scratch.

  3. Enter CloudTalk as the App Name and select your business Slack workspace.

  4. Create App.

  5. Navigate to Features > Incoming Webhooks within the app pages.

    1. Turn on Activate Incoming Webhooks.

  6. Navigate to Features > OAuth & Permissions.

    1. Under Scopes > Bot Token Scopes, select Add an OAuth Scope.

      1. Select chat:write.customize scope.

      2. Select Add scopes when asked to add chat:write.

      3. Select chat:write.public as the last scope in this section.

    2. Under Scopes > User Token Scopes, select Add an OAuth Scope.

      1. Select chat:write.

  7. Navigate to Settings > Install App and select Install to Workspace.

  8. Choose the channel you want your CloudTalk app to post in. Allow.

  9. 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

Send SMS Notification to Channel

From your dashboard, navigate to Workflow Automations.

  1. Select +Add Workflow and name your workflow.

  2. Start by defining a trigger. In this example, our trigger will be the receipt of an SMS. Under Object, we will select sms. For Action, we select received.

    Adjust your own specifications as necessary.

  3. 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.

    You can add multiple conditions, or choose to undo conditions you have set by clicking the triple dots in the righthand corner of the box and clicking delete.

  4. 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 box 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 box populate with a value that looks like the structure of the one in the picture (event.properties.tags) 

  5. In the second box 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).

  6. In the third box, 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.

  7. 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.

  8. Under Values, various Keys should appear with their boxes already populated. These cannot be edited. The input token should autofill the first Key box. The x's which populate the Value box for Key: token are only placeholders. In order to connect to Slack, we must either the User OAuth token OR the Bot User OAuth Token found in your Slack app settings (see Create CloudTalk App in Slack).

    1. The Bot User OAuth allows posting in any public Slack channel, while the User OAuth requires you to be added to the channel.

    2. Refer to the Slack help center for additional guidance on Slack tokens.

  9. Enter the name of your Slack channel in the Value box for Key>channel. Our Slack channel name here is #client-text. Next to Key>text, we choose to enter a dynamic value, or a value that will populate based on information from the system. To accomplish this, we will once again click into the box in question, then click on a keyword from the Useful data for your Workflow section.

  10. 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 content of the SMS received, the sender of the SMS, and the receiver of the SMS.
    โ€‹

  11. We can choose to Test now to make sure our conditions are working correctly. Be aware that clicking Submit for a Test will send a real Slack notification to the channel input in the Channel value. It's a good idea to make your team aware of the testing process.

  12. Save and activate to put the automated Slack notification in place immediately.

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 inputs in the Property box, or inputs in the Value box which will always result in no matches.

  • After clicking into the Property box, 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 "+555555555555" (no hyphens included) but the entered value looks like "+555-555-555-555" (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!

Did this answer your question?