Receive Text Message (SMS) in a .net API - asp.net-web-api

How do we receive text messages in a .net API?
Ex. Someone send a text message to my number, I need to the text message in my asp.net web API.
How can we implement this?

Twilio evangelist here.
This blog post has the code you need and a link to a video that show you how to receive a text message via Twilio.
https://www.twilio.com/blog/2016/09/an-easy-way-to-receive-an-sms-message-with-c-and-twilio.html
Hope that helps.

Related

Quick Replies on Bot Framework using Custom Facebook Adapter for Fb Workplace

Cant find the way how to send quick replies or suggested actions in facebook workplace.
I was sending them using the channel data property back when i was using azure bot.
To integrate a bot with facebook workplace i have to use a custom adapter, according to
this documentation.
And here are some samples to send buttons or images, but nothing about quick replies or suggested actions. Samples
I was able to send buttons as attachments but get an error when sending the Quick Reply because the Quick Reply doesnt has and attachment property in the body. Quick Reply Fb Docs
Please ask me if you need more info.
Thank you in advance.

Markdown is not working in the Bot Framework Twilio channel

I am trying to create a simple bot that sends images and hyperlinks by SMS using Twilio (trial account).
I do get the reply from the bot , but none of the markdown is working, even simple markdown elements like text or bing
Sample code I am using to send the message through Twilio SMS channel:
public async Task<Message> Post([FromBody]Message message)
{
if(message.Text == "Hello")
{
string messageText = "![Sample Image](http://aka.ms/Fo983c)";
return message.CreateReplyMessage(messageText);
}
Am I missing something? The emulator displays the image and other markdown properly, but when I test using my android phone and text the Twilio number to connect to the bot, it delivers raw HTML and not the rich content.
Twilio developer evangelist here. As pointed our earlier SMS is text only, so markdown or any other formatting will not work.
I just tried sending a message from a bot, and while I get the image correctly on the emulator or webchat, on SMS I only get the URL of the image (i.e. http://aka.ms/Fo983c).
According to the documentation, this is the expected behavior as it states:
Not all channels can represent all markdown fields. As appropriate
channels will fallback to a reasonable approximation, for example,
bold will be represented in text messaging as bold
So I guess for images, it will always fallback to the URL of the image.
As for sending MMS, it appears right now the botframework doesn't support it. To be clear, Twilio itself does support MMS for US and Canada, but it seems Microsoft's implementation didn't take advantage of that right now.
Hope this helps you.
I did this when I was first trying out the framework. Sorry but I don't have that code anymore however I don't recall having to do anything special. I simply sent a picture from my phone to my twilio number and then in the message properties for the message received by the bot there was an attachment field with a URL pointing to the image sent from my phone. Then I used a regular web request to pull down the image.
The details for the attachment objects and content url fields are outlined here.
Because there's no way to emulate the SMS channel you'll have to publish the code live to be able to test it out.
Have fun!

Can you send rich text messages via Twilio?

I am trying to send a rich text message via Twilio. I am able to send regular SMS messages, but I want to include a hyperlink in the body of the text.
I tried the twilio mediaUrl to include an rtf file, but that didn't work. Including html in the body of a message doesn't work as it just sends in plain text.
I'm posting via curl to the twilio endpoints, so i'd prefer not to have to get into PHP or some other language to achieve this. I just want to send raw data to twilio and receive a rich text message back, if it's possible.
Twilio developer evangelist here.
Using Twilio you can send MMS messages to numbers in the US and Canada. When you pass a mediaUrl the file needs to be hosted somewhere publicly on the web and it will then be included within the message.
You can pass files of any of the mime types listed here, though when sending RTF the result will depend on how well the receiving device supports RTF files.
If you want to include a link, I'd recommend shortening the URL (using bit.ly or similar) and just sending it as part of the text. Most smart phones will auto link the URL. Built in SMS apps on phones don't support markup of any sort, which is why your attempt with HTML just showed the raw markup.
Let me know if this helps at all.

Forward SMS messages to Google Voice

I have set up forwarding for voice successfully using the twimlet in the Twilio request URL...
http://twimlets.com/forward?PhoneNumber=000-000-0000
I would like to do the same for SMS messages but get errors if i place this timlet into the SMS request URL
Thank you
Twilio evangelist here.
The forward Twimlet is currently designed to work with voice phone calls only. If you want to forward text messages this is something that you would have to create yourself.
Check out this FAQ article for an example that shows how to forward SMS messages:
https://www.twilio.com/help/faq/sms/how-do-i-forward-my-sms-messages-to-another-phone-number
Hope that helps.

SMS Body not showing up in Google Sheets

I am new to Twilio and am not a programmer so sorry if this is a dumb question. I created a form in a Google sheet and copied to my Twilio account. I can send a text message to the number and it adds a new timestamp line to the Google sheet but there is no other information like From or Body. I used the tutorial instructions to create it. How do I get the body of the text message to show up on the Google Sheet?
Twilio evangelist here.
One of the other evangelists on our team wrote some step-by-step- instructions that show you how to receive SMS messages into a Google Spreadsheet:
https://github.com/jpf/TwilioSheet#receive-twilio-sms-messages-in-a-google-spreadsheet
Hope that helps.
Devin

Resources