A building block that shows how to handle an user input with DTMF
-
You must specify one endpoint must be on the path
/webhooks/answer
-
Your endpoint must be accessible on
GET
and onPOST
requests -
Your endpoint must listen on port
3000
-
Your answer endpoint response should return a 200 status code
-
Your endpoint should handle both query string parameters and JSON on both
GET
andPOST
methods. -
Your endpoints should handle query string parameters on
GET
andPOST
-
Your endpoint should handle JSON on
POST
-
When
/webhooks/dtmf
is called a200 OK
repsonse should be returned. -
The
eventURL
should be likehttp://127.0.0.1:3000/webhooks/dtmf
orhttps://demo.ngrok.io/webhooks/dtmf
and should be dynamicly made up of:- The request protocol
- The request hostname
- The request port (only if present)
-
/webhooks/dtmf
-
Your answer response should be JSON NCCO with the the following or equivilent body:
-
GET
curl "http://127.0.0.1:3000/webhooks/answer"
-
POST
curl -X "POST" "http://127.0.0.1:3000/webhooks/answer"
-
Should all return:
[
{
"action": "talk",
"text": "Please enter a digit"
},
{
"action": "input",
"eventUrl": [
"http://127.0.0.1:3000/webhooks/dtmf"
]
}
]
-
Your event response should be JSON NCCO with the the following or equivilent body:
-
GET
+ Querycurl "http://127.0.0.1:3000/webhooks/dtmf?dtmf=7"
-
POST
+ Querycurl -X "POST" "http://127.0.0.1:3000/webhooks/dtmf?dtmf=7"
-
POST
+ JSONcurl -X "POST" "http://127.0.0.1:3000/webhooks/dtmf" \ -H 'Content-Type: application/json; charset=utf-8' \ -d $'{ "dtmf": "7" }'
-
Should all return:
[
{
"action": "talk",
"text": "You pressed 7"
}
]
- Code examples should include a GitHub link to the file
- Code examples should include the line numbers used from the linked file
- All code examples must be present in the
master
branch of the relevant quickstart repo - All code examples must be tested to work (manual testing is fine)
- Fork this gist
- Edit the gist and the building block files to match the specification
- Return Gist as a comment in the original issue