Copy curl -X POST https://api.gomobile.ma/api/flows \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Payment Reminder",
"description": "Reminds customers about pending payments",
"graph": {
"startNodeId": "dial-1",
"nodes": [
{
"id": "dial-1",
"type": "dial",
"label": "Call Customer",
"config": {
"timeout": 30000,
"enableAMD": true
},
"outputs": {
"onAnswer": "play-greeting",
"onVoicemail": "hangup-vm",
"onNoAnswer": "hangup-na",
"onBusy": "hangup-busy"
}
},
{
"id": "play-greeting",
"type": "play",
"label": "Play Reminder",
"config": {
"audioItems": [
{ "type": "audioFile", "audioId": "greeting-audio-id" }
]
},
"outputs": {
"onComplete": "collect-response"
}
},
{
"id": "collect-response",
"type": "dtmf",
"label": "Get Response",
"config": {
"mode": "single_digit",
"variable": "customerResponse",
"timeout": 10000,
"singleDigitConfig": {
"allowedDigits": ["1", "2"]
}
},
"outputs": {
"branches": {
"1": "play-confirmed",
"2": "play-callback"
},
"onTimeout": "hangup-timeout"
}
},
{
"id": "play-confirmed",
"type": "play",
"label": "Confirm Payment",
"config": {
"audioItems": [
{ "type": "audioFile", "audioId": "confirmed-audio-id" }
]
},
"outputs": {
"onComplete": "hangup-success"
}
},
{
"id": "play-callback",
"type": "play",
"label": "Schedule Callback",
"config": {
"audioItems": [
{ "type": "audioFile", "audioId": "callback-audio-id" }
]
},
"outputs": {
"onComplete": "hangup-success"
}
},
{
"id": "hangup-success",
"type": "hangup",
"label": "End Call - Success",
"config": { "reason": "completed", "hangupType": "normal" }
},
{
"id": "hangup-vm",
"type": "hangup",
"label": "End Call - Voicemail",
"config": { "reason": "voicemail", "hangupType": "voicemail" }
},
{
"id": "hangup-na",
"type": "hangup",
"label": "End Call - No Answer",
"config": { "reason": "no_answer", "hangupType": "no_answer" }
},
{
"id": "hangup-busy",
"type": "hangup",
"label": "End Call - Busy",
"config": { "reason": "busy", "hangupType": "busy" }
},
{
"id": "hangup-timeout",
"type": "hangup",
"label": "End Call - Timeout",
"config": { "reason": "dtmf_timeout", "hangupType": "timeout" }
}
]
}
}'