Created
December 20, 2020 13:26
-
-
Save stlk/95cbf30aa0353f2114ea8738704791d8 to your computer and use it in GitHub Desktop.
Twilio flow template - https://www.twilio.com/console/studio/flows/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description": "Business number", | |
"states": [ | |
{ | |
"name": "Trigger", | |
"type": "trigger", | |
"transitions": [ | |
{ | |
"event": "incomingMessage" | |
}, | |
{ | |
"next": "check_opening_hours", | |
"event": "incomingCall" | |
}, | |
{ | |
"event": "incomingRequest" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": 470, | |
"y": 20 | |
} | |
} | |
}, | |
{ | |
"name": "forward_call", | |
"type": "connect-call-to", | |
"transitions": [ | |
{ | |
"next": "call_info", | |
"event": "callCompleted" | |
}, | |
{ | |
"next": "call_info", | |
"event": "hangup" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": 620, | |
"y": 570 | |
}, | |
"caller_id": "{{flow.channel.address}}", | |
"noun": "number", | |
"to": "+420123456789", | |
"timeout": 30 | |
} | |
}, | |
{ | |
"name": "split_based_on_is_open", | |
"type": "split-based-on", | |
"transitions": [ | |
{ | |
"next": "closed_message", | |
"event": "noMatch" | |
}, | |
{ | |
"next": "forward_call", | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "If value equal_to true", | |
"arguments": [ | |
"{{widgets.check_opening_hours.parsed.isOpen}}" | |
], | |
"type": "equal_to", | |
"value": "true" | |
} | |
] | |
} | |
], | |
"properties": { | |
"input": "{{widgets.check_opening_hours.parsed.isOpen}}", | |
"offset": { | |
"x": 250, | |
"y": 370 | |
} | |
} | |
}, | |
{ | |
"name": "closed_message", | |
"type": "say-play", | |
"transitions": [ | |
{ | |
"event": "audioComplete" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": 100, | |
"y": 690 | |
}, | |
"loop": 1, | |
"say": "We're closed. Please call during working hours." | |
} | |
}, | |
{ | |
"name": "call_info", | |
"type": "send-message", | |
"transitions": [ | |
{ | |
"event": "sent" | |
}, | |
{ | |
"event": "failed" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": 730, | |
"y": 880 | |
}, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"from": "YOUR_SMS_CAPABLE_NUMBER", | |
"to": "YOUR_CELLPHONE_NUMBER", | |
"body": "Last caller number: {{contact.channel.address}}" | |
} | |
}, | |
{ | |
"name": "check_opening_hours", | |
"type": "make-http-request", | |
"transitions": [ | |
{ | |
"next": "split_based_on_is_open", | |
"event": "success" | |
}, | |
{ | |
"next": "forward_call", | |
"event": "failed" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": 610, | |
"y": 170 | |
}, | |
"method": "POST", | |
"content_type": "application/json;charset=utf-8", | |
"body": "{\n \"timezone\": \"Europe/Berlin\",\n \"workdays\": [\n \"Mon\",\n \"Tue\",\n \"Wed\",\n \"Thu\",\n \"Fri\"\n ],\n \"opening_hours\": [\n [\n 9,\n 16\n ]\n ]\n}", | |
"url": "https://openinghours.vercel.app/" | |
} | |
} | |
], | |
"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