Trying to Create Verification using Twilio verify

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": [
""
],
"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]

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,

1 Like

Thanks Jerome, much Appreciated for the help, it worked for me.

Thanks
Anil

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.