When I attempt to send an image file using the Twilio.SendMessage Rest API call, I get the error : Code 21612 - The 'To' phone number is not currently reachable via SMS or MMS.
Here is the code I use:
var message = twilio.SendMessage(fromPhone, phone, "a message for you", new string[] {"http://website.com/images/folder/pic.jpg"});
This phone number works fine for text messages. I checked with my carrier, and my plan includes "picture Messaging" as well. So I am questioning the validity of the error message. Is there something else I need to check or do to get this to work?
This happened to me when I used Alphanumeric sender id (ex: TWILLIO) when sending messages. So USA doesn't support alphanumeric sender ids. You can see the list of countries support or need to be pre-registered to support alphanumeric sender id. The list
Error code explanation
Related
I am currently using the outlook mail api to retreive messages from a specific shared folder (List Messages Request), when i get a response from the query i want to read the body content in this case my header prefers html.
What i'm trying to achieve is string replacement from the html response.
The problem is inside my shared emails i have something like this:
Hello [UserName], further text in mail message, Regards [CompanyName].
and the response i get from the api looks like this:
<p class=\"MsoNormal\">Hello [<span class=\"SpellE\">UserName</span>],</p><p class=\"MsoNormal\"> </p><p class=\"MsoNormal\">further text in mail message, Regards [CompanyName].</p>
the response shows a spelling error has been returned with one of my string placement texts and not the other, this is not ideal because i dont want to rely on me writing some code to check if:
[<span class=\"SpellE\">UserName</span>]
exists or not, mainly because this could be subject to change at any given time and that would be a breaking change to the system.
Is there any way i can disable spell checking being returned in the html?
Try disabling spell checking in Microsoft Outlook,
File -> Options -> Mail -> Spell
either through the application or programatically by altering the configuration in the windows registry.
Look at
HKCU\Software\Microsoft\Office\11.0\Outlook\Options\Spelling
HKCU\Software\Microsoft\Shared Tools\Proofing Tools\1.0\Office\OutlookSpellingOptions
HKCU\Software\Microsoft\Spelling
I'm successfully using the Twilio API in an ASP.net C# app using the sample code (obviously changing the variables as required):
static void Main(string[] args)
{
// Find your Account Sid and Auth Token at twilio.com/console
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string authToken = "your_auth_token";
TwilioClient.Init(accountSid, authToken);
var to = new PhoneNumber("+15017122661");
var message = MessageResource.Create(
to,
from: new PhoneNumber("+15558675310"),
body: "This is the ship that made the Kessel Run in fourteen parsecs?");
Console.WriteLine(message.Sid);
}
I'm sure I read somewhere that you can change what the message receiver sees on their phone - so you could have 'my company' instead of the phone number the message is sent from.
However, I can't find this anywhere in Google or on the Twilio API C# samples.
How can I do this?
Thanks.
This article is more clear on the requirements. It is a paid account feature only:
Alphanumeric Sender ID is automatically supported on all new upgraded (paid) Twilio accounts. It is not supported for Free Trial accounts.
and
This feature is only available for upgraded (paid) Twilio accounts sending messages to supported countries. Some supported countries may have additional requirements, including pre-registration for alpha sender IDs, or limiting these messages to be only sent as transactional messages.
There are also instructions there for checking if it supported on your account. I believe short code is a different concept, using a 5 or 6 digit number for the sender id, which is also associated with larger message rate limits and of course paid account only as well.
I'm developing a graphic user interface where the user can send a message to mutuple user using Twilio API in c#
I'm trying to bind a list view to the status of each number being sent and I also want to know the status of the message every time the user click on refresh list view
public void sendSMS(string ssid, string token , string fromNumber, List<string>TOnumbersList ,string msgBody )
{
TwilioClient.Init(ssid, token);
foreach (var toNumber in TOnumbersList)
{
var message = MessageResource.Create(
to: new PhoneNumber(toNumber),
from: new PhoneNumber(fromNumber),
body: msgBody,
provideFeedback: true,
statusCallback: new Uri("http://requestb.in/1jnk4451"));
ListViewItem items = new ListViewItem(message.To);//This show the number being sent to ( delivered number)
items.SubItems.Add(message.Status.ToString()); //Refresh the status WHERE number = message.To
items.SubItems.Add(message.ErrorCode.ToString());//Show error code in case
items.SubItems.Add(message.ErrorMessage); // In case error message show them
listView1.Items.AddRange(new ListViewItem[] { items });
}
}
Twilio API is doing the perfect job updating the status so everytime I go click the link I can see the status. as explained in this documentation Track Delivery Status of Messages in C#
But is It possible to bind a list view so it can be updated everytime the user click on refresh list view ?
Or what is the best way to dynamically show the message status from the URI http://requestb.in/1jnk4451? Maybe embedding a webpage would be better ?
Thank you
Twilio developer evangelist here.
Rather than using the RequestBin URL, if you provide a URL to your own application then you can write an endpoint that receives the status updates of the messages. That way you can store the status yourself and update the list view without having to loop through all the messages.
[Edit] In more detail:
When you send an SMS message with Twilio using the REST API you can set a statusCallback URL to receive updates about the message as it processes through from Twilio to the network and the device.
Twilio will make HTTP requests to this URL as the message goes through each state, the possible states being queued, failed, sent, delivered, or undelivered. Twilio sends a number of parameters as part of this request, some are general ones about the message and some are about the actual status.
To receive these requests you need to set up a web server. I'm not a C# developer I'm afraid, however we have a guide on how to set up a C# and ASP.NET MVC environment that can receive webhooks that should be able to help you there.
Let me know if this helps a bit more!
I'm using SDK V3 for .net IppDotNetSdkForQuickBooksApiV3 and trying to send the email with the invoice after I create it (which I found weird that the Quickbook doesn't do it automatically after I create the invoice, so maybe I'm doing something wrong).
So this is how it goes:
//Get customer
var customerQueryService = new QueryService<Customer>(context);
var customer = customerQueryService.ExecuteIdsQuery("query to get customer");
/*I fill the invoice with data
..
..
..*/
//Call to generate invoice
var invoiceAdded = dataService.Add(invoice);
//Email to send
invoiceAdded.BillEmail = customer.PrimaryEmailAddr;
invoiceAdded.EmailStatus = EmailStatusEnum.NeedToSend;
invoiceAdded.EInvoiceStatusSpecified = true;
//Send Email
dataService.SendEmail(invoiceAdded);
This is where I'm getting troubles, first I notices that the object from customer.PrimaryEmailAddrhas no id:
So when I'm gonna make the call to send the email after I created the invoice I get the following exception:
Object not found: EmailAddress
If I go to my Quickbook site I do have my customer of course and that is his email.
So what I'm doing wrong?
Try this:
//Call to generate invoice
var invoiceAdded = dataService.Add(invoice);
//Send Email
dataService.SendEmail<Invoice>(invoiceAddded, customer.PrimaryEmailAddr.Address);
The second argument that you pass to that method is a specific email that will override the default email in the invoice object, which should fix this bug. Basically there are two versions of the request that can be used to send invoices, there's the following:
POST /v3/company/<companyID>/invoice/<invoiceId>/send
And then this one:
POST /v3/company/<companyID>/invoice/<invoiceId>/send?sendTo=<emailAddr>
So when you pass just the invoice, it maps to the first request by taking your invoice object and figuring out what the id is, a lot of those fields however don't get filled by default by QBO for some reason, this would be why you are getting an error with passing just the invoice, because for some reason it relies on that email having an id which I guess QBO doesn't auto-fill for you, so what I would do is use the other overload for this method which maps to the second request, which explicitly sets the email address in the request, that way no matter what, as long as you passed a valid email address, and the invoice exists, the request can't fail, otherwise you're relying on a bunch of data getting filled properly which leaves you open to a lot of bugs, the QuickBooks API in general is very, very prone to bugs and doesn't really help you out when you get them, so in general the less bugs you expose yourself to, the better in my opinion.
I am using PushSharp library to send push notification from my application.
PushService push = new PushService();
var reg_id_d = "APA91bETd-LsqnZjA-HKrnBOY3FbEhmWchpiwuhRkiv4gUdGDuvwDRB7YURICZ131XppDAUNUBLGe_vEPkQ-JR8UaVX7Y-NCkEfastCBLIYcUoFtt5cPafeKXHywi0WGDYW33ZQqr3oy";
var project_id_d = "482885626272";
var api_key_d = "AIzaSyAbh7R5KQR3KM7W_y-yS-Ao-JNiihNz7tE"; // "AIzaSyDcKfuW77GTwA46L6sqD41YhGf2j5S8o2w";
var package_name_d = "com.get.deviceid";
push.StartGoogleCloudMessagingPushService(new GcmPushChannelSettings(project_id_d, api_key_d, package_name_d));
push.QueueNotification(NotificationFactory.AndroidGcm()
.ForDeviceRegistrationId(reg_id_d)
.WithCollapseKey("NONE")
.WithJson("{\"alert\":\"Alert Text!\",\"badge\":\"1\"}"));
I am getting notification on my device but with blank message..
I have tried with sever code available in C# to send GCM push notification, but getting same problem of having blank message.
I tried using PHP to send notification. and it is working as expected. so, I am not sure what is wrong in my above code. Can anyone please help me on this?
I tried using different code available around.. but none of those were working..
finally I tried https://stackoverflow.com/a/11651066/1005741 and it works like a charm!
I encountered the same issue, where I received an empty message. My code was a bit different and i was using different libraries: the client was wrapped with phonegap pushPlugin ,and the server code is as follows :
...
// com.google.android.gcm.server.Sender.Sender(String key)
gcmSender = new Sender(androidAPIkey);
// com.google.android.gcm.server.Message
Message message = new Message.Builder().addData("alert", "test message" /*notif.getAlert()*/).build();
Result result = gcmSender.sendNoRetry(message, /* device token */ notif.getToken());
nr.add(result, notif.getToken());
...
The reason why my messages where empty is due to the fact that phonegap looks for "message" , "msgcnt" or "soundname" while parsing the extras from the intent. So, this was the solution in my case :
Message message = new Message.Builder().addData("message", notif.getAlert()).build();
Hope this will help someone
Change alert to message, Please see code below for your reference:
////---------------------------
//// ANDROID GCM NOTIFICATIONS
////---------------------------
////Configure and start Android GCM
////IMPORTANT: The API KEY comes from your Google APIs Console App, under the API Access section,
//// by choosing 'Create new Server key...'
//// You must ensure the 'Google Cloud Messaging for Android' service is enabled in your APIs Console
push.RegisterGcmService(new GcmPushChannelSettings("senderid", "apikey", "com.xx.m"));
//Fluent construction of an Android GCM Notification
//IMPORTANT: For Android you MUST use your own RegistrationId here that gets generated within your Android app itself!
push.QueueNotification(new GcmNotification().ForDeviceRegistrationId("regid")
.WithCollapseKey("score_update")
.WithJson("{\"message\":\"syy!\",\"badge\":7,\"sound\":\"sound.caf\"}")
.WithTimeToLive(108)
);