Bringing your SMS Contacts Over to Telegram

Since TextIt is multi-channel, it is easy to make your bot work over SMS and chat applications like Telegram at the same time. Extending your bot to work over Telegram is also a great way to save on messaging fees. This is a short article on how you can invite your SMS contacts to use your Telegram bot and still keep their full contact history in your database.



Channels and URNs

When a contact reaches out to you on a new channel, a new contact will be created. Each contact will have an address for the channel they are using, called an urn. So if they are using both SMS and Telegram, you will have two contacts, one with an SMS urn (a phone number) and one with a Telegram urn (a number with an optional display name). Our goal will be merging these urns to on the same contact with the history.

Let's imagine a scenario where you have an SMS subscriber that you want to bring over to Telegram. In order to accomplish our above goal of having a single contact with two urns, we will take the following approach:

Steps

Send a text to our SMS contact with a link to our Telegram bot
Contact clicks on the link, which starts a Telegram chat session
Contact gets an SMS message saying, you are switch to Telegram asking to confirm
They confirm by typing "yes" and we add their new Telegram urn to their contact and mark it as the channel to use

Sending the invite

To send the invitation, we'll want to text them a link to our Telegram bot. You can get the like for your Telegram bot by visiting the bot inside the Telegram client and clicking share.



Our message might look something like this:

Save on messaging fees by switching to our Telegram bot. Just click here: https://t.me/PurringtonBot?start=phone@(text_slice((urn_parts(contact.urn).path), 1))

Since we want to encode our contact's current phone number in our Telegram invite, we need to pull the actual number from their urn. We can do that using the urn_parts() function that will let us access the urn path (which in this case is a phone number).

@(urn_parts(contact.urn).path)

This would return something like, +12065551212. Telegram is picky about embedding the plus character, so next we'll trim that off since we don't actually need it anyways. To do that, we'll put that inside of a text_slice function to trim off the first character.

@(text_slice((urn_parts(contact.urn).path), 1)).

Responding to the invite


On our Telegram bot's /start flow, we'll want to check what kind of start it is. They could be joining on their own, or they might be using our special invite link. So we'll want to split at the beginning of the flow and see if it starts with /start phone. If they did give us a phone number, we can then start that phone number in a flow in order to confirm things and add our new Telegram ID.

When they click the start button, they will pass something like /start phone12065551212. We can pull out just the phone number by using our friend text_slice again.

@(text_slice, input, 12))

The result of this will just be the phone number, or in our example 12065551212. Then we just use the Start Somebody Else action to add start that phone number in our confirmation flow.

Adding the new Telegram ID


In our confirmation flow, we'll want to just ask if they are sure. If they respond with yes, then we can figure out what their Telegram ID is and save it on our SMS contact.

It's important that we ask the contact with the phone number to confirm they are switching to Telegram. Without this, somebody could start the Telegram bot with an arbitrary phone number and potentially hijack a contact that doesn't belong to them if they are in your contact database. The other way around this is you could use a random code instead of the phone number to link the two accounts, but we are sticking with phone numbers in this example for simplicity. So long as we make sure to confirm things, we should be safe from bad actors.

In this case, we know that we were started by their Telegram contact, so we know the urn for that account. To reference the contact that started us, we can use @parent.contact. And since each contact has an urn, we can use @parent.contact.urn to get the Telegram ID. This will look something like telegram:1234567#norbertk. The actual ID is the number after the : and before the #. We can access that using, you guessed it, another expression.

If we pass the parent contact's urn through urn parts, we can access the path, which in the case of Telegram is the number.

@(urn_parts(parent.contact.urn).path)

We could stop there, but Telegram users can optionally have a display name denoted with the # at the end, so if we want to include that, we can get that on as well.

@(urn_parts(parent.contact.urn).display)

So altogether it looks like this crazy thing, which is really two separate expressions with our # in the middle.

@(urn_parts(parent.contact.urn).path)#@(urn_parts(parent.contact.urn).display)

And that's it!

If you have any questions on how to accomplish this, please let us know, we are happy to help.

Group Inclusion & Exclusion on Triggers

Triggers let you control how or when a flow begins or can allow a contact to join a group. A flow can be triggered by a keyword or missed call and scheduled on a future date.

What if you want a trigger to only act upon members of certain groups or to exclude groups?

First, navigate to the triggers tab.

Here, click the blue 'Create Trigger' button at the top left.

You'll see the list of possible trigger types.

For our example, we'll choose to create a message keyword that launches a flow.

At the bottom of this trigger's settings, we see that we can optionally choose to only include certain contact groups or to exclude contact groups.

In our example, we want contacts to send the keyword 'promo' that will trigger a Satisfaction Survey flow in order to receive a coupon. We don't want contacts who've already registered for this promo or a group called 'Segment A' to be able to participate, so we've excluded them.

Only members of these two groups will be excluded from starting the Satisfaction Survey flow- all other contacts who send the keyword will be started in the flow.


Want to learn even more about using TextIt? Check out our Help Center

Questions? Comments? Let us know!



New! Adding Group Membership to Contact Imports

We've updated Contact Imports to allow you to add contacts to a new or existing group! Here's how:


1. Navigate to the contacts tab. 


2. Click the "Import Contacts" button at the top left of the page.


3. Download and edit the template we provide (or choose a your own file) and upload it using the "Choose File" button. 

Be sure that you only use supported fields for your Column Headers in your spreadsheet. For example, if you want to add a registration date, use the Column Header Field:Registration_Date. You must separate spaces with underscores only!

Additionally, please check that your telephone numbers include country codes. We support users globally, so we need to know where your contacts are located.

5. After clicking the "Preview" button, you'll see the option to import headers from your file. In our sample, we have 3 headers: a telephone number, name, and field called Team. Additionally, we will choose group membership.

You have the option of creating a new group and giving it a name or adding the contacts to an existing group in your workspace. If you leave the group membership box unchecked, the contacts will not be added to any group.

That's it! After importing, you'll see the number of new contacts created or updated and any group memberships.

Looking for more information contact imports and exports? See our full help article here.


Want to learn even more about using TextIt? Check out our Help Center

Questions? Comments? Let us know!


Forwarding Calls in Voice (IVR) Flows

Use the 'Wait for Forwarded Call' Split Action in an IVR flow to forward calls to another phone number. Here's how it works:

In our example, we're asking contacts if they'd like to speak to a live agent or leave a message. If they choose to speak to a representative, the flow will forward their call on to another phone number of our choice.

The 'Wait for Forwarded Call' Split Action will have 4 possible exits:

  • Answered - The call was successfully answered by the agent
  • No Answer - The call was not picked up and the call disconnected
  • Busy - The line was busy and the call disconnected
  • Failed - The call failed

Depending on how the forwarded call is handled, you can create different actions to support your contact after the forwarded call is complete. In our example, we've chosen to send a customized voice message for calls that were successfully answered by a representative vs. those that either weren't answered at all or were busy. We also made sure to alert a team member when a forwarded call fails via a 'Send Somebody Else a Message' action.

After the forwarded call has ended, the contact will immediately move forward in the flow on original call with your voice number.

Be sure to learn more about building your IVR flows here.


Want to learn even more about using TextIt? Check out our Help Center

Questions? Comments? Let us know!


Starting a Contact in a Flow from the Contact's Information Page

You can now start a contact in a flow directly from their individual information page.

After navigating to the Contacts tab, click on the contact you'd like to start from your list:

On the contact's unique information and message history page, you'll then click the 3-dot menu button:

Choose "Start In Flow" from the dropdown menu:

Finally, select the flow where you'd like to start the contact:

That's it! The contact will then be immediately started in the chosen flow.


Want to learn even more about using TextIt? Check out our Help Center

Questions? Comments? Let us know!


Enabling Two-Factor Authentication

Looking to make your workspace login even more secure? You can now enable two-factor authentication, also called 2FA. Here's how:


1. Log in to your account and visit the workspace settings page. Scroll down the page to find the two-factor authentication section:

2. Click on this section to enable 2FA. You'll need to follow the directions on the following page:

You must download a one-time password (OTP) app like Google Authenticator or Authy in order to use 2FA.

3. Once your OTP app is downloaded and set up, you'll scan the QR code on your page. After scanning the QR code and generating a new account for your login, you'll see the required 6-digit code pop up in the app. It is only valid for a few seconds! Please be sure to use the current code.

4. Enter the valid 6-digit code and your current password and click the 'Enable' button.

5. Once enabled, you'll see a list of backup tokens. These are very important! Please record these tokens in a secure place.

That's it! Your 2FA is now enabled.


Want to learn even more about using TextIt? Check out our Help Center

Questions? Comments? Let us know!

Twilio Supported Countries for Two-Way SMS

Twilio two-way SMS messages allow you to carry on a conversation by both sending and receiving text messages. See more about using two-way SMS via Twilio here.

While not complete, the list of Twilio's supported countries for two-way SMS is constantly expanding.

The following countries are either generally supported or in Beta:

  • Australia
  • Austria
  • Belgium
  • Canada
  • Chile
  • Czech Republic
  • Denmark (Beta)
  • Estonia
  • Finland
  • France (Beta)
  • Germany
  • Hong Kong
  • Hungary (Beta)
  • Ireland,
  • Israel (Beta)
  • Italy (Beta)
  • Lithuania
  • Malaysia
  • Mexico (Beta)
  • Netherlands
  • Norway
  • Philippines (Beta)
  • Poland
  • Portugal 
  • Puerto Rico
  • Singapore (Beta)
  • South Africa (Beta)
  • Spain
  • Sweden
  • Switzerland
  • United Kingdom
  • United States
  • Vietnam (Beta)
  • Virgin Islands


Is your number not sending internationally when it should? Be sure you've enabled international sending!


Want to learn even more about using TextIt? Check out our Help Center

Questions? Comments? Let us know!

Limiting the Number of Incorrect Responses to a Question

You may want to set a limit to the number of times a contact can respond to a specific question in your flow, such as with a quiz or survey. You can do this by using the @node.visit_count expression within a Split by Expression action.

In the example below, we've created a very simple quiz. We want the contact to have limited opportunities to answer the question, so we will place the @node.visit_count expression on a 'Split by Expression' node to limit the number of guesses.

In the flow above, we see that after collecting the contact's response with a 'Wait for Response', we're evaluating their answer with a 'Split by Expression'. Since we only want to give the contact two opportunities to answer correctly, here's how we've written the expression and rule:

We've used the expression @node.visit_count and then written a rule with has a number above 1 since they've already used their one other attempt in the previous 'Wait for Expression', equaling two total attempts.

What this means is that if they've answered correctly on their first try, they'll be routed through the 'Correct' exit on the 'Wait for Response' node and get a congratulatory message. If they get their first try wrong, they'll be routed through the 'Other' exit where we've set a limit to the number of times the contact can be wrong. Because the visit count is set to a number above 1, no further attempts are permitted.

We can see how this works via the Simulator. This contact gave an incorrect response on their first attempt and was given a second and final opportunity to answer correctly. Because we set a @node.visit_count limit of above 1 via a 'Split by Expression' node, their second incorrect answer means they've used up all their tries.

Another contact, however, studied a bit harder:

Notice that in our follow-up message, we've referenced the number of tries the contact has made. We did this by using the same expression written as @node.visit_count/2. This would be especially useful if the contact had even more chances to respond correctly so they know how many opportunities remain.

Keep in mind that visit_count reflects only the current flow run. This means that if the contact is restarted in the flow, the count goes back to zero as counts from previous runs are not saved.



Want to learn even more about using TextIt? Check out our Help Center

Questions? Comments? Let us know!


Add a Facebook Page to Create a Messenger Channel

Great news! Facebook has updated their integration policies, so you can now easily connect a Facebook page to create a Messenger channel in just moments.

If you've already integrated a bot under Facebook's old policies, then you do not need to take any further action. Your channel will continue to work as always.

Add a Page

  1. Go to your Workspace Settings page and click the 'Add Channel' button.

2. Scroll down to the Facebook Messenger section.

3. Here, review the directions and then click the 'Add Facebook Page' button.

4. Log in to your Facebook account and then choose the page you'd like to add. Then, you'll be asked which permissions you'd like to allow.

That's it! You'll automatically be taken to your new channel's page where you can view your channel log.

You can now create a trigger that will refer a contact when a new conversation is started on Messenger.

Facebook Topics

Note that Facebook has updated their API to require that all messages sent to a contact after 24 hours have an appropriate 'tag', or what we call a 'topic'.

Message tags allow you to send important and relevant 1:1 updates to contacts outside the standard messaging window of 24 hours after a contact's last message. You will need to add a topic to your Messenger flows to ensure your flow sends if outside of the 24 hour window.

Reconnecting Your Page

If there is a problem with your integration, you do not need to remove the channel. You can simply click the 'Reconnect' button found within the channel page in your Workspace Settings to refresh the authentication token.



Want to learn even more about using TextIt? Check out our Help Center

Questions? Comments? Let us know!

Announcment: WhatsApp Number Hosting Beta

We are excited to announce that TextIt is now a WhatsApp Business Service Provider and we are starting a closed Beta for our customers. This means you'll be able to use all the tools you know and love with TextIt but on WhatsApp! If you have an active subscription and are interested in entering this Beta, send us a note.


Want to learn even more about using TextIt? Check out our Help Center

Questions? Comments? Let us know!