SMS parameters through twilio - twilio

I'm new to twilio and have the following situation. I want to send an SMS to someone for an appointment confirmation. They'll text back CONFIRM or CANCEL etc to the message.
Is there any way to pass an internal database id in the SMS to them and get it back in their response so i know what they're confirming or canceling? I'd rather it not be shown to the end user receiving the text.
Thanks!

Twilio evangelist here.
Unfortunately there isn't any way to transparently include metadata in an SMS and have that metadata returned to you when they reply, but there ways to address your scenario.
If you are sending the user a text message you already have their phone number and you can use that as a unique ID. When the user replies to your message, Twilio will as part of our HTTP request to your application, pass you the users phone number. You can use that number to locate them in your database and mark them as confirming or canceling.
Hope that helps.

Related

Twilio Advanced Opt-in not sending

I'm building a text service with Twilio and configured and enabled the Advanced Opt-out / Opt-in settings in my messaging service.
When testing the opt-in with my custom keyword I get this back instead my custom message
Thanks for the message. Configure your number's SMS URL to change this message. Reply HELP for help . Reply STOP to unsubscribe. Msg&Data rates may apply.
The screenshot shows my custom keyword and message. I'm using a toll-free number.
Any ideas as to why its not automatically sending the custom opt-in message?
When you receive opt-in messages to your number the webhook request is still sent to the URL you configure for your number. It looks like you haven't configured that URL for your number yet, as that is the default response for a new number.
Head to the Twilio console to configure your number and update the URL for when a message comes in. You can set it to your own application's URL if you have built that out yet, or if you are still working on that you could use a TwiMLBin with an empty <Response> which doesn't respond if you don't have an application yet.

MSGraph - Getting external email conversation from reply

My team is building a ticketing system. The goal is when we receive a new email we create a new ticket. All responses to that email are saved on the same ticket.
We have these basic goals working in simple cases, however, there is one case that we are struggling to find a good solution for. A client will email us, which creates a ticket, and we reply back requiring information. The client will send our reply to someone internal to their company. Then they will send the response back to us by replying with "see below". This response will have the conversation between them and their co-worker in the comment section of the email. The comment section will also contain our entire email chain which we don't want to duplicate.
The issue we are having is grabbing the conversation they had from the comment section to include with their response of "see below" and add them to the ticket. The only method we have come up with to solve this is manually parsing the comment section of the email, however, this is error-prone.
Does anyone know of a better way of tracking conversations they send you through the email?
We are using msgraph internally to send and receive emails and using their apis they have uniqueBody and body, but they don't seem to have a way to break the body up into its different parts.
What I need any of these options
1- get list of unique bodies from the email chain without using conversation Id as it will not be sufficient in some cases.
2- get the previous conversation Id of the incoming email. I mean if that email is a list of emails and it forwards to me.
UUID uuid = UUID.randomUUID();
message.addProperty("InternetMessageId", String.format("%s",uuid.toString()));
send InternetMessageId with a unique identifier to grab conversation id
change order only

How to Forward SMS Message to URL

I used this as my helpguide: Twilio: Forward received SMS to URL
But the problem is I cannot extract anything from the set of parameters.
I'm using Classic ASP and I'm try to capture anything that exists in the Request.QueryString by placing it into a database.
All I want to do is to insert the from phone number and body/text message into my database every time a message is received. All I get is an empty record in the database.
By default when Twilio receives an SMS to your Twilio phone number it makes a POST request to your ASP page, sending a set of form-encoded values. This means you should use:
Request.Form("Body")
If you want Twilio to make a GET request instead, allowing you to use Request.Querystring, you can configure that on the phone number configuration page in your Twilio Console.
According to the docs, the default value for Twilio's StatusCallbackMethod is POST, so unless you've specified otherwise, you will be receiving your desired parameters in the POST body, not in the query string.
If you just want to forward an SMS to a URL or Rest API there are few android apps that do just that, most of them are paid ones.
This is one example:
https://www.forward-sms-to-rest-api.com

handle sending sms between users over Twilio

I've read THIS Twilio post on how to enable text messaging between users. I am building using Ruby on Rails.
At the moment, this is what I have:
A messaging system in my app where users can inbox each other.
When a user X messages another user Y, the application also sends that message to user Y's email address. User Y can reply to the message on the app or by responding to the email received by user X. If user Y choses to respond to the email (inbound email) my application processes the email received - it knows that it is intended for user X so it will forward that the email to user X's email address.
This is great because I'm giving the user several means of communication between each other (in app or email).
Now i'd like a similar but instead using the Twilio API.
Particularly i'd like to enable this type of communication:
As per Twilio help center
I'm having trouble understanding the concept of having multiple numbers that can be used by different user but somehow you know who's the message for...( Wow, I'm even having trouble describing what i'm having trouble with!)
I'm using the Ruby wrapper for the Twilio API
To send a message to user it is fairly simple:
# set up a client to talk to the Twilio REST API
#client = Twilio::REST::Client.new account_sid, auth_token
# send sms
#client.messages.create(
from: 'twilio_number',
to: 'a user number',
body: 'Hey there!'
)
To receive a message:
First configure the your Twilio phone number request url to point to an endpoint in your application. In my case its 'yourappurl.com/twilio/create'.
class TwilioController < ApplicationController
include Webhookable
after_filter :set_header
skip_before_action :verify_authenticity_token
def create
# inbound messages arrive here. Need to do something with the message, identify who's it for
# the receiving user and where its coming from ( the user who sent the text message)
render_twiml response
end
end
However this is for my application sending a message to a user's phone number. How can I handle communication between two users where user X can communicate with user Y via text messages (all going through my application)
Twilio developer evangelist here.
The help centre article on sending messages between users has a great explanation of how to implement this in theory, however you probably want to see some code.
Your best bet is to work through this tutorial on Masked numbers with Twilio which shows you practically how you would purchase a number for a user and then connect two users through that number.
In brief, you need to get a number that represents a relationship between two users. When you receive a message at that number and you get the webhook from Twilio then you can look up the relationship based on the Twilio number the message was sent to and the number it was sent from. You can then connect and send the message on to the number on the other side of the relationship.
But, as I said, I recommend going through the tutorial to really learn this in depth.
Let me know if this helps at all.

Is there a way to see the response to Twilio's request to the SMS URL?

When I set my SMS Url for a given phone number and then send a text to that phone number, the request somehow fails. Is there a way for me to inspect the error response (404/500/403 etc) to see any exception details from my twilio dashboard?
Hi Twilio Customer Support here,
Have you viewed the app monitor?
https://www.twilio.com/user/account/developer-tools/app-monitor
It contains all of the errors that your account has recorded, you can drill down on each error to see the request body etc.

Resources