Sending an SMS to any phone number from tulip

Currently you can only send SMS to users in the tulip users table (as well as they have to be validated)

https://support.tulip.co/en/articles/2260011-how-to-receive-sms-alerts-via-the-trigger-editor

This is one method of sending SMS to anyone by putting a thin wrapper (api gateway & lambda) around the Amazon SNS service

Prerequisites

Another usefull tutorial on getting started with serverless

https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started-hello-world.html


So, change to the directory you cloned to, then issue a sam build.

Then do a SAM deploy –guided

I called the stack tulip-send-sms

After the stack completes, you can go to your API-Gateways and you should see

WARNING

At this point you have a public API that can send Text messages. You should secure it! At the very least put an API key on it. https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-setup-api-key-with-console.html

In our case we set this up using a private API Gateway


Ok, now that we have a SMS gateway let’s give it a test. Click in on the gateway, click in on Stages and then expand PROD.

You are interested in the Invoke URL, click it and it will launch (but fail) something like

https://awb———-.execute-api.us-east-1.amazonaws.com/Prod/sendsms

It fails because we didn’t pass it any parameters. Let’s do that

https://awb———-.execute-api.us-east-1.amazonaws.com/Prod/sendsms?phone_number=12223334444&message=hello

The number should be E.164 format


Ok, let’s call this API from Tulip

Go to your connectors, create new connector

Then click the details of the Connector and fill in the connection details. Put in just the host portion of your API gateway

Next create a function.

You will copy your resource (/Prod/sendsms) and paste it in the top address.

Create two Query Parameters, phone_number and message. Use a variable $phone_number$ and $message$ as the value.

On your inputs create a phone_number and message.

Now to test! Put in a phone number and a message and hit test. You should receive a text message

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s