Use template (Slack Channel New Message to Twilio SMS) to send an SMS for every new message on Slack.
We can use track new incoming messages for a specific Slack channel using this.
- Pull the template from central
bal new -t choreo/slack_new_message_to_twilio_sms <newProjectName>
- Slack Account
- Twilio Account
- Create a Slack app which connects to your development workspace. More information on this can be found here.
- Obtain an OAuth token for the app visiting
OAuth & Permissions
tab in appFeatures
. - Generate an OAuth token linking the specific workspace, providing the necessary scopes. (Ex. incoming-webhook, channels:history)
- Create your own Slack app and enable Event Subscription in your Slack app settings. (Request URL Ex: <PUBLIC_URL>/slack/events)
- Subscribe to the events that you are planning to listen and save changes. (Ex: message.channels)
- Obtain verification token from the Basic Information section of your Slack App
- Add the created Slack app to the Slack channel
-
To use Twilio service, you need to provide the following:
- Account SId
- Auth Token
Create a file called Config.toml
at the root of the project
[<ORG_NAME>.slack_new_message_to_twilio_sms]
fromMobile= <SAMPLE_FROM_MOBILE>"
toMobile = "<SAMPLE_TO_MOBILE>"
verificationToken = "<SLACK_VERIFICATION_TOKEN>"
channelId = "<SLACK_CHANNEL_ID>"
[<ORG_NAME>.slack_new_message_to_twilio_sms.twilioClientConfig]
accountSId = "<ACCOUNT_SID>"
authToken = "<AUTH_TOKEN>"
Phone numbers must be provided in E.164 format: +, for example: +16175551212 Channel ID must be obtianed by the channel URL or using below steps.
- Click on your channel name <#channel name>
- Scroll down the drop down ot the bottom
- Copy the channel ID.
Run the Ballerina project created by the integration template by executing bal run
from the root.
You can check for Twilio SMS once new Slack message is received.