AnilKumarN | 2020-05-16 15:25:38 UTC | #1
HI Team, we tried to send the SMS verification code using Twilio Verify using API, We testing via Postman it worked, now tried to implement the same on the Web service Data Action, below is the details, we are getting error as channel input parameter is missing, but both format is urlencode Twilio formate "curl 'https://verify.twilio.com/v2/Services/VA0be89a3526701d5af0264b6fe5b18a21/Verifications' -X POST \ --data-urlencode 'To=+919XXXXXXXXX' \ --data-urlencode 'Channel=sms' \ -u AC1bef0c33f2d331176d6b3a838352affb:[AuthToken]"
PureCLoud Data action configuration Input Contract { "type": "object", "properties": { "To": { "type": "string" }, "Channel": { "type": "string" } }, "additionalProperties": true }
Output Contract { "type": "object", "properties": { "sid": { "type": "string" } }, "additionalProperties": true }
Response templet
{ "translationMap": { "sid": "$.sid" }, "translationMapDefaults": {}, "successTemplate": "{\"sid\":${sid}\n}" }
Resolved request URL templet "[POST] https://verify.twilio.com/v2/Services/VA0be89a3526701d5af0264b6fe5b18a21/Verifications"
Header templet { "Authorization": [ "<REDACTED>" ], "Content-Type": [ "application/x-www-form-urlencoded" ] }
Request Body Templet "To=esc.url(\\\"{input.To}\")&Channel=esc.url(\\\"{input.Channel}\")"
Error: Execute: The request could not be understood by the server due to malformed syntax. REST call for action execute failed. Message:Request to backend service failed. Response from web service: {"code": 60200, "message": "Invalid parameter: Channel", "more_info": "https://www.twilio.com/docs/errors/60200", "status": 400} [7ff3dfd3-de39-4b53-b4a5-967ea09788fa]
Jerome.Saint-Marc | 2020-05-17 05:20:27 UTC | #2
Hello,
The problem is in your Request Body Template.
My input/request configuration looks like this (replace XXXXXXXXXXXXXXX and YYYYYYYYYYY):
{ "requestUrlTemplate": "https://verify.twilio.com/v2/Services/XXXXXXXXXXXXXXX/Verifications", "requestType": "POST", "headers": { "Content-Type": "application/x-www-form-urlencoded", "Authorization": "YYYYYYYYYYY" }, "requestTemplate": "To=$esc.url(${input.To})&Channel=$esc.url(${input.Channel})" }
Regards,
AnilKumarN | 2020-05-18 06:45:28 UTC | #3
Jerome.Saint-Marc, post:2, topic:7810
"requestTemplate": "To=$esc.url(${input.To})&Channel=$esc.url(${input.Channel})" }
Thanks Jerome, much Appreciated for the help, it worked for me.
Thanks Anil
system | 2020-06-18 06:45:30 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 7810