Archive

SMS integration in Slack

Create and integrate your own slash command in Slack for sending SMS messages through Routee's API.

TABLE OF CONTENTS

- Overview

- Approach

- Routee Setup

- Slack Setup

- Examples

OVERVIEW

The command will perform a very simple task: take a phone number and a text as parameters and send an SMS message through Routee's API.

It has the following syntax:

/sms +359899000000 Message text

Before you start you need the following:

A plain text editor or your favorite IDE

A web hosting where you can upload the simple application we're going to write

APPROACH

The general approach is to implement a simple middleware application that will handle the data sent from Slack command and invoke Routee's API to send a text message. The application needs to be accessible under a public URL address.Whatever text you enter after the command itself will be sent as an HTTP request to your app's URL. The simple app will then handle the data sent by the Slack command, perform some validation and send a text message using Routee's API. It will also return a proper message to Slack whether the sending of the message has been successful or not.

ROUTEE SETUP

Go to www.slack.com and click the "Create workspace" button at the top right corner of the page. After that choose the "Developer's Platform" option and fill in your details in the form which will appear on the next page. When you hit the "Register" button you will be prompted to verify your email address. Check your email for the verification email from Routee, and click on the "ACTIVATE YOUR ACCOUNT NOW" button in it. When your account has been verified, you will be redirected to your dashboard (https://dev.routee.net/#/management/dashboard).

SLACK SETUP

Register your team to Slack

Go to www.slack.com and click "Create workspace" button at the top right corner of the page. Then enter your email address and click "Next". Now go and check your email for the confirmation code from Slack and enter it on the confirmation page. On the next page, you will see a form where you need to enter your first and last names. After you fill in those fields you need to click on the "Continue to Password" button and enter your password in the page which you will see.The next page will be a form where you need to fill the information about your organization and after this is done and you click "Continue to Company Name" button you will be prompted for your Company Name. Click on "Continue to Team URL" and fill in the address which you will use with your team. Click "Create Team" and you are done! On the next page, you can choose teammates which you can invite or you can skip this part.

Set up Slack app

Go to the Slack's API page (https://api.slack.com/) and click on "Your Apps" button at the top left corner of the page and after that click on on "Create an App" button which will appear in the next page. Enter your app details, choose the team which will use this app and click "Create App".

Set up Slack command

Choose your Slack app and go to "Slash Commands" located under the "App Features" section of the right menu. Hit the "Create New Command" button and fill in the form with the following data: for "Command" enter /sms, for "Request URL" add the address of the already uploaded handler, "Short Description" will be something describing what the command will do, and the "Usage hint" filed will be: +359899000000 Message text. Click on the "Save" button and now your command is ready to be used.