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 Flow",
"description": "Reminds customers of balance and collects response",
"graph": {
"startNodeId": "dial-1",
"nodes": [
{
"id": "dial-1",
"type": "dial",
"label": "Call Customer",
"config": {
"timeout": 30000,
"enableAMD": true
},
"outputs": {
"onAnswer": "play-welcome",
"onVoicemail": "hangup-vm",
"onNoAnswer": "hangup-na",
"onBusy": "hangup-busy"
}
},
{
"id": "play-welcome",
"type": "play",
"label": "Play Balance Message",
"config": {
"audioItems": [
{ "type": "audioFile", "audioId": "WELCOME_AUDIO_ID" },
{ "type": "audioFile", "audioId": "YOUR_BALANCE_IS_AUDIO_ID" },
{
"type": "number",
"value": { "source": "customAttribute", "attributeName": "account_balance" },
"mode": "full",
"language": "ar",
"dictionaryId": null
},
{ "type": "audioFile", "audioId": "DIRHAMS_AUDIO_ID" },
{ "type": "audioFile", "audioId": "MENU_PROMPT_AUDIO_ID" }
]
},
"outputs": {
"onComplete": "collect-response"
}
},
{
"id": "collect-response",
"type": "dtmf",
"label": "Get Customer Response",
"config": {
"mode": "single_digit",
"variable": "customerResponse",
"timeout": 10000,
"singleDigitConfig": {
"allowedDigits": ["1", "2"]
},
"retry": {
"maxRetries": 2
}
},
"outputs": {
"branches": {
"1": "play-confirmation",
"2": "play-callback"
},
"onTimeout": "hangup-timeout",
"onMaxRetries": "hangup-max-retries"
}
},
{
"id": "play-confirmation",
"type": "play",
"label": "Confirm Payment",
"config": {
"audioItems": [
{ "type": "audioFile", "audioId": "CONFIRMATION_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 - Success",
"config": { "reason": "completed", "hangupType": "normal" }
},
{
"id": "hangup-vm",
"type": "hangup",
"label": "End - Voicemail",
"config": { "reason": "voicemail", "hangupType": "voicemail" }
},
{
"id": "hangup-na",
"type": "hangup",
"label": "End - No Answer",
"config": { "reason": "no_answer", "hangupType": "no_answer" }
},
{
"id": "hangup-busy",
"type": "hangup",
"label": "End - Busy",
"config": { "reason": "busy", "hangupType": "busy" }
},
{
"id": "hangup-timeout",
"type": "hangup",
"label": "End - Timeout",
"config": { "reason": "dtmf_timeout", "hangupType": "timeout" }
},
{
"id": "hangup-max-retries",
"type": "hangup",
"label": "End - Max Retries",
"config": { "reason": "max_retries", "hangupType": "timeout" }
}
]
}
}'