Twilio : Response application link not working - php

I am unsing Twilio Rest Api for SMS functionality. My SMS is send sucessfully problem is when user response to SMS, I have to capture that response in my application and send confirmation email to user
I am unable to capture response from application URL.Please give me some idea.
Thanks in advance

The example app here in PHP shows how to build keyword response based upon the body of the incoming text message.
The important thing to note is to fetch the Body request parameter of the message which is simply:
/* Read the contents of the `'Body'` field of the Request. */
$body = $_REQUEST['Body'];
Instead of 'fromBody'.

Related

Get Message ID in response of send mail - SendGrid API v3

I am getting this response when I submit an email, as I am working on the API of SendGrid I need to grab the stats of each mail i sent.. for that purpose I want the Message-ID in response so I could save that in db.. I have looked over the docs but unable to make any progress.. Thanks in Advance
But i want to get email activity by passing message ID
Note: Currently mail response give "X-Message-ID" but i want Message ID
https://sendgrid.api-docs.io/v3.0/email-activity/filter-messages-by-message-id
Thanks...
The X- prefix in a header means that it is a custom header and not part of the standard. This has become less favoured over time, but it is still found in use across the internet. X-Message-Id is what you're looking for.

How to send a message to a third-party Telegram bot and retrieve the response using PHP?

I've searched both SO and Google and couldn't find what I need. I'm trying to see if it is possible to send a message to a Telegram bot (which I'm not it's owner/writer) and receive the response. The bot that I'm trying to communicate with through my PHP script will get a text message and in return sends back a proper file regarding the initial request. I want my web server be able to send that request and save the returning file in a specific folder on my server.
Is this possible at all?
What I've been seeing all over is sending messages to users as a Telegram bot. In here I want to do it the other way, sending a message to a bot as a user.
Many thanks

Receiving SMS and storing it in database using Twilio

i am using Twilio API to send and receive sms from the customers.
Every time i send the sms to my customers, i store the feilds like to, body in to my database.
I have implemented the API for send message that works fine and am simply saving the fields in to my database.
My Problem
When i receive SMS from my customers to my twilio number. i want to get the fields like from number and the body and save to my databse.
i looked that the documentation here
https://www.twilio.com/docs/api/twiml
https://www.twilio.com/blog/2012/04/get-started-with-twilio-sms-receiving-incoming-sms-quickstart.html
But this only shows how to send a response to customer when a message is received.
I want to save the received sms in to my database.
Can someone help me top get the from number and the message body when a SMS is received. tnx..
Twilio evangelist here.
Twilio passes parameters in its HTTP request as form-encoded values, so you just need to use the REQUEST object to grab them:
$from = $_REQUEST['From']
The SMS Quickstart for PHP has a more detailed example.
Hope hat helps.
The documentation for Twilio SMS responses is here:
https://www.twilio.com/docs/api/twiml/sms/twilio_request
Here is a relevant quote:
When Twilio receives a message for one of your Twilio numbers it makes
a synchronous HTTP request to the message URL configured for that
number, and expects to receive TwiML in response. Twilio sends the
following parameters with its request as POST parameters or URL query
parameters, depending on which HTTP method you've configured.
You should simply have the data fields inside of PHP's $_REQUEST[] variable.
$_REQUEST['MessageSid'] - A 34 character unique identifier for the message. May be used to later retrieve this message from the REST API.
$_REQUEST['SmsSid'] - Same value as MessageSid. Deprecated and included for backward compatibility.
$_REQUEST['AccountSid'] - The 34 character id of the Account this message is associated with.
$_REQUEST['From'] - The phone number that sent this message.
$_REQUEST['To'] - The phone number of the recipient.
$_REQUEST['Body'] - The text body of the message. Up to 1600 characters long.
$_REQUEST['NumMedia'] - The number of media items associated with your message
Here is an example query you might use with a MySQL database. You should also be sending back a proper TWIXML response to Twilio and scrub the received data before running a query like this.
$sql = "INSERT INTO messages (sid, from, body)
VALUES (
'".$_REQUEST['MessageSid']."',
'".$_REQUEST['From']."',
'".$_REQUEST['Body']."'
)";

How to receive SMS to a twilio number

I have created a free account in twilio for sending SMS through my website. After my registration I got a twilio number like XXX-XXX-XXXX. I am able to send message to mobile numbers but I don't know how to use this twilio number for receiving SMS. Please help me out on this.
Twilio evangelist here.
The way Twilio notifies you of both incoming SMS message and incoming voice phone calls is by using something called a webhook. This is basically an HTTP request that Twilio makes to a URL that you tell us about. Normally this URL is a web app that you've created and published to a public website.
http://en.wikipedia.org/wiki/Webhook
In your Twilio dashboard, click on the Numbers tab and you will see your trial number.
https://www.twilio.com/user/account/phone-numbers/incoming
Click the phone number and you will see two input fields, one for a Voice URL and one for a SMS url. Just put your URL's there and click the save button.
Now if you send a text message to your number, Twilio will make an HTTP request to the URL you've told us about. You can think of this like a standard Form submit. Twilio will send along parameters like the number the SMS is coming from and the body of the message. The full list of parameters we send to the SMS url is here:
https://www.twilio.com/docs/api/twiml/sms/twilio_request
Your app can grab those parameters and use them however it wants. Your app can also return TwiML instructions to us that tell us to respond to the SMS.
https://www.twilio.com/docs/api/twiml/sms/your_response
You might want to check out our quickstarts for examples of how to receive a text message and and howtos for lots more examples of both sending and receiving SMS messages.
https://www.twilio.com/docs/quickstart/php/sms/hello-monkey
https://www.twilio.com/docs/howto
Hope that helps.
Devin

How to send app request in iphone/php webservices to facebook in using query string

I want to send request by simple query string but I have problems with getting notification on facebook. Also when I send the request and I pass the id of receiver in (to) parameter then I get the request on my own id.
How could I send the app request and get the notification on facebook ?.
I use php webservices for iphone so please do not write pop type. Please, use query string concept so i will pass it in curl.

Categories