Change "from" field of SMS text message for recipient - sms

I want the recipient of my SMS text message to see the name of my business, rather than the phone number. How is this possible? I am currently using Twilio, but I am open to suggestions involving other services.

For those of you who have looked at #philnash s answer and still having problems, please read this. I'm using the twilio-ruby gem, and am in the UK.
I see a lot of places state that:
all you need to do is replace the from parameter.
This is not true!
Step 1
Contact Twilio and have them enabled it on your account.
Step 2
The second step is to make sure that to number you are using has the correct country code, 0779XXXXXXX and 779XXXXXXX are enough to send a text message when specifying a from number that has been previously purchased. The purchased number has a country of origin and therefore Twilio know to prefix it with the correct country code. However, an alphanumeric sender has no from number, and therefore no country of origin.
Using 0779XXXXXXX as the To param. Returns the error:
The 'To' number 0779XXXXXXX is not a valid phone number.
While technically correct, it isn't incorrect, it's just missing the country code.
Using 779XXXXXXX as the To param. Returns this error: The 'To' phone number: +1779XXXXXXX, is not currently reachable using the 'From' phone number: Foo via SMS. +1 is the USA phone prefix. The USA doesn't have an option to send as alphanumeric. This is how I stumbled onto the fix.
TLDR;
1. Contact Twilio to get them to enable it on your account
2. Make sure you prefix with the country code.

I have found three services (not Twilio) that appear to address the question:
Nexmo
Plivo
smsmessagesender
The above services support dynamic alphanumeric sender ID for outbound SMS, so you should be able to send a combination of 11 alpha-numeric characters as the sender ID of your message. Note the emphasis on outbound SMS. It appears that receiving incoming SMS on an alphanumeric sender ID is not possible.
If anyone has more experience with these services, please share.
Edit: Note that the availability of these services also depends on the laws of the jurisdiction where the services are to be used.

Twilio developer evangelist here.
I know this is a good few months since you asked this, but I wanted to update the possible answers for completeness. When you asked this in November 2014 it was not possible to send SMS messages from Twilio using an alphanumeric sender ID.
However, since May 2015 it has been possible to do so. All you need to do is replace the phone number as the From parameter of the API call to send a message with the text you want the sender ID to be. This currently works when sending SMS messages to 145 countries.
If I was doing this in Ruby, it would look like:
account_sid = YOUR_TWILIO_ACCOUNT_SID
auth_token = YOUR_TWILIO_AUTH_TOKEN
recipient_phone_number = RECIPIENT_PHONE_NUMBER
client = Twilio::REST::Client.new(account_sid, auth_token)
client.messages.create(
from: "ALPHANUMERICID",
to: recipient_phone_number,
body: "Hello World!"
)
Edit
Please note, that to use alphanumeric sender IDs on your Twilio account you need to have your account enabled. To do so, please contact twilio support with your account SID to request access.

As FullStack said, you can consider using another SMS API for this.
Nexmo, where I work, offers a high quality messaging service including the support of dynamic sender id. You can use any alphanumeric string to describe your application or brand where supported by carriers (where there are no restrictions on alphanumeric sender ids).
Some countries, such as the United States, don't allow alphanumeric sender ids. Other countries allow it, but have special restrictions that we take into account & work around to ensure maximum delivery.
You can find the full list of alpha-numeric sender ID compatible countries, along with carrier restrictions, here.
<?php
$url = 'https://rest.nexmo.com/sms/json?' . http_build_query([
'api_key' => API_KEY,
'api_secret' => API_SECRET,
'to' => YOUR_NUMBER,
'from' => "AppName",
'text' => 'Hello'
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

Related

Microsoft graph API - empty bccRecipients list

This is the Scenario:
In the same Azure tenant, I used one account (user_1_address) to send emails to the other account (user_2_address) using outlook (o365).
I sent 3 emails, one where user_2_address is BCCed, one CCed, and one when it's the TO recipient.
I'm using Microsoft graph API to get a list of emails received by user_2_address in a specific time range, using this query:
https://graph.microsoft.com/v1.0/users/{<user_2_id>}/messages?$filter=
receivedDateTime ge <some date> and receivedDateTime lt <some other date>
and isDraft eq false
and sender/emailAddress/address ne '<user_2_address>'
I'm getting all the three emails user_2_address had received from user_1_address. But in the email user_2 was BCCed the bccRecipients list is empty, when it should contain user_2_address :(
I have seen this question about sending an email from Gmail and BCC an outlook user:
Microsoft graph API: empty BCC field
In that case, also the bccRecipients list was empty, but it was resolved by saying the BCC is removed when sending the emails from an external source (Gmail in that case). When for me it's not an external source - both users are using outlook in the same tenant.
So my questions are:
Is it the desired behaviour, or is it a bug?
Now, let's say I'm using the query above where I get all emails where the sender is not the user_2_address and it's not a draft. Can I assume that every email I get where user_2_address is not in the ccRecipients and toRecipients lists - that email was BCCed to user_2_address?
Thanks!
The bcc field in a Message is an envelope (P1) recipient only so you should always expect that it will be blank (no matter the context inside a tenant really make no difference). Like the other post referenced if it wasn't blank it would break the RFC and the purpose of a BCC, the only exception is the sent item (which is just a copy of the sent message)
No there are many scenarios that would break that particular logic eg forwarded email is one the comes to mind. You could certainly refine you result set that way, one thing you might want to examine is the X-MS-Exchange-Organization-Recipient-P2-Type: mail header that should get set in your internal to internal scenario (you need to look at the PidTagTransportMessageHeaders extended property to see it)

Transmission api setting wrong To header when specify header_to with multiple recipients

I'm trying to send an email to multiple people(multiple to addresses) and have them all listed in the email clients like a regular email. When I set the header_to field on all recipients to email1#foo.com, email2#foo.com I end up with emails that have a to header set to "First Name" <email1#foo.com, email2#foo.com> which is incorrect.
This shows up as a single person with multiple email addresses in most clients and the header is wrong.
Why is the sparkpost transmission api messing with the header_to field? It's docs say that it uses this in place of generating a To header for you.
After going through every page of docs I could find to try and figure out how sparkpost's backend works I've found that you must omit the Name field on all recipients.
https://developers.sparkpost.com/api/recipient-lists/#header-recipient-object

How to reference "from" field in TWIML to make a simple call b/w two phones

Trying to follow this tutorial:
https://www.twilio.com/docs/quickstart/ruby/rest/call-request
This code only dials the to number for me:
#call = #client.calls.create(
:from => '+14159341234', # From your Twilio number
:to => '+18004567890', # To any number
# Fetch instructions from this URL when the call connects
:url => 'http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient'
)
For me, this code never dials the from phone. Just the "to:" number gets called, when answered, it plays music. The "from" number doesn't never rings. I'm guessing I have to write TWIML to dial the first number (to), but I don't see any reference to the variable "to" in TWIML, is there a sample twiml that will simply connect two phones?
You're dealing with three numbers in this picture. One is your Twilio number from where the call is made '+14159341234', then, you have the two numbers you'd like to call and connect.
Let's be clear, you won't hear your Twilio number ring, it's at Twilio and it's kind of virtual.
The code you have so far, when you run it, uses your Twilio number :from => '+14159341234' to make a call :to => '+18004567890'.
So, what happens when people at :to => '+18004567890' answer? Twilio's system (the platform) makes a request to :url => 'http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient' from where is served some XML, some TWIML. You can actually see what is served if you go with your browser to http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient
To do what you want to do, to dial another number instead of playing music, you need to change that url to some place from where you serve this kind of TWIML:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Hello. Please wait.</Say>
<Dial>+12223334444</Dial>
</Response>
If you don't have your public server from where you can serve XML, you can use a native TwiML bin, that you create in your Twilio account console here: https://www.twilio.com/console/runtime/twiml-bins .
Once you create your TwiML bin, under properties for the bin, you'll have a URL to put in place of http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient, something like https://handler.twilio.com/twiml/EH7e58b64f8488ff8c022bf83c910fb49b.
P.S. You might want to also google twilio click to call and/or twilio conference as other way to connect two phones.

Generic, role based emails (e.g. root# admin#, etc). Determining?

I want to filter out generic, marketing based emails ("role based emails", e.g. orders#example.com, newsletter#example.com).
The Rapportive Chrome extension seems to label role based emails pretty accurately. Not only does it get the ultra generic emails, but it classifies correctly non-common role based emails like slashdot#slashdot.org, nytdirect#nytimes.com, etc.
I'm looking for either A) a comprehensive list of role based email addresses or 2) an algorithm to determine whether an email is a role based email (is there a header I should be looking at?).
Found my answer: most reputable mail list servers are including the List-Unsubscribe header in the email message.

How to get notified when SMS Status changes from 'Queued' to 'Sent'?

Hello,
I am trying to learn Twilio API.
When I [send SMS through php][1] script.. twilio returns a response object with status = 'queued'. Now I want to get notified when the status changes to 'sent'. Is this possible with Twilio??? and if yes then could any body advise me on how to implement his.
And how to add 'StatusCallback' url
$sms = $client->account->sms_messages->create(
// the number we are sending from, must be a valid Twilio number
"000-000-0000",
// the number we are sending to - Any phone number
"0000000000",
// the sms body
"Hey Friend, Monkey Party at 6PM. Bring Bananas!"
);
You're on the right track looking to the StatusCallback. When using the Twilio PHP Library any optional parameters can be set using an array as the last argument.
<?php
$sms = $client->account->sms_messages->create(
"1235551234",
"1235554321",
"Hey Friend, Monkey Party at 6PM. Bring Bananas!",
array('StatusCallback' => 'http://example.com/sms/status.php')
);
When the message is sent (or if it fails) the data will be passed to the StatusCallback url.

Resources