How to sent Pins using Voice Conversation API
In this tutorial, we will see how to sent PINs using the voice conversation API.
First, you sent the PIN number using the Voice Conversation endpoint. Below is a cURL example of that. You can find more for this resource here.
curl -X POST \
https://connect.routee.net/voice/conversation \
-H 'Content-Type: application/json' \
-H 'Postman-Token: cb9309b6-a1a5-4af7-9747-d7a45d62c29d' \
-H 'authorization: Bearer {accessToken}' \
-H 'cache-control: no-cache' \
-d '{
"from": "+123456",
"to": {
"phone": "+306990000000"
},
"dialPlan": {
"verbs": [{
"type": "PAUSE",
"duration": 2
}, {
"type": "SAY",
"message": {
"language": "en-US",
"gender": "female",
"text": "Your pin code is: 1. 2. 3. 4."
},
"bargeIn": true
}, {
"type": "PAUSE",
"duration": 2
}, {
"type": "SAY",
"message": {
"language": "en-US",
"gender": "female",
"text": "Your pin code is: 1. 2. 3. 4. If you wish to hear the message again, Please press 1."
},
"bargeIn": true
}, {
"type": "PAUSE",
"duration": 2
}, {
"type": "COLLECT",
"eventUrl": "https://example.com"
}]
}
}'This will send the voice message to the destination number. If the user presses the digit 1 Routee will POST to the eventUrl the following payload
{
"messageId": "string",
"conversationTrackingId": "string",
"collectedTones": "string"
}In order to play the message again, you have to set up your eventUrl endpoint to will return the following JSON code
{
"verbs": [
{
"type": "SAY",
"message": {
"language": "en-US",
"gender": "female",
"text": "Your pin code is: 1. 2. 3. 4."
}
},
{
"type": "PAUSE",
"duration": 3
}
]
}That's it!
Updated 8 days ago

