I want to test Twilio in my Terminal app by cut / pasting the long URL into terminal. This would contain all the ingrediants Twilio receives to send out a message.
I know it start with https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/ but I can't figure out the syntax of the last part. Does anyone have an example full URL?
like this: https://api.twilio.com/2010-04-01/Accounts/SID1234/AUTH6789.html?from=18005551212&to=1212333444&message=Youre order is ready.
I know this isn't secure and I should go through the required library install, then call those. It's just for my testing. Thank you
When you send an SMS using the Twilio API, you need to make a POST request to the URL, with the data as the body of the request. So the URL is: https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages.json and you can send options like the From number, the To number, and the Body as form encoded parameters in the body of the request. Don't forget you also need to send your account sid and auth token to authorize the request too.
If you are using curl, that would look like this:
curl -X POST https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages.json \
--data-urlencode "From=YOUR_TWILIO_NUMBER" \
--data-urlencode "Body=Hi there" \
--data-urlencode "To=THE_NUMBER_TO_MESSAGE" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
You can't call URLs in order to send SMS via HTTP using Twilio. They do not provide an HTTP API. For that, you can use ClickSend using the following URL format:
https://api-mapper.clicksend.com/http/v2/send.php?method=http&username=xxxx&key=xxxx&to=xxxx&message=xxxx&senderid=xxxx
, where:
username = your site's username;
key = API Key;
to = recipient no.;
message = message body;
senderid = the "From" name/number.
Related
I have SendGrid response and here I get individual X-MessageID which is unique for all sent email, this X-MessageID is actually a starting position of Sendgrid MessageID. So here I was doing something like this "Sendgrid_MessageID Start with X-MessageID",
For.Ex 'KdLh1ZETSQCWx0iqU44BTg.filterdrecv-75d94df84d-4c444-1-627963D1-45.3' start with 'KdLh1ZETSQCWx0iqU44BTg'. I have done this using SendGrid "like" operator like this =>
msg_id like 'KdLh1ZETSQCWx0iqU44BTg%'
and also try another option like
query=msg_id like 'KdLh1ZETSQCWx0iqU44BTg%'
But I get error 'invalid value' for both option, I don't undertstand how to use it. Anyone knows about how to use this "like" operator?
You are using the like operator correctly.
When I make the following HTTP GET request using cURL, I get the message back that start with the given ID:
curl -X GET https://api.sendgrid.com/v3/messages \
--header "Authorization: Bearer [SENDGRID_API_KEY]" \
--data-urlencode "query=msg_id LIKE 'W86EgYT6SQKk0lRflfLRsA%'" \
--data-urlencode "limit=10" --GET
How are you making this HTTP request?
Both GET and POST methods supported by the endpoint. The POST method is recommended to call endpoint with a huge number of user ids to follow, because the GET method will lead to an oversized URL that the server can't handle. How the "follow" parameter can be passed in the body of the request?
UPD: here is what I've already tried using Insomnia (the URL is always 'https://stream.twitter.com/1.1/statuses/filter.json' and the method is always 'POST' and the server response is always "No filter parameters found. Expect at least one parameter: follow track locations"):
A plain text body with Content-Type: text/html
follow=2731236345
A json body with Content-Type: application/json
{
"follow": "2731236345"
}
Another json body
{
"follow": [
2731236345
]
}
However, when I use form-url-encoded with field "follow" and the value "2731236345" I receive the response "Unauthorized".
First of all, consider looking at the Twitter Developer Labs new endpoint, because this existing API will be retired, likely (but not yet confirmed) in 2020.
When you say "without any success", what libraries are you using, and at what levels of query parameters - you're not being very clear about what is not working here. 5000 user IDs is very large. Can you please be more specific about the errors you're seeing, and the code you're trying to run?
I've managed to connect using curl:
curl --request POST \
--url 'https://stream.twitter.com/1.1/statuses/filter.json' \
--header 'authorization: <censored>' \
--data 'follow=2731236345'
The same request doesn't work in Insomnia for some reason, but it doesn't matter for the goal of this post.
We are forming android hybrid app via Phonegap. Using the PayTm web integration kit.
Checksum is generated properly. But when the form is submitted for the payment **Invalid Checksum ** issue is returned.
https://developer.paytm.com/docs/api/initiate-transaction-api/?ref=payments
NOTE: Create the signature using the body parameter of the request in
the same sequence as you pass in the request.
example:
body = {"mid":"MID
HERE","websiteName":"WEBSTAGING","orderId":"ORDERIDHERE","txnAmount":{"value":"10.00","currency":"INR"},"userInfo":{"custId":"CUSTOMERID_HERE"},"callbackUrl":"https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=ORDERID",
"requestType":"Payment"}
Create json
json_body = body.to_json
#RUBY ON RAILS https://github.com/paytm/Paytm_Ruby_Checksum
generated_signature = PaytmChecksum.new.generateSignature(json_body, MERCHANT_KEY_HERE)
curl -X POST 'https://securegw-stage.paytm.in/theia/api/v1/initiateTransaction?mid=MID HERE&orderId=ORDERID_HERE' \
--header 'Content-Type: application/json' \
--data '{"body":{"requestType":"Payment","mid":MID_HERE,"websiteName":"WEBSTAGING","orderId":ORDER_ID_HERE,"txnAmount":{"value":"10.00","currency":"INR"},"userInfo":{"custId":CUSTOMER_ID},"callbackUrl":"https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=ORDER_ID_HERE"},"head":{"signature": generated_signature}}'
As you noted that I pass the body parameter in the same sequence that I used while creating signature(checksum) as in the request body parament.
i have faced the same issue for more than 2 days. i integrated PAYTM on ionic 4. my mistake was, my "TXN_AMOUNT" is in whole amount. "TXN_AMOUNT" should be in decimal number. e.g 199.33, 152.56.
On the other hand "READ THE PAYTM INTEGRATION GUIDE" carefully. it's actually quite good.
https://developer.paytm.com/docs
First try to run with postman
You will get postman collection from paytm just you need to paste key mid there
You will get the response
And please check
The parameter body should be same while creating check sum
Space is not allowed in request body even in json request
Kindly pass the same parameters value in the request which is used while generating the checksum. Also refer the paytm checksum docs available on paytm developer portal.
I'm trying to figure out if it's possible to use a single REST request to have Twilio call out to a phone number, and play out a voice message. The content of the voice message will be different each time, so that message would need to be passed as a parameter.
In looking at the Twilio API "Making Calls" doc, I see this curl sample:
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls.json \
--data-urlencode "Url=http://demo.twilio.com/docs/voice.xml" \
--data-urlencode "To=+14155551212" \
--data-urlencode "From=+14158675309" \
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
This specifies a URL for an XML configuration. For dynamic text, is the expectation that I should publish an xml file to a URL before making the REST call, and then provide that URL in the call? Is there a way to provide the XML as POST data to the end point, rather than using a URL?
Thanks in advance.
gmc
Twilio developer evangelist here.
You can't include the XML as POST data I'm afraid. However, we do offer TwiML Bins which you can use to host your XML without getting a server of your own. Recently we added support for templating in TwiML Bins. This means that you can pass URL parameters to a TwiML Bin URL and use those parameters in your response.
So, if you are intending to use speech to text to read out a message with <Say> then you could write the following TwiML as a TwiML Bin:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>{{ Message }}</Say>
</Response>
You'll get a URL that looks like: https://handler.twilio.com/twiml/EHsomerandomcharacters
You can then use that URL in your call creation, with a URL parameter of Message to read a different message each time.
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls.json \
--data-urlencode "Url=https://handler.twilio.com/twiml/EHsomerandomcharacters?Message=Hello+from+your+TwiML+Bin!" \
--data-urlencode "To=+14155551212" \
--data-urlencode "From=+14158675309" \
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
Let me know if that helps at all.
I am using webhooks for the first time with calendly.com. I would like to create a subscription as described here. When I get to doing this
curl --header "X-TOKEN: <your_token>" --data "url=https://blah.foo/bar&events[]=invitee.created" https://calendly.com/api/v1/hooks
I am concerned that the url is not in a valid format. I tried replacing the & with a ? as in here
curl --header "X-TOKEN: <your_token>" --data "url=https://blah.foo/bar?events[]=invitee.created" https://calendly.com/api/v1/hooks
but I receive this error
{"events":{"events":["can't be blank]}}
Likewise, I try to leave the & and everything after it blank and it give the same error as above.
But using a url with the & and everything in it gives a 404 not found error. Can a url even have the format they are saying is required?
But using a url with the & and everything in it gives a 404 not found error.
The URL part in the following is just the https://blah.foo/bar part before the & character.
curl --header "X-TOKEN: <your_token>" --data "url=https://blah.foo/bar&events[]=invitee.created" https://calendly.com/api/v1/hooks
The events[]=invitee.created part is a separate parameter and value. It’s not part of the url.
See the Create A Webhook Subscription page in the calendy docs:
So the URL is the site that runs your webhook; you don’t send the events parameter/value back to that site—instead you’re sending both the url param and events param to the calendly API endpoint at https://calendly.com/api/v1/hooks. The calendly backend presumably then calls to https://mywebsite.com/webhooks/invitee_created or https://blah.foo/bar whatever url you’ve given it—but without the events parameter, which is for calendly’s internal use.