Last active
February 23, 2022 17:33
-
-
Save elizabethsiegle/2d03165e1370b7478c77d77d8ef83c24 to your computer and use it in GitHub Desktop.
This file contains 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": "A New Flow", | |
"states": [ | |
{ | |
"name": "Trigger", | |
"type": "trigger", | |
"transitions": [ | |
{ | |
"next": "what_did_you_guess", | |
"event": "incomingMessage" | |
}, | |
{ | |
"event": "incomingCall" | |
}, | |
{ | |
"event": "incomingRequest" | |
}, | |
{ | |
"event": "incomingParent" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": -10, | |
"y": -40 | |
} | |
} | |
}, | |
{ | |
"name": "greensquares", | |
"type": "send-and-wait-for-reply", | |
"transitions": [ | |
{ | |
"next": "greenlettersplit", | |
"event": "incomingMessage" | |
}, | |
{ | |
"event": "timeout" | |
}, | |
{ | |
"event": "deliveryFailure" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": 50, | |
"y": 370 | |
}, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"from": "{{flow.channel.address}}", | |
"body": "What are your green squares🟩? (What letters whose locations do you know?) Send as \"???xx\" where a question mark is the character you do not know", | |
"timeout": "3600" | |
} | |
}, | |
{ | |
"name": "yellowsquares", | |
"type": "send-and-wait-for-reply", | |
"transitions": [ | |
{ | |
"next": "yellowlettersplit", | |
"event": "incomingMessage" | |
}, | |
{ | |
"event": "timeout" | |
}, | |
{ | |
"event": "deliveryFailure" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": 620, | |
"y": 360 | |
}, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"from": "{{flow.channel.address}}", | |
"body": "What are your yellow squares🟨? (What letters do you know are in the word, but not their locations?) Ex. if you know the word contains \"t\" and \"s\" send \"ts\". If none, send \"!\"", | |
"timeout": "3600" | |
} | |
}, | |
{ | |
"name": "function_1", | |
"type": "run-function", | |
"transitions": [ | |
{ | |
"next": "send_message_1", | |
"event": "success" | |
}, | |
{ | |
"event": "fail" | |
} | |
], | |
"properties": { | |
"service_sid": "YOUR-SERVICE-SID", | |
"environment_sid": "YOUR-ENVIRONMENT-SID", | |
"offset": { | |
"x": 60, | |
"y": 940 | |
}, | |
"function_sid": "YOUR"-FUNCTION-SID, | |
"parameters": [ | |
{ | |
"value": "{{widgets.greensquares.inbound.Body}}", | |
"key": "green" | |
}, | |
{ | |
"value": "{{flow.variables.yellow}}", | |
"key": "yellow" | |
}, | |
{ | |
"value": "{{flow.variables.guesses}}", | |
"key": "guesses" | |
} | |
], | |
"url": "REPLACE-WITH-YOUR-FUNCTION-URL" | |
} | |
}, | |
{ | |
"name": "what_did_you_guess", | |
"type": "send-and-wait-for-reply", | |
"transitions": [ | |
{ | |
"next": "fiveletterword", | |
"event": "incomingMessage" | |
}, | |
{ | |
"event": "timeout" | |
}, | |
{ | |
"event": "deliveryFailure" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": -60, | |
"y": 140 | |
}, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"from": "{{flow.channel.address}}", | |
"body": "What 5-letter word(s) did you guess? Separate multiple words with commas", | |
"timeout": "3600" | |
} | |
}, | |
{ | |
"name": "fiveletterword", | |
"type": "split-based-on", | |
"transitions": [ | |
{ | |
"next": "what_did_you_guess", | |
"event": "noMatch" | |
}, | |
{ | |
"next": "set_variables_2", | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "5 letter words comma separated", | |
"arguments": [ | |
"{{widgets.what_did_you_guess.inbound.Body}}" | |
], | |
"type": "regex", | |
"value": "[A-Za-z]{5}(\\s*,\\s*[A-Za-z]{5})*" | |
} | |
] | |
} | |
], | |
"properties": { | |
"input": "{{widgets.what_did_you_guess.inbound.Body}}", | |
"offset": { | |
"x": -790, | |
"y": 390 | |
} | |
} | |
}, | |
{ | |
"name": "greenlettersplit", | |
"type": "split-based-on", | |
"transitions": [ | |
{ | |
"next": "greensquares", | |
"event": "noMatch" | |
}, | |
{ | |
"next": "yellowsquares", | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "5 letter question marks", | |
"arguments": [ | |
"{{widgets.greensquares.inbound.Body}}" | |
], | |
"type": "regex", | |
"value": "[A-Za-z?]{5}" | |
} | |
] | |
} | |
], | |
"properties": { | |
"input": "{{widgets.greensquares.inbound.Body}}", | |
"offset": { | |
"x": -40, | |
"y": 630 | |
} | |
} | |
}, | |
{ | |
"name": "yellowlettersplit", | |
"type": "split-based-on", | |
"transitions": [ | |
{ | |
"next": "yellowsquares", | |
"event": "noMatch" | |
}, | |
{ | |
"next": "set_yellow_nonblank", | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "letters", | |
"arguments": [ | |
"{{widgets.yellowsquares.inbound.Body}}" | |
], | |
"type": "regex", | |
"value": "[A-Za-z]{1,5}" | |
} | |
] | |
}, | |
{ | |
"next": "set_yellow_blank", | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "If value equal_to !", | |
"arguments": [ | |
"{{widgets.yellowsquares.inbound.Body}}" | |
], | |
"type": "equal_to", | |
"value": "!" | |
} | |
] | |
} | |
], | |
"properties": { | |
"input": "{{widgets.yellowsquares.inbound.Body}}", | |
"offset": { | |
"x": 600, | |
"y": 590 | |
} | |
} | |
}, | |
{ | |
"name": "send_message_1", | |
"type": "send-message", | |
"transitions": [ | |
{ | |
"next": "didyougetitafternewguess", | |
"event": "sent" | |
}, | |
{ | |
"event": "failed" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": -490, | |
"y": 930 | |
}, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"from": "{{flow.channel.address}}", | |
"to": "{{contact.channel.address}}", | |
"body": "Words are {{widgets.function_1.parsed.words}| join: \", \" }}." | |
} | |
}, | |
{ | |
"name": "set_variables_1", | |
"type": "set-variables", | |
"transitions": [ | |
{ | |
"next": "splitafternewguess", | |
"event": "next" | |
} | |
], | |
"properties": { | |
"variables": [ | |
{ | |
"value": "{{flow.variables.guesses}}, {{widgets.new_guess.inbound.Body}}", | |
"key": "guesses" | |
} | |
], | |
"offset": { | |
"x": -110, | |
"y": 1830 | |
} | |
} | |
}, | |
{ | |
"name": "didyougetitafternewguess", | |
"type": "send-and-wait-for-reply", | |
"transitions": [ | |
{ | |
"next": "split_1", | |
"event": "incomingMessage" | |
}, | |
{ | |
"event": "timeout" | |
}, | |
{ | |
"event": "deliveryFailure" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": -480, | |
"y": 1240 | |
}, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"from": "{{flow.channel.address}}", | |
"body": "Did you get it? Y or N", | |
"timeout": "3600" | |
} | |
}, | |
{ | |
"name": "new_guess", | |
"type": "send-and-wait-for-reply", | |
"transitions": [ | |
{ | |
"next": "set_variables_1", | |
"event": "incomingMessage" | |
}, | |
{ | |
"event": "timeout" | |
}, | |
{ | |
"event": "deliveryFailure" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": -520, | |
"y": 1820 | |
}, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"from": "{{flow.channel.address}}", | |
"body": "What did you guess?", | |
"timeout": "3600" | |
} | |
}, | |
{ | |
"name": "split_1", | |
"type": "split-based-on", | |
"transitions": [ | |
{ | |
"next": "didyougetitafternewguess", | |
"event": "noMatch" | |
}, | |
{ | |
"next": "congrats", | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "If value equal_to y", | |
"arguments": [ | |
"{{widgets.didyougetitafternewguess.inbound.Body}}" | |
], | |
"type": "equal_to", | |
"value": "y" | |
} | |
] | |
}, | |
{ | |
"next": "new_guess", | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "If value equal_to n", | |
"arguments": [ | |
"{{widgets.didyougetitafternewguess.inbound.Body}}" | |
], | |
"type": "equal_to", | |
"value": "n" | |
} | |
] | |
}, | |
{ | |
"next": "congrats", | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "If value contains yes", | |
"arguments": [ | |
"{{widgets.didyougetitafternewguess.inbound.Body}}" | |
], | |
"type": "contains", | |
"value": "yes" | |
} | |
] | |
}, | |
{ | |
"next": "new_guess", | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "If value contains no", | |
"arguments": [ | |
"{{widgets.didyougetitafternewguess.inbound.Body}}" | |
], | |
"type": "contains", | |
"value": "no" | |
} | |
] | |
} | |
], | |
"properties": { | |
"input": "{{widgets.didyougetitafternewguess.inbound.Body}}", | |
"offset": { | |
"x": -770, | |
"y": 1520 | |
} | |
} | |
}, | |
{ | |
"name": "congrats", | |
"type": "send-message", | |
"transitions": [ | |
{ | |
"event": "sent" | |
}, | |
{ | |
"event": "failed" | |
} | |
], | |
"properties": { | |
"offset": { | |
"x": -910, | |
"y": 1800 | |
}, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"from": "{{flow.channel.address}}", | |
"to": "{{contact.channel.address}}", | |
"body": "Congrats!" | |
} | |
}, | |
{ | |
"name": "set_variables_2", | |
"type": "set-variables", | |
"transitions": [ | |
{ | |
"next": "greensquares", | |
"event": "next" | |
} | |
], | |
"properties": { | |
"variables": [ | |
{ | |
"value": "{{widgets.what_did_you_guess.inbound.Body}}", | |
"key": "guesses" | |
} | |
], | |
"offset": { | |
"x": -420, | |
"y": 640 | |
} | |
} | |
}, | |
{ | |
"name": "splitafternewguess", | |
"type": "split-based-on", | |
"transitions": [ | |
{ | |
"next": "didyougetitafternewguess", | |
"event": "noMatch" | |
}, | |
{ | |
"next": "greensquares", | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "5 letter words comma separated", | |
"arguments": [ | |
"{{widgets.what_did_you_guess.inbound.Body}}" | |
], | |
"type": "regex", | |
"value": "[A-Za-z]{5}(\\s*,\\s*[A-Za-z]{5})*" | |
} | |
] | |
} | |
], | |
"properties": { | |
"input": "{{widgets.what_did_you_guess.inbound.Body}}", | |
"offset": { | |
"x": 50, | |
"y": 1520 | |
} | |
} | |
}, | |
{ | |
"name": "set_yellow_blank", | |
"type": "set-variables", | |
"transitions": [ | |
{ | |
"next": "function_1", | |
"event": "next" | |
} | |
], | |
"properties": { | |
"variables": [ | |
{ | |
"value": "{{\"\"}}", | |
"key": "yellow" | |
} | |
], | |
"offset": { | |
"x": 930, | |
"y": 830 | |
} | |
} | |
}, | |
{ | |
"name": "set_yellow_nonblank", | |
"type": "set-variables", | |
"transitions": [ | |
{ | |
"next": "function_1", | |
"event": "next" | |
} | |
], | |
"properties": { | |
"variables": [ | |
{ | |
"value": "{{widgets.yellowsquares.inbound.Body}}", | |
"key": "yellow" | |
} | |
], | |
"offset": { | |
"x": 550, | |
"y": 810 | |
} | |
} | |
} | |
], | |
"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