Twilio messaging service and studio flow - http-post

I am working on a project in Twilio and Podio, where I am using this code from Podio using POST
POST IN PODIO
FROM URL: https://[(Ref Setting) Setting Value 1]:[(Ref Setting) Setting Value 2]#api.twilio.com/2010-04-01/Accounts/[(Ref Setting) Setting Value 1]/Messages.json
POST PARMS: To=[(Ref Lead) Mobile Phone]&MessagingServiceSid=[(Ref Setting) Setting Value 3]&Body=[(Variable) strMessages]
---This works fine, and I can send my message no problem, I am using a MessagingServiceSid because my volume has increased I have about 4 numbers in the messaging service.
The problem I am encountering is I had a Twilio Studio Flow set up to handle the incoming text messages when I was just sending from the sid, and I am wanting to figure how if I can make sure that when someone responds to my messages they get sent to the studio flow set up to handle the responses. I am also wanting to get the responses back into Podio.
I have tried changing the Numbers settings in messages settings to that particular studio flow, but when I do that, it takes the number out of the Messaging service that I am using to send the messages.

You need to assign numbers and studio flow to a messaging service.
To assign a number to messaging service:
While configuring a phone number you need to go to its "messaging" section and configure with the messaging service.
To connect messaging service and studio:
1) Goto studio flow -> click on the trigger -> copy the webhook URL
2) Goto messaging service -> inbound setting -> paste the URL in request URL
To get the response back to your servers(I am not familiar with Podio), add an HTTP request block in your studio flow. In that add a request URL pointing towards your server and in the request body you can add the body of text which looks something like FROM:{{trigger.message.From}} BODY:{{trigger.message.Body}}

I tried to follow Abhijeets answer, but unfortunately due to the way messaging services and Twilio phone numbers differ, it's not possible to have the SMS replies work correctly.
I tried to do something similar to you. I was triggering the Flow execution by POSTing to the REST API url trigger, and I used the "Send & wait for reply" widget to send and receive a reply from a number. It worked perfectly when only sending from one phone number, but when I switched the "Send & wait for reply" widget to use a messaging service to send it instead, the responses always triggered the "Incoming Message" start of the Twilio Flow. So it made an entirely new execution, and my previous execution never was completed.
After reading a lot of documentation I could never get around this, so what I did was instead just purchase and assign additional phone numbers to the Twilio flow. In my application, I triggered the Flow execution using these phone numbers (randomly), and then the "Send & wait for reply" widget used this phone number to send out the text message. That ended up working for me, since I was only using messaging services to send out SMS messages with multiple different phone numbers.

Related

MS Teams Incoming Webhook issue

I've created an incoming Teams Webhook connector within a Teams group (using the method below).
I can successfully curl to the webhook internally and get the message to display ok.
MS have checked my tenant and access is as expected.
When I apply my URL for the webhook to any external service they eventually come back stating there was a problem detected with the webhook (Please make sure that your webhook endpoint of xxx is responding with a 2xx response code within 30 seconds of initial connection.)
Can anyone advise what else may need to be done?
Thanks
In Microsoft Teams, choose More options (⋯) next to the channel name and then choose Connectors.
Scroll through the list of Connectors to Incoming Webhook, and choose Add.
Enter a name for the webhook, upload an image to associate with data from the webhook, and choose Create.
Copy the webhook to the clipboard and save it. You'll need the webhook URL for sending information to Microsoft Teams.
Choose Done.
Incoming webhooks are special type of Connector in Teams that provide a simple way for an external app to share content in team channels and are often used as tracking and notification tools. Teams provides a unique URL to which you send a JSON payload with the message that you want to POST, typically in a card format. Cards are user-interface (UI) containers that contain content and actions related to a single topic and are a way to present message data in a consistent way. Please test the incoming webhook url using postman and let us know the payload result or status code. Would be help full for us to understand more.

Bot Framework SDK4 C# - send proactive message to a user in Teams / REST response timeout

Based on a GitHub sample, I created a dialog bot in Teams that collects information from a user and sends that to a Flow (Microsoft Flow/Power Automate) with a HTTP POST call.
After that the Bot waits for a response and sends it back to the user. This generally would be sufficient if the timeout for the call wasn't limited to 2 minutes - sometimes it takes longer to get the complete actions in Flow and get the response.
My question is how I could accomplish the same without getting the timeout. REST seemed the easiest as I'm not a programmer..
I checked the GitHub sample for proactive messaging (https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/16.proactive-messages), and that worked in the Emulator when I enter http://localhost:3978/api/notify, but I have no idea how to use it published to Azure. What would be the endpoint and how I could pass the message text?
Thanks
You should do some code modify if you want to send an message based on proactive-messages demo .
You can refer to my previous post which will meet your requirement.
After you modify the NotifyController.cs file , you can use send messages to a specific user with steps below :
Connect to your bot get current user ID :
Send message to this user by rest client tool or post man :
Result :
If you publish your bot to Azure , lets assume your Azure App service host is :https://xxxxxx.azurewebsites.net , then your bot message endpoint will be :https://xxxxxx.azurewebsites.net/api/messages and your /notify function endpoint will be : https://xxxxxx.azurewebsites.net/api/notify . In brief , just use your Azure App service endpoint to replace http://localhost:3978 will be fine .
Hope it helps . If there is anything unclear pls feel free to let me know .

Can the SMS forwarding number be removed from the reply using Twilio's to forward SMS messages to another phone number?

I want to use Twilio to create an SMS relaying service where the Twilio number is the only number that is exposed, much like web proxy servers that allow you to access the Internet anonymously. I've used the example php code that twilio provides, saved it to a php file and hosted it on a public web server, then updated the messages URL on the Twilio site accordingly. Any message sent to the Twilio number the is forwarded to my mobile. Everything works fine, except for the fact that when I reply to the forwarded message from my phone, the reply includes a header that says "Sent from your Twilio trial account - + mymobilenumber" I understand that the header is inserted because I have a trial account, however I don't want the mymobilenumber field to be exposed. Is it possible to hide this?
I should mention I'm not really a programmer but I'm learning with Twilio.
I followed the example given here:
https://www.twilio.com/help/faq/sms/how-do-i-forward-my-sms-messages-to-another-phone-number
Thx
Antonio
A short code is a 5 or 6-digit number that can send and receive messages with mobile phones. These high-throughput numbers are perfect for apps that need to send messages to lots of users or need to send time sensitive messages. You can buy shortcodes from Twilio or port existing short codes to our platform.

How track responses for an SMS to multiple recipients with the Twilio API?

I would like to send a text message survey (eg. "How happy were you with X service? Reply 1 for satisified, Reply 2 for not satisfied") to multiple recipients. From the responses, I would like to create a report on the recipients that responded 1 vs the ones that responded 2. What is the best way to do this with the Twilio API? Does my app need to store the results from my incoming SMS message or does Twilio store these so I can query the results? If the former is the case and TwiML is involved, how do I parse the response and store the result? Thanks!
** Disclaimer: Twilio evangelist here **
Chirag:
So it sounds like you have two requirements here:
Use Twilio to send outbound text messages to different recipients
Capture a users reply to that message
For the first requirement, you can start by going to Twilio.com and signing up for a new account. Its free to start and we give you a Twilio phone number you can use to start to build your app. Once you have the Twilio phone number, you can use the REST API to start sending outbound text messages from that Twilio phone number. We have a quickstart that shows you how to do this:
http://www.twilio.com/docs/quickstart/php/sms/sending-via-rest
Note that this link goes to the PHP sample, but you can use the drop down at the top of the page to pick from other stacks like .NET, Java, Python or Ruby.
Once you've sent an outbound message you need to capture the replies to that message (your second requirement). Twilio uses something called a webhook to notify you about incoming SMS messages.
A webhook is basically a URL exposed by your application and associated with your Twilio phone number. You can configure the URL associated with your phone number in the Twilio dashboard.
Each time we receive an incoming SMS message on your Twilio phone number, we will make an HTTP request to that URL. As part of that HTTP request we send along metadata about the inbound message like the phone number that the message was sent from and the Body of the message. The full list of parameters we send is here:
http://www.twilio.com/docs/api/twiml/sms/twilio_request
Now your app can pull those parameters out of the request and do whatever it wants with them. Since we already are sending the body of the message as we receive it, Tims suggestion of tracking the responses based on the From parameter and storing the message body in your own database is a good suggestion.
This quickstart shows receving an incoming text message, grabbing the From parameter and then responding by sending back from TwiML:
http://www.twilio.com/docs/quickstart/php/sms/replying-to-sms-messages
In your case, if you don't want to reply to the incoming message, just omit the TwiML response.
Hope the helps. Lets me know if you need more info.
Devin
Track the responses using the From parameter (and using Body to identify the selection). Yes, Twilio stores those messages, and you could query the API - but it's likely better to just store it in your own database.

How is dead device identification done in windows phone

How is dead device identification done in windows phone when we make use of micosoft push notification service? Does mspn store information about such devices? Is it possible for an application to retrieve the list?
Uri Channels can expire. This is why you should regularly check and refresh them from the client.
If the channel is no longer valid (as will happen when the app isn't used for a long time and the URI expires) you'll get an error in the repsonse when you try and send the message.
You shoudl use this method to detect URIs that are no longer valid.
There is no way to get a list of URIs that are no longer valid or to test validity without sending a message.
There is no way to ask the server for any expired notification channels however if you look t the response codes coming back from the MS services when you're attempting to send a notification (from your server) you'll be able to determine if the channel has expired. If you look at Push Notification Service Response Codes for Windows Phone you'll note that basically if you get a 404 Not Found back from the service then the channel has been expired and you should stop sending to it. It's worthwhile handling the other cases as well. Eg. Handling 200 OK / QueueFull messages correctly allows you to lighten the workload on your server by pausing notifications for that subscription for a period of time.

Resources