Skip to content

Instantly share code, notes, and snippets.

@Eclairemoy
Created March 30, 2021 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Eclairemoy/1f58f1b80b95783e3fef41582a933591 to your computer and use it in GitHub Desktop.
Save Eclairemoy/1f58f1b80b95783e3fef41582a933591 to your computer and use it in GitHub Desktop.
{
"description": "IVR",
"states": [
{
"name": "Trigger",
"type": "trigger",
"transitions": [
{
"event": "incomingMessage"
},
{
"next": "gather_input_firstName",
"event": "incomingCall"
},
{
"event": "incomingRequest"
}
],
"properties": {
"offset": {
"x": 250,
"y": 50
}
}
},
{
"name": "gather_input_firstName",
"type": "gather-input-on-call",
"transitions": [
{
"next": "gather_input_firstName",
"event": "keypress"
},
{
"next": "set_firstName",
"event": "speech"
},
{
"next": "gather_input_firstName",
"event": "timeout"
}
],
"properties": {
"voice": "Polly.Salli",
"speech_timeout": "auto",
"offset": {
"x": 120,
"y": 260
},
"loop": 1,
"finish_on_key": "",
"say": "Hello, Thank you for calling COVID help line. Please say your FirstName",
"language": "en-US",
"stop_gather": false,
"gather_language": "en",
"profanity_filter": "true",
"timeout": 5
}
},
{
"name": "set_firstName",
"type": "set-variables",
"transitions": [
{
"next": "gather_input_lastName",
"event": "next"
}
],
"properties": {
"variables": [
{
"value": "{{widgets.gather_input_firstName.SpeechResult}}",
"key": "firstName"
}
],
"offset": {
"x": 130,
"y": 510
}
}
},
{
"name": "gather_input_lastName",
"type": "gather-input-on-call",
"transitions": [
{
"next": "gather_input_lastName",
"event": "keypress"
},
{
"next": "set_lastName",
"event": "speech"
},
{
"next": "gather_input_lastName",
"event": "timeout"
}
],
"properties": {
"voice": "Polly.Salli",
"speech_timeout": "auto",
"offset": {
"x": 120,
"y": 750
},
"loop": 1,
"finish_on_key": "",
"say": "Please say your lastName",
"language": "en-US",
"stop_gather": false,
"gather_language": "en",
"profanity_filter": "true",
"timeout": 5
}
},
{
"name": "set_lastName",
"type": "set-variables",
"transitions": [
{
"next": "gather_input_age",
"event": "next"
}
],
"properties": {
"variables": [
{
"value": "{{widgets.gather_input_lastName.SpeechResult}}",
"key": "lastName"
}
],
"offset": {
"x": 140,
"y": 1000
}
}
},
{
"name": "gather_input_age",
"type": "gather-input-on-call",
"transitions": [
{
"next": "set_age",
"event": "keypress"
},
{
"next": "set_speech_age",
"event": "speech"
},
{
"next": "gather_input_age",
"event": "timeout"
}
],
"properties": {
"voice": "Polly.Salli",
"number_of_digits": 2,
"speech_timeout": "auto",
"offset": {
"x": 120,
"y": 1250
},
"loop": 1,
"finish_on_key": "#",
"say": "Please enter your age",
"language": "en-US",
"stop_gather": true,
"gather_language": "en",
"profanity_filter": "true",
"timeout": 5
}
},
{
"name": "set_age",
"type": "set-variables",
"transitions": [
{
"next": "set_phoneNumber",
"event": "next"
}
],
"properties": {
"variables": [
{
"value": "{{widgets.gather_input_age.Digits}}",
"key": "age"
}
],
"offset": {
"x": -90,
"y": 1530
}
}
},
{
"name": "set_speech_age",
"type": "set-variables",
"transitions": [
{
"next": "set_phoneNumber",
"event": "next"
}
],
"properties": {
"variables": [
{
"value": "{{widgets.gather_input_age.SpeechResult}}",
"key": "age"
}
],
"offset": {
"x": 350,
"y": 1530
}
}
},
{
"name": "set_phoneNumber",
"type": "set-variables",
"transitions": [
{
"next": "gather_input_zipcode",
"event": "next"
}
],
"properties": {
"variables": [
{
"value": "{{contact.channel.address}}",
"key": "phoneNumber"
}
],
"offset": {
"x": 110,
"y": 1750
}
}
},
{
"name": "airtablewrite",
"type": "run-function",
"transitions": [
{
"next": "GoodBye",
"event": "success"
},
{
"next": "Error",
"event": "fail"
}
],
"properties": {
"service_sid": "ZSe0d85c8c623a9e7e1ac82c83bd95c82e",
"environment_sid": "ZE3079f566db197317596ed9abaecc77d4",
"offset": {
"x": 240,
"y": 2520
},
"function_sid": "ZH62cf7a0d8c4b6e554bcb53723926b78d",
"parameters": [
{
"value": "{{flow.variables.age}}",
"key": "age"
},
{
"value": "{{flow.variables.phoneNumber}}",
"key": "phoneNumber"
},
{
"value": "{{flow.variables.zipcode}}",
"key": "zipcode"
},
{
"value": "{{flow.variables.firstName}}",
"key": "firstName"
},
{
"value": "{{flow.variables.lastName}}",
"key": "lastName"
}
],
"url": "https://call-overflow-6231.twil.io/write-to-airtable"
}
},
{
"name": "gather_input_zipcode",
"type": "gather-input-on-call",
"transitions": [
{
"next": "set_zipcode",
"event": "keypress"
},
{
"next": "set_speech_zipcode",
"event": "speech"
},
{
"event": "timeout"
}
],
"properties": {
"voice": "Polly.Salli",
"number_of_digits": 5,
"speech_timeout": "auto",
"offset": {
"x": 110,
"y": 1970
},
"loop": 1,
"finish_on_key": "#",
"say": "Please say or enter your 5 digit zipcode",
"language": "en-US",
"stop_gather": true,
"gather_language": "en",
"profanity_filter": "true",
"timeout": 5
}
},
{
"name": "set_zipcode",
"type": "set-variables",
"transitions": [
{
"next": "airtablewrite",
"event": "next"
}
],
"properties": {
"variables": [
{
"value": "{{widgets.gather_input_zipcode.Digits}}",
"key": "zipcode"
}
],
"offset": {
"x": -110,
"y": 2240
}
}
},
{
"name": "set_speech_zipcode",
"type": "set-variables",
"transitions": [
{
"next": "airtablewrite",
"event": "next"
}
],
"properties": {
"variables": [
{
"value": "{{widgets.gather_input_zipcode.SpeechResult}}",
"key": "zipcode"
}
],
"offset": {
"x": 340,
"y": 2240
}
}
},
{
"name": "GoodBye",
"type": "say-play",
"transitions": [
{
"event": "audioComplete"
}
],
"properties": {
"voice": "Polly.Salli",
"offset": {
"x": -250,
"y": 2750
},
"loop": 1,
"say": "Our health Associates will contact you shortly. Good Bye.",
"language": "en-US"
}
},
{
"name": "Error",
"type": "say-play",
"transitions": [
{
"next": "error_connect_call_to_support",
"event": "audioComplete"
}
],
"properties": {
"voice": "Polly.Salli",
"offset": {
"x": 300,
"y": 2750
},
"loop": 1,
"say": "We encountered an issue, transferring the call to associate.",
"language": "en-US"
}
},
{
"name": "error_connect_call_to_support",
"type": "connect-call-to",
"transitions": [
{
"event": "callCompleted"
}
],
"properties": {
"offset": {
"x": 330,
"y": 2970
},
"caller_id": "{{contact.channel.address}}",
"noun": "number",
"to": "+1 224 479 1669",
"timeout": 30
}
}
],
"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