Reputation: 575
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:
Upvotes: 0
Views: 7201
Reputation: 4378
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.
Upvotes: 5