Twilio give an sms or mms message a called id - twilio

Is there a way to make an sms appear with a caller id from a twilio number?
I've found this in the documentation, I've tried it and it does nothing.
"friendlyName"
export function twilioSend() {
client.messages.create({
body: 'hello from node',
to: '+13105551212',
from: '+15625551212',
friendlyName: "my caller ID",
})
.then((message) => console.log(message.sid))
With the above I get the sms and the from number is the from number. In this example 1525551212. I would like it to say from "my caller ID".
Is that even possible?

Here is a list of supported countries for Alphanumeric SenderID.
International support for Alphanumeric Sender ID

Related

Why can't I programmatically send a templated WhatsApp message using Twilio?

My code:
const client = require('twilio')(accountSid, authToken);
const issueResolution = 'Hi Malcolm, were we able to solve the issue that you were facing?';
client.messages
.create({
from: senderNumber,
body: issueResolution,
to: receiverNumber,
})
.then(message => {
console.log(JSON.stringify(message , null, 2));
});
The body of the message conforms to the "sample_issue_resolution" WhatsApp template shown in the Twilio web console (at https://console.twilio.com/us1/develop/sms/senders/whatsapp-templates).
I can successfully use the above code to send a message to a number which has opted in to my Twilio WhatsApp sandbox. If I try to send a message to another number which has not opted in to the sandbox, there's no error message, but the message is never received. I get the same results when I use one of my custom approved templates. What could be going wrong / how can I debug this?
I'd assume that this message is not matching any of your templates. There could be multiple reasons, such as a different whitespace character or a typo that differentiates both strings.
The Message Log should tell you why a message couldn't be delivered.

Choose between Phone number and AlphaNumeric Sender Id when send SMS in Messaging Service

I added a phone number and an Alphanumeric Sender Id to a Messaging Service.
And my app has a logic to choose between sending by a Phone number or AlphaSenderId.
Could you please provide me API in Messaging Service to have the ability to choose between the Phone number and AlphaSenderId when sending an SMS?
The messaging service will pick the sender automatically based on the country you send the message to. From the doc:
If you add an Alpha Sender to your Twilio Messaging Service, Twilio will select the Alphanumeric Sender ID automatically when you send a message to a supported country, unless you also have a short code number in that same country.
I.e. you cannot influence this manually when you send a message via such an API call:
client.messages
.create({
body: 'Revenge of the Sith was clearly the best of the prequel trilogy.',
from: 'MG9752274e9e519418a7406176694466fa',
to: '+441632960675'
})
.then(message => console.log(message.sid));
But you could do something like this:
const useMS = false;
client.messages
.create({
body: 'Revenge of the Sith was clearly the best of the prequel trilogy.',
from: useMS ? 'MG9752274e9e519418a7406176694466fa' : '+441632960670',
to: '+441632960675'
})
.then(message => console.log(message.sid));

While adding Alphanumeric Sender ID I always got error in php

I had purchased a USA number and I am trying to send a programable message to Hong Kong. While I send with a simple Twilio number it works fine and message recieved.
But when I try to add alphanumeric Sender ID it always show error message. The error message is: Message: [HTTP 400] Unable to create record: The 'From' number infoSMS is not a valid phone number, shortcode, or alphanumeric sender ID.
What I had tried is
public function send_sms(){
$msg_to = $_REQUEST['msg_to'];
$msg_body = $_REQUEST['msg_body'];
$twilio = new Client("ACba7f3a6866a23aed021056d3ceaexxxx", "4d7e47e92a8351b7365ed1e3e83dxxxx");
$message = $twilio->messages->create(
$msg_to, // to
[
"body" => $msg_body,
"from" => "infoSMS";
]
);
if($message->sid) {
$this->session->set_flashdata('ok_message', '- SMS successfully sent!');
redirect(AURL . 'Sms/sent_sms_list');
}else {
$this->session->set_flashdata('err_message', '- Error in sending sms please try again!');
redirect(SURL . 'Sms/create_sms');
}
}
I had read the documentation: https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id
What I am doing wrong? Thanks in advance.
Twilio developer evangelist here.
This was a bit hard to track down, but it turns out that there are a few generic alphanumeric sender IDs that may cause delivery failures. I tried to send an SMS using "infoSMS" as the sender ID and was unable to do so as well.
On some of our SMS guideline pages, there is this note about alphanumeric sender IDs:
Generic Alpha Sender IDs like InfoSMS, INFO, Verify, Notify etc should be avoided as they will result in SMS failures
I recommend you try using a different alphanumeric sender ID that more closely represents your business or service.

Need a key name for display sender name or number in twilio API for OTP

Currently i need to display sender name or number in text message which was sent using twilio API for OTP..
I am not able to find "key" to send in parameters.. i searched in Twilio official Docs.
I am using Twilio API for OTP: https://api.authy.com/protected/json/phones/verification/
in header i am sending my API key
and parameters like this:
`let parameters: [String: Any] = [
"api_key": _twiloAPIKey,
"via": "sms",
"country_code": countryCode,
"phone_number": phone,
"code_length": 6,
]`
how to send Alphanumeric value in parameters?
i.e. I want to send "APPNAME" so that display app name on SMS.
Twilio developer evangelist here.
You can't choose the sender name in the OTP API. We have worked to register an alphanumeric sender ID "AUTHMSG" that works in 79 countries and helps to improve deliverability rates and recognition.
Take a read of this blog post on the AUTHMSG sender ID to find out more.

The From phone number is not a valid, SMS-capable inbound phone number

I need to send SMS messages from a website.
I made an account to Twilio and I wanted to try if I really get a message from them.
I use this code that I founded on the net:
const string accountSid = "....";
const string authToken = "....";
TwilioClient.Init(accountSid, authToken);
var to = new PhoneNumber("+40740539623");
var message = MessageResource.Create(
to,
from: new PhoneNumber("+1402-704-3438"),
body: "This is the ship that made the Kessel Run in fourteen parsecs?");
AccountSid and AuthToken are correct. But I keep getting the error message that the From number is not a valid, SMS-capable inbound phone number or short code for your account.'
I tried to use the number that I have on my Twilio account, I only have a test account, so I thought that I can use this number to send test SMS.
Can you please advise what I'm missing here? How can I send test SMS from Twilio? From Trial Account I can't send messages?
Exception:
pass the phone numbers in as a string in the format "+18001234567", where +1 is the US country code, and whatever after is the 10 digit US phone number.
Also, I have no idea what the +4 area code is you're using in your to number, but you may have a number that doesn't support international SMS. I've only worked with US numbers, both to and from, so can't offer any guidance on how to work with international SMS.

Resources