An orange square with a Conversations API speech bubble icon.

Channel | SMS

It's simple. tyntec's programmable SMS API makes sending and receiving SMS easy. With our 100+ direct-to-carrier and 1200+ extremely reliable connections and over 15 years experience we offer you an programmable SMS API that is rich in features and customizable. You send and receive SMS and we handle the rest. Get familiar with our SMS API and learn how to send your first messages on the following pages.

SMS | Integration with Customer.io

customerio logo 2

Hi there!

In this tutorial, you will learn how to integrate a Customer.io campaign with the tyntec SMS API. This integration allows you to reach your customers via SMS.

You will need

  • Your tyntec API key from your tyntec account
  • Sender ID or a business phone number registered with tyntec
  • A testing phone number whitelisted in the Business Center
  • A verified Customer.io account

Step One: Create a campaign

You will create a workflow of a message which Customer.io sends in response to user behavior. (In this case, to new opt-ins.).

1. Sign in to your Customer.io account.

2. Head over to the Campaigns tab.

3. Click Create Campaign.

4. Enter a campaign name and click Create Campaign.

Shows the UI in which one can create campaign with name of the campaign filled in

5. Select the They meet conditions trigger. Under the Define the trigger condition section, click Add segment condition, select in Signed up, and click the checkmark button. Click Save & Next.

Shows UI that selects meeting criteria to run this campaign. The all contacts on sign in is selected.

6. Drag the Webhook block and drop it in the middle.

7. Select the dropped Webhook block.

8. Click Add Request. Set the method to POST, URL to “https://api.tyntec.com/messaging/v1/sms” and create a header with name apikey and with your tyntec API key as its value. Then set the body to the following JSON:

{
    "from": "FROM",
    "to": "{{customer.phone}}",
    "message": "Thank you for registering."
}

Replace FROM with your sender ID. Click Save Changes and Done.

The UI shows request with above code sample.

9. Set the Sending behavior to Send Automatically. Click Save.

The UI shows workflow editor that has trigger (sign up) and message sending event.

10. Click Next.

11. Select Skip goal and click Save & Next.

The UI shows how to define goals in campaign. In our tutorial, we skip goal creation.

12. Under the Who should match? section, select Future additions only, and click Start Campaign. Click Close.

The UI asks user who should match, if current + future contacts or only future contacts. In this tutorial you should use future contacts.

Now, you have created a new campaign that sends an SMS to every new customer.

Step Two: Create a broadcast

You will create a message sent to a large group of people at once. (In this case, an API triggered broadcast.).

1. Head over to the Broadcasts tab.

2. Click Create Broadcast.

3. Enter a broadcast name, select the Messages triggered via API type and click Create Broadcast.

The UI shows two possible broadcasts options. One is Newsletter, the other is API call. The guide uses the later.

4. Under the Define manually section, click Add attribute condition, type in a phone, select exists, and click the checkmark button. Click Save & Next.

The UI defines manual match on phone number, which means message will only go to those with phone number in Customer.io

5. Drag the Webhook block and drop it in the middle.

6. Select the dropped Webhook block.

7. Click Add Request. Set the method to POST, URL to “https://api.tyntec.com/messaging/v1/sms” and create a header with name apikey and with your tyntec API key as its value. Then set the body to the following JSON:

{
    "from": "FROM",
    "to": "{{customer.phone}}",
    "message": "We have a new product for you!"
}

Replace FROM with your sender ID. Click Save Changes and Done.

The UI shows full API request with its URL and body.

8. Set the Sending behavior to Send Automatically. Click Save.

The UI shows workflow for this broadcast. Triggering condition (manual match) and API request are filled in.

9. Click Next.

10. Select Skip goal and click Save & Next.

The UI shows two options, one is to define goals for this broadcast, second is to skip goals. Click on skip goals.

11. Click Activate Broadcast. Click Close.

Now, you have created a new broadcast that sends an SMS to all customers with a phone number.

Step Three: Try it out!

Nothing more is needed to reach your customers through SMS. Now you can test it!

1. Start with adding a new person. Head over to the People tab, click Add People and Add a Person. Fill in an id or email. Click Create New Attribute, name the new attribute phone and fill in your testing mobile phone number as the value. Click Save Changes.

2. Then, trigger the broadcast manually. Head over to the Broadcasts tab, select the API Triggered Broadcasts, and click your broadcast. Go to the Triggering Details tab and click Trigger a Broadcast. Click Send now.

The UI shows a conformational pop-up if you want to send the message manually.

3. Grab your phone. In a few moments, you will see two messages from Customer.io.

The WhatsApp shows incoming messages from your broadcast and campaign

Voila! Your campaigns and broadcasts can now be sent as SMS messages!

More?

People can be added to Customer.io using the REST API. You may want to create a new person when a new user sends a message to your business phone number for the first time. For that, you need to deploy a webhook that creates a new person using Customer.io’s /api/v1/customers/{identifier} endpoint. Then, you need to register your endpoint in the SMS channel in Conversations API so that it calls the endpoint whenever a user sends you an SMS.

If you want to keep using the SMS channel in Conversations API for SMS notifications, change the URL from https://api.tyntec.com/messaging/v1/sms to https://api.tyntec.com/conversations/v3/messages and set the body to the following JSON:

{
  "from": "your business phone number",
  "to": "{{customer.phone}}",
  "channel": "sms",
  "content": {
    "contentType": "text",
    "text": "A simple text message"
  }
} 

Also, campaigns can be triggered in various ways. For example, they can be triggered by an event, such as a purchase. Events can be triggered using Customer.io’s /api/v1/customers/{identifier}/events endpoint.