Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save heathermhargreaves/ee9219602f64f3f1853289ab6feae599 to your computer and use it in GitHub Desktop.
Save heathermhargreaves/ee9219602f64f3f1853289ab6feae599 to your computer and use it in GitHub Desktop.
{
"description": "Appointment Reminder",
"states": [
{
"name": "Trigger",
"type": "trigger",
"transitions": [
{
"event": "incomingMessage"
},
{
"event": "incomingCall"
},
{
"next": "call_user_1",
"event": "incomingRequest"
}
],
"properties": {
"offset": {
"x": 130,
"y": -290
}
}
},
{
"name": "split_confirmation",
"type": "split-based-on",
"transitions": [
{
"next": "say_no_match",
"event": "noMatch"
},
{
"next": "confirmation_webhook",
"event": "match",
"conditions": [
{
"friendly_name": "1",
"arguments": [
"{{widgets.confirm_appt.Digits}}"
],
"type": "equal_to",
"value": "1"
}
]
},
{
"next": "cancellation_webhook",
"event": "match",
"conditions": [
{
"friendly_name": "2",
"arguments": [
"{{widgets.confirm_appt.Digits}}"
],
"type": "equal_to",
"value": "2"
}
]
}
],
"properties": {
"input": "{{widgets.confirm_appt.Digits}}",
"offset": {
"x": 130,
"y": 340
}
}
},
{
"name": "confirmation_webhook",
"type": "make-http-request",
"transitions": [
{
"next": "say_confirmation",
"event": "success"
},
{
"next": "say_confirmation",
"event": "failed"
}
],
"properties": {
"offset": {
"x": -260,
"y": 650
},
"method": "POST",
"url": "http://www.example.com/confirm",
"timeout": 3600
}
},
{
"name": "cancellation_webhook",
"type": "make-http-request",
"transitions": [
{
"next": "say_cancellation",
"event": "success"
},
{
"next": "say_cancellation",
"event": "failed"
}
],
"properties": {
"offset": {
"x": 130,
"y": 650
},
"method": "POST",
"url": "http://www.example.com/cancel",
"timeout": 3600
}
},
{
"name": "confirm_appt",
"type": "gather-input-on-call",
"transitions": [
{
"next": "split_confirmation",
"event": "keypress"
},
{
"next": "split_confirmation",
"event": "speech"
},
{
"event": "timeout"
}
],
"properties": {
"voice": "Polly.Ivy",
"speech_timeout": "auto",
"offset": {
"x": 40,
"y": 130
},
"loop": 1,
"finish_on_key": "#",
"say": "Your appointment is coming up on {{flow.data.appointment_time}}. Please reply 1 to confirm and 2 to cancel.",
"language": "en-US",
"stop_gather": true,
"gather_language": "en",
"profanity_filter": "true",
"timeout": 15
}
},
{
"name": "call_user_1",
"type": "make-outgoing-call-v2",
"transitions": [
{
"next": "confirm_appt",
"event": "answered"
},
{
"next": "say_play_1",
"event": "busy"
},
{
"next": "say_play_1",
"event": "noAnswer"
},
{
"next": "say_play_1",
"event": "failed"
}
],
"properties": {
"machine_detection_speech_threshold": "2400",
"detect_answering_machine": false,
"send_digits": "",
"sip_auth_username": "",
"offset": {
"x": 320,
"y": -140
},
"recording_status_callback": "",
"sip_auth_password": "",
"recording_channels": "mono",
"timeout": 60,
"machine_detection": "Enable",
"trim": "true",
"record": false,
"machine_detection_speech_end_threshold": "1200",
"machine_detection_timeout": "30",
"from": "{{flow.channel.address}}",
"to": "{{contact.channel.address}}",
"machine_detection_silence_timeout": "5000"
}
},
{
"name": "say_play_1",
"type": "say-play",
"transitions": [
{
"event": "audioComplete"
}
],
"properties": {
"voice": "alice",
"offset": {
"x": 520,
"y": 160
},
"loop": 1,
"say": "Your appointment is coming up on {{flow.data.appointment_time}}. Please call us back if you would like to cancel or reschedule.",
"language": "en-US"
}
},
{
"name": "say_no_match",
"type": "say-play",
"transitions": [
{
"next": "confirm_appt",
"event": "audioComplete"
}
],
"properties": {
"offset": {
"x": -410,
"y": 290
},
"loop": 1,
"say": "We're sorry we couldn't understand your response."
}
},
{
"name": "say_confirmation",
"type": "say-play",
"transitions": [
{
"event": "audioComplete"
}
],
"properties": {
"offset": {
"x": -260,
"y": 890
},
"loop": 1,
"say": "Thanks! See you at the office."
}
},
{
"name": "say_cancellation",
"type": "say-play",
"transitions": [
{
"event": "audioComplete"
}
],
"properties": {
"offset": {
"x": 140,
"y": 890
},
"loop": 1,
"say": "We understand that plans change. Thanks for letting us know!"
}
}
],
"initial_state": "Trigger",
"flags": {
"allow_concurrent_calls": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment