I am working with Twilio Flow to create a WhatsApp Chat bot.
This bot allows user to start chat and respond with specific terms or numbers to proceed. It works fine, now I have added "Make HTTP Request" WIDGET to call an URL for posting the data received in response to DB.
When the HTTP Request is made, it returns FAIL & SUCCESS for some reasons,
On checking logs, i found out that a URL when any parameter is without any space or any special character, HTTP request gets success with Response code 200, but when its more than a word with added space or any special character HTTP request is failed and returned with Response code 500.
HTTP Request URL :
https://websiteurl.com/page.php?whatsapp_number={{contact.channel.address}}&message={{widgets.ReplyReceived5.inbound.Body}}
I also tried to make HTTP Request to https://webhook.site, but it also failed.
Added SUCCESS and FAILED Request Screenshot below.
Any help to fix this?
Image of HTTP Request getting SUCCESS with response code 200, Message parameter in URL without any space or special character
Image of HTTP Request FAILED with response code 500, Message parameter in URL with space
Twilio developer evangelist here.
In Studio, you can use HTTP Params and GET which will do the encoding (to handle spaces) for you. Or, you could use Liquid Filtering like {{ widgets.boop.di.doop | url_encode }}. My amazing coworker and Studio wizard Craig Dennis recommends using HTTP params.
Let me know if this helps at all!
Related
I'm trying to log in into a site which requires grcp content-type using requests. I alrady have a HTTP 2 client, but I don't know how body of my post request should look like.
When I'm trying to simply copy request as a curl from chrome network tab, request body looks like this:
%äEMAIL"PASSWORD(0
When I'm trying to request site with same body as I copied from chrome tab, I'mm getting response with this headers:
Grpc-Message: grpc: received message larger than max (218767392 vs. 4194304)
Grpc-Status: 8
I'm sure It's becouse wrong payload format
If anybody knows how can I pass data in request plase help.
If you're trying to send a one-off gRPC request, https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md would be helpful to know as to how to construct a message. Otherwise, using gRPC clients (https://github.com/grpc/grpc) would make more sense.
I have an ASP.Net handler that returns a PDF report. I want the Azure Logic App to request the file and then add it to an e-mail as an attachment.
When I try to do this through an HTTP request I get the following error:
BadRequest. Http request failed as there is an error: 'Error while copying content to a stream.'
If I make the request with a browser I get a HTTP 200 response and it works. See request/response headers from chrome and fiddler.
I'm sure I could solve this with an Azure Function to get the file blob and pass it to the e-mail stage but it appears in the documentation that Logic Apps can handle streams and base64 encode. Am I missing something here?
I tried with the following a static result in an HTTP request to mimic the HTTP request/stream as much as possible. I guess it comes down to that you need to design the body of the stream in a way the includes content and content-type like I did below with my mockup HTTP request
pdf content
content-type: application/pdf and application/octet-stream worked
Send and email action:
Sent email
Outlook result:
So I have an application which needs to send data to the API which is created by our team leader using NodeJS with Express.js.
On my end I have laravel application which using VueJS for the UI. Inside the Vue JS component. I am using axios to request to the API.
axios.post('https://clearkey-api.mybluemix.net/sendcampaign', request)
.then(function(response) {
//console.log(response);
})
However, it returns 204 which means according to this https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
204 No Content
The server has fulfilled the request but does not need to return an
entity-body, and might want to return updated metainformation. The
response MAY include new or updated metainformation in the form of
entity-headers, which if present SHOULD be associated with the
requested variant.
If the client is a user agent, it SHOULD NOT change its document view
from that which caused the request to be sent. This response is
primarily intended to allow input for actions to take place without
causing a change to the user agent's active document view, although
any new or updated metainformation SHOULD be applied to the document
currently in the user agent's active view.
The 204 response MUST NOT include a message-body, and thus is always
terminated by the first empty line after the header fields.
Then next it returns 500 Internal Server Error. So in my opinion it returns this error because there is no content to be returned from the server?
Can you tell me other possible problems why it return that response?
Check if the "HTTP method" of the 204 is OPTIONS and if the method of the 500 is POST.
If both are like that, then you are seeing first a CORS pre-flight request (the OPTIONS that returns 204) and then the actual request (the POST that returns 500).
The CORS pre-flight request is a special HTTP message your browser sends to the server when the webpage and the backend are hosted at different addresses. For example, if your website is hosted at http://localhost but the backend you are trying to access is hosted at https://clearkey-api.mybluemix.net.
The reason of the 204 just means your backend endpoint is correctly setup to handle requests for /sendcampaign (you can ignore it). The reason of the 500 is because of some exception in the implementation of the function that handles that endpoint.
So basically, I have created a recipe in IFTTT which make use of the MAKER.
So IF maker, THEN send SMS.
But apparently the GET request can't seem to get through.
This is my GET statement, am I missing out anything?
Button is my event name. KEY is my key from the maker.
String url = "/trigger/Button/with/key/?key="KEY"";
esp8266.println("GET "+ url +" HTTP/1.1");
Apparently I'm getting bad request and sometimes wrong syntax.
Please help.
You may be missing a Host header:
GET /url HTTP/1.1
Host: www.targetsite.com
Brought over from Git
Trying to add the new API URLs to the PHP Basecamp Client. Get stars and delete stars works fine, but POSTing throws a 400.
Request
POST /1804401/api/v1/projects/234118/star.json HTTP/1.1
Response
400 BAD REQUEST
Looks like it will work if I send the project_id as an argument in the payload.
Request
POST /1804401/api/v1/projects/234118/star.json HTTP/1.1
Request Body
{"project_id":234118}
Response
HTTP/1.1 201 Created
I checked our logs and I see your requests going through successfully. Could you try your POST again, with an empty request body?
Update: Aha! I see your requests receiving a 400 response - it's happening before they hit Basecamp. That could be due to a malformed request of some kind. Could you try to reproduce using curl so we can troubleshoot exactly what's occurring? Hard to tell from URL alone.