Created
February 27, 2020 14:13
-
-
Save mjg123/3df69354808b20a4f120d9b46cf63f0c to your computer and use it in GitHub Desktop.
Twilio Studio Flows for conversations SMS bots to practise the Doomsday algorithm
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": "Doomsday by SMS", | |
"states": [ | |
{ | |
"name": "Trigger", | |
"type": "InitialState", | |
"properties": { | |
"offset": { | |
"x": 0, | |
"y": 0 | |
}, | |
"flow_url": "https://webhooks.twilio.com/v1/Accounts/AC69a381fe7d9987b8a2e98ee7c63ea2b5/Flows/FW682269c19ab5d6b2982a5bb18f2a73f6" | |
}, | |
"transitions": [ | |
{ | |
"event": "incomingMessage", | |
"conditions": [], | |
"next": "FFf3e537146c3ed0646f85fe87343b0b66", | |
"uuid": "308c1697-61d6-44a2-b44f-fed81b102e5b" | |
}, | |
{ | |
"event": "incomingCall", | |
"conditions": [], | |
"next": null, | |
"uuid": "95e48cc5-800f-4467-90d1-9478f16b4238" | |
}, | |
{ | |
"event": "incomingRequest", | |
"conditions": [], | |
"next": null, | |
"uuid": "50a4e053-82a0-4af4-ba17-1de60bac0302" | |
} | |
], | |
"sid": "FF79fa9f4c20e497a5b7e79553deffbf66" | |
}, | |
{ | |
"name": "Choose_a_date", | |
"type": "Function", | |
"properties": { | |
"offset": { | |
"x": 30, | |
"y": 210 | |
}, | |
"url": "https://linen-finch-5633.twil.io/doomsday", | |
"timeout": null, | |
"parameters": null, | |
"service_sid": null, | |
"function_sid": null, | |
"environment_sid": null | |
}, | |
"transitions": [ | |
{ | |
"event": "success", | |
"conditions": [], | |
"next": "FF7f8a7e326b3edd60c442f6a2fa8f1a41", | |
"uuid": "41ab2e56-7786-49af-a3e8-8352e5e49090" | |
}, | |
{ | |
"event": "fail", | |
"conditions": [], | |
"next": null, | |
"uuid": "57bea2cc-6319-4a9e-8167-69c4b4e1ed46" | |
} | |
], | |
"sid": "FFf3e537146c3ed0646f85fe87343b0b66" | |
}, | |
{ | |
"name": "ask_initial_question", | |
"type": "MessagePrompt", | |
"properties": { | |
"offset": { | |
"x": 60, | |
"y": 430 | |
}, | |
"body": "Hello 👋 Tell me, what day is {{widgets.Choose_a_date.parsed.date}}?", | |
"from": "{{flow.channel.address}}", | |
"timeout": 3600, | |
"save_response_as": null, | |
"media_url": null, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"attributes": null | |
}, | |
"transitions": [ | |
{ | |
"event": "incomingMessage", | |
"conditions": [], | |
"next": "FF9775283f99b0521c9971c50e93af06bd", | |
"uuid": "4908795b-28f1-4f04-b76e-ad94cc9da2a6" | |
}, | |
{ | |
"event": "timeout", | |
"conditions": [], | |
"next": null, | |
"uuid": "e630ffdb-780e-42cf-9a87-8a9a1aa3b829" | |
}, | |
{ | |
"event": "deliveryFailure", | |
"conditions": [], | |
"next": null, | |
"uuid": "4460aa6d-b12e-41f6-bcbf-9a2a0671ed04" | |
} | |
], | |
"sid": "FF7f8a7e326b3edd60c442f6a2fa8f1a41" | |
}, | |
{ | |
"name": "was_it_right", | |
"type": "Branch", | |
"properties": { | |
"offset": { | |
"x": -30, | |
"y": 620 | |
}, | |
"input": "{{widgets.ask_initial_question.inbound.Body}}" | |
}, | |
"transitions": [ | |
{ | |
"event": "noMatch", | |
"conditions": [], | |
"next": "FF9a21aea095cd7831f104b4afb1002961", | |
"uuid": "3704d505-8409-4de4-ae3c-368f76a64a29" | |
}, | |
{ | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "Was it right?", | |
"type": "contains", | |
"arguments": [ | |
"{{widgets.ask_initial_question.inbound.Body}}" | |
], | |
"value": "{{widgets.Choose_a_date.parsed.day_of_week}}" | |
} | |
], | |
"next": "FF77b234c2cd5f9f29db0bb01b8d9fed5c", | |
"uuid": "cf347648-93b1-431a-8dc3-88c9bc4a91b4" | |
} | |
], | |
"sid": "FF9775283f99b0521c9971c50e93af06bd" | |
}, | |
{ | |
"name": "it_was_right", | |
"type": "Message", | |
"properties": { | |
"offset": { | |
"x": 80, | |
"y": 850 | |
}, | |
"body": "Congratulations 🎉🎉 That's right", | |
"from": "{{flow.channel.address}}", | |
"to": "{{contact.channel.address}}", | |
"media_url": null, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"attributes": null | |
}, | |
"transitions": [ | |
{ | |
"event": "sent", | |
"conditions": [], | |
"next": null, | |
"uuid": "ded7ec0d-0751-4595-9e42-34c137e32f20" | |
}, | |
{ | |
"event": "failed", | |
"conditions": [], | |
"next": null, | |
"uuid": "d67e54da-4d5f-4aa5-a587-c131c1a75896" | |
} | |
], | |
"sid": "FF77b234c2cd5f9f29db0bb01b8d9fed5c" | |
}, | |
{ | |
"name": "it_was_not_right", | |
"type": "Message", | |
"properties": { | |
"offset": { | |
"x": -240, | |
"y": 850 | |
}, | |
"body": "Sorry, {{widgets.Choose_a_date.parsed.date}} is a {{widgets.Choose_a_date.parsed.day_of_week}}.", | |
"from": "{{flow.channel.address}}", | |
"to": "{{contact.channel.address}}", | |
"media_url": null, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"attributes": null | |
}, | |
"transitions": [ | |
{ | |
"event": "sent", | |
"conditions": [], | |
"next": null, | |
"uuid": "a1da2bfb-e243-4e66-971a-dd6e509ebc70" | |
}, | |
{ | |
"event": "failed", | |
"conditions": [], | |
"next": null, | |
"uuid": "221ec570-5129-425a-8ccd-605ca1b042d5" | |
} | |
], | |
"sid": "FF9a21aea095cd7831f104b4afb1002961" | |
} | |
] | |
} |
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": "InitialState", | |
"properties": { | |
"offset": { | |
"x": 0, | |
"y": 0 | |
}, | |
"flow_url": "https://webhooks.twilio.com/v1/Accounts/AC69a381fe7d9987b8a2e98ee7c63ea2b5/Flows/FW16d34b41d83a347c3043026ac5d0c06b" | |
}, | |
"transitions": [ | |
{ | |
"event": "incomingMessage", | |
"conditions": [], | |
"next": "FF9f17859c864906eebde3eafd592b8776", | |
"uuid": "48697898-deae-489a-8b0f-91bd39bc7659" | |
}, | |
{ | |
"event": "incomingCall", | |
"conditions": [], | |
"next": null, | |
"uuid": "a1ac047e-af7c-4200-826b-21a6681ce650" | |
}, | |
{ | |
"event": "incomingRequest", | |
"conditions": [], | |
"next": null, | |
"uuid": "9b83e85f-0d81-4365-8eba-569d8054da50" | |
} | |
], | |
"sid": "FF70819d9216a712e28015ca0f2aa78257" | |
}, | |
{ | |
"name": "function_1", | |
"type": "Function", | |
"properties": { | |
"offset": { | |
"x": 100, | |
"y": 160 | |
}, | |
"url": "https://linen-finch-5633.twil.io/date", | |
"timeout": null, | |
"parameters": null, | |
"service_sid": null, | |
"function_sid": null, | |
"environment_sid": null | |
}, | |
"transitions": [ | |
{ | |
"event": "success", | |
"conditions": [], | |
"next": "FFc4c178b3128e8f7c6b876a61775e884c", | |
"uuid": "0f1c9bb7-ad4f-4817-8947-e3ff2e6a7f03" | |
}, | |
{ | |
"event": "fail", | |
"conditions": [], | |
"next": null, | |
"uuid": "ffcfd182-4433-4f0a-9208-7a9c9391262a" | |
} | |
], | |
"sid": "FF9f17859c864906eebde3eafd592b8776" | |
}, | |
{ | |
"name": "send_and_reply_1", | |
"type": "MessagePrompt", | |
"properties": { | |
"offset": { | |
"x": 100, | |
"y": 370 | |
}, | |
"body": "Tell me, what day is {{widgets.function_1.parsed.date}} ?", | |
"from": "{{flow.channel.address}}", | |
"timeout": 3600, | |
"save_response_as": null, | |
"media_url": null, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"attributes": null | |
}, | |
"transitions": [ | |
{ | |
"event": "incomingMessage", | |
"conditions": [], | |
"next": "FFf9e352c10db0642f81074526865f1e0c", | |
"uuid": "51bc1c38-5866-42fe-bfd3-95848787f309" | |
}, | |
{ | |
"event": "timeout", | |
"conditions": [], | |
"next": null, | |
"uuid": "3de8b842-5509-4e4d-8308-1cba2f153ca5" | |
}, | |
{ | |
"event": "deliveryFailure", | |
"conditions": [], | |
"next": null, | |
"uuid": "010d4338-ef66-4cee-9ccf-b79d03dd9652" | |
} | |
], | |
"sid": "FFc4c178b3128e8f7c6b876a61775e884c" | |
}, | |
{ | |
"name": "send_message_1", | |
"type": "Message", | |
"properties": { | |
"offset": { | |
"x": 570, | |
"y": 930 | |
}, | |
"body": "You Got It!", | |
"from": "{{flow.channel.address}}", | |
"to": "{{contact.channel.address}}", | |
"media_url": null, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"attributes": null | |
}, | |
"transitions": [ | |
{ | |
"event": "sent", | |
"conditions": [], | |
"next": null, | |
"uuid": "0d90aef2-e38c-438e-9179-9a7841ccfbe1" | |
}, | |
{ | |
"event": "failed", | |
"conditions": [], | |
"next": null, | |
"uuid": "f1cf605d-d440-45cb-a46c-a335b6d706b6" | |
} | |
], | |
"sid": "FFef245d12a4420358c07c2fa5f3b390e8" | |
}, | |
{ | |
"name": "split_2", | |
"type": "Branch", | |
"properties": { | |
"offset": { | |
"x": 350, | |
"y": 640 | |
}, | |
"input": "{{widgets.send_and_reply_1.inbound.Body}}" | |
}, | |
"transitions": [ | |
{ | |
"event": "noMatch", | |
"conditions": [], | |
"next": "FF5fd335788f63fc61946826a4f3cba17d", | |
"uuid": "5eae3890-38a5-4b0a-87f3-988cb07f3f7f" | |
}, | |
{ | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "correct day", | |
"type": "contains", | |
"arguments": [ | |
"{{widgets.send_and_reply_1.inbound.Body}}" | |
], | |
"value": "{{widgets.function_1.parsed.day_of_week}}" | |
} | |
], | |
"next": "FFef245d12a4420358c07c2fa5f3b390e8", | |
"uuid": "8bf5e7f5-58d1-477c-ba64-03dc5698c086" | |
} | |
], | |
"sid": "FFf9e352c10db0642f81074526865f1e0c" | |
}, | |
{ | |
"name": "send_and_reply_2", | |
"type": "MessagePrompt", | |
"properties": { | |
"offset": { | |
"x": -220, | |
"y": 630 | |
}, | |
"body": "Hmm, that's not it. Try again ({{widgets.function_1.parsed.day_of_week}}) <-- hint", | |
"from": "{{flow.channel.address}}", | |
"timeout": 3600, | |
"save_response_as": null, | |
"media_url": null, | |
"service": "{{trigger.message.InstanceSid}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"attributes": null | |
}, | |
"transitions": [ | |
{ | |
"event": "incomingMessage", | |
"conditions": [], | |
"next": "FF34c8966685721837ee6f57c86f8715aa", | |
"uuid": "d55f59f3-efba-4350-8374-abb2ee818897" | |
}, | |
{ | |
"event": "timeout", | |
"conditions": [], | |
"next": null, | |
"uuid": "015ee8aa-4c31-4ff8-a1d0-a5ed33e01054" | |
}, | |
{ | |
"event": "deliveryFailure", | |
"conditions": [], | |
"next": null, | |
"uuid": "1ee6cac6-9934-4a21-ac44-4c30676d03f3" | |
} | |
], | |
"sid": "FF5fd335788f63fc61946826a4f3cba17d" | |
}, | |
{ | |
"name": "Copy_of_split_2", | |
"type": "Branch", | |
"properties": { | |
"offset": { | |
"x": 100, | |
"y": 920 | |
}, | |
"input": "{{widgets.send_and_reply_2.inbound.Body}}" | |
}, | |
"transitions": [ | |
{ | |
"event": "noMatch", | |
"conditions": [], | |
"next": "FF5fd335788f63fc61946826a4f3cba17d", | |
"uuid": "3abc6f1d-8a70-41be-883d-d10d9f7c09c2" | |
}, | |
{ | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "correct day", | |
"type": "contains", | |
"arguments": [ | |
"{{widgets.send_and_reply_2.inbound.Body}}" | |
], | |
"value": "{{widgets.function_1.parsed.day_of_week}}" | |
} | |
], | |
"next": "FFef245d12a4420358c07c2fa5f3b390e8", | |
"uuid": "2f4554a3-1ad5-474c-8028-a253473493f0" | |
} | |
], | |
"sid": "FF34c8966685721837ee6f57c86f8715aa" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment