Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save allenheltondev/17417cd8b7c35a7dbab2460d681e1cc2 to your computer and use it in GitHub Desktop.
Save allenheltondev/17417cd8b7c35a7dbab2460d681e1cc2 to your computer and use it in GitHub Desktop.
{
"description": "<Your company here>",
"states": [
{
"name": "Trigger",
"type": "InitialState",
"properties": {
"offset": {
"x": 20,
"y": -170
},
"flow_url": "https://webhooks.twilio.com/v1/Accounts/ACb45c80092d13a33dc722f843b44ab4a6/Flows/FW84b7ed21f69d40ea8d1dc1dd41cb47e6"
},
"transitions": [
{
"event": "incomingMessage",
"conditions": [],
"next": "FF2d9702b2eee6a5e9cb44b15185aa45ee",
"uuid": "aba36412-709d-45b4-9b2c-c2b8388155d5"
},
{
"event": "incomingCall",
"conditions": [],
"next": null,
"uuid": "da7c1285-d428-4c43-a6ee-083945e2707a"
},
{
"event": "incomingRequest",
"conditions": [],
"next": null,
"uuid": "58e1774f-77df-4396-bcd2-a9cea593cd52"
}
],
"sid": "FF433bc8df6f128269ddf9b2ee59c13bdd"
},
{
"name": "GetMealChoice",
"type": "MessagePrompt",
"properties": {
"offset": {
"x": -800,
"y": 290
},
"body": "Which meal would you like?\nPlease reply with the number representing the following meals:<Your meal options>",
"from": "{{flow.channel.address}}",
"timeout": 3600,
"save_response_as": null,
"media_url": null,
"service": null,
"channel": null,
"attributes": null
},
"transitions": [
{
"event": "incomingMessage",
"conditions": [],
"next": "FFd5208e673db53b4d92e21ce01a5e9833",
"uuid": "14155b31-0b81-4936-a14f-760539620559"
},
{
"event": "timeout",
"conditions": [],
"next": "FFcd34f669e7ec1507a8b87d597c612b6f",
"uuid": "75613413-533b-48b2-bcef-f2e4200eb9d6"
},
{
"event": "deliveryFailure",
"conditions": [],
"next": null,
"uuid": "e6dd48cc-1b9d-4fe2-adfb-e1daed678412"
}
],
"sid": "FFe995127903a9280720af9e48d68527a2"
},
{
"name": "InitialTimeout",
"type": "MessagePrompt",
"properties": {
"offset": {
"x": 190,
"y": 230
},
"body": "Still hungry? Enter your order and we will put the chef to work! <Your meal options>",
"from": "{{flow.channel.address}}",
"timeout": 3600,
"save_response_as": null,
"media_url": null,
"service": null,
"channel": null,
"attributes": null
},
"transitions": [
{
"event": "incomingMessage",
"conditions": [],
"next": "FFe995127903a9280720af9e48d68527a2",
"uuid": "9485bad4-f51d-4bf3-b5bb-fae14506c57d"
},
{
"event": "timeout",
"conditions": [],
"next": null,
"uuid": "934b2dda-7b34-482a-acdb-510aead97660"
},
{
"event": "deliveryFailure",
"conditions": [],
"next": null,
"uuid": "5494bd3f-43a3-4281-ac48-3a4f178fc8aa"
}
],
"sid": "FFcd34f669e7ec1507a8b87d597c612b6f"
},
{
"name": "VerifyMealChoice",
"type": "Branch",
"properties": {
"offset": {
"x": -420,
"y": 300
},
"input": "{{widgets.GetMealChoice.inbound.Body}}"
},
"transitions": [
{
"event": "noMatch",
"conditions": [],
"next": "FFab4187cbaa005682564aeb1f2c64319f",
"uuid": "fc10521e-111e-406e-bb4a-d5459a81c0fd"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "1,2,3,4",
"type": "matches_any_of",
"arguments": ["{{widgets.GetMealChoice.inbound.Body}}"],
"value": "1, 2, 3, 4"
}
],
"next": "FF7d9f19b96cabb4c1b822a22dbd88f4bc",
"uuid": "fdec89fd-b8fb-4ba0-994b-329bcad4bc19"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "Cancel Order",
"type": "matches_any_of",
"arguments": ["{{widgets.GetMealChoice.inbound.Body}}"],
"value": "stop, Stop, STOP, nevermind, Nevermind, NEVERMIND, cancel, Cancel, CANCEL"
}
],
"next": "FF281c0140da59d64f6847c4d40d115434",
"uuid": "f60e2b08-698d-4e65-8c35-34d7710d4e98"
}
],
"sid": "FFd5208e673db53b4d92e21ce01a5e9833"
},
{
"name": "InvalidMealChoice",
"type": "MessagePrompt",
"properties": {
"offset": {
"x": -1090,
"y": 520
},
"body": "We want to make sure you get the right meal, please make sure to type in a number 1-4.",
"from": "{{flow.channel.address}}",
"timeout": 180,
"save_response_as": null,
"media_url": null,
"service": null,
"channel": null,
"attributes": null
},
"transitions": [
{
"event": "incomingMessage",
"conditions": [],
"next": "FFa83395ef3caf3b46b3d438e530655fd2",
"uuid": "4bf636ba-2322-49ec-8720-3ad1985fb525"
},
{
"event": "timeout",
"conditions": [],
"next": "FF281c0140da59d64f6847c4d40d115434",
"uuid": "2fb3a20f-c931-44a8-a987-07f6fc6bf725"
},
{
"event": "deliveryFailure",
"conditions": [],
"next": null,
"uuid": "32483d8c-78b1-477b-8ec2-8c08b9b16675"
}
],
"sid": "FFab4187cbaa005682564aeb1f2c64319f"
},
{
"name": "split_confirm",
"type": "Branch",
"properties": {
"offset": {
"x": -1090,
"y": 790
},
"input": "{{widgets.InvalidMealChoice.inbound.Body}}"
},
"transitions": [
{
"event": "noMatch",
"conditions": [],
"next": "FFab4187cbaa005682564aeb1f2c64319f",
"uuid": "df126168-0a98-4f87-929b-8a35b1c38bfc"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "1,2,3,4",
"type": "matches_any_of",
"arguments": ["{{widgets.InvalidMealChoice.inbound.Body}}"],
"value": "1,2,3,4"
}
],
"next": "FF5337edd4b3f1de9110706d2aab6795e5",
"uuid": "5f63cf02-7867-4b4f-bbe5-81000ebdc9a5"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "cancel",
"type": "matches_any_of",
"arguments": ["{{widgets.InvalidMealChoice.inbound.Body}}"],
"value": "cancel, Cancel, CANCEL, stop, Stop, STOP, nevermind,Nevermind, NEVERMIND"
}
],
"next": "FF281c0140da59d64f6847c4d40d115434",
"uuid": "1c02ab7d-b096-4a22-bfb1-4345e2b38527"
}
],
"sid": "FFa83395ef3caf3b46b3d438e530655fd2"
},
{
"name": "CancelMessage",
"type": "Message",
"properties": {
"offset": {
"x": 480,
"y": 540
},
"body": "Maybe next time! Remember to stay socially distant!",
"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": "FF7c3657d3614680f1bea601925bd6919b",
"uuid": "851459b7-72a9-437e-8660-a84b062427d4"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "1362c436-0c21-4194-9b09-9a040e81f4b9"
}
],
"sid": "FF281c0140da59d64f6847c4d40d115434"
},
{
"name": "ConfirmNumberOfPeople",
"type": "MessagePrompt",
"properties": {
"offset": {
"x": -280,
"y": 820
},
"body": "How many plates would you like? 1 plate will feed 1 person. \nEnter 2-20.",
"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": "FF42808794a6db2cd28722fbf524d8e545",
"uuid": "56e6c063-f2bf-4169-b502-310953aefe28"
},
{
"event": "timeout",
"conditions": [],
"next": "FF281c0140da59d64f6847c4d40d115434",
"uuid": "29a671c1-fb03-40c4-a73d-29aa38c7dd6f"
},
{
"event": "deliveryFailure",
"conditions": [],
"next": null,
"uuid": "d5ffdf6b-7870-42d9-8f9b-c83280110f7e"
}
],
"sid": "FF7d9f19b96cabb4c1b822a22dbd88f4bc"
},
{
"name": "VerifyNumberOfPeople",
"type": "Branch",
"properties": {
"offset": {
"x": -270,
"y": 1080
},
"input": "{{widgets.ConfirmNumberOfPeople.inbound.Body}}"
},
"transitions": [
{
"event": "noMatch",
"conditions": [],
"next": "FFd3810f8552ed269d7cffa9d3adebdf59",
"uuid": "92ba745c-10cb-494a-a89c-92881fd804c4"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "Cancel",
"type": "matches_any_of",
"arguments": ["{{widgets.ConfirmNumberOfPeople.inbound.Body}}"],
"value": "cancel, Cancel, CANCEL, stop, Stop, STOP, nevermind, Nevermind, NEVERMIND"
}
],
"next": "FF281c0140da59d64f6847c4d40d115434",
"uuid": "c87a33d7-c189-4fe0-8839-b30964b56f85"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "Valid",
"type": "matches_any_of",
"arguments": ["{{widgets.ConfirmNumberOfPeople.inbound.Body}}"],
"value": "2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20"
}
],
"next": "FF747f080c2b96dac55869ec0715f6b96f",
"uuid": "64d7753a-f569-4636-b815-a54b97624d97"
}
],
"sid": "FF42808794a6db2cd28722fbf524d8e545"
},
{
"name": "ConfirmMessage",
"type": "MessagePrompt",
"properties": {
"offset": {
"x": -340,
"y": 1870
},
"body": "Ok! You are at {{flow.variables.numPlates}} plates for a total of ${{flow.variables.totalPrice}}. Would you like to order anything else?\nPlease reply yes or no.",
"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": "FF226e17d5468c91d6d7a148674be78770",
"uuid": "91207b4a-9a69-472c-aefb-95ce23ee3a4f"
},
{
"event": "timeout",
"conditions": [],
"next": "FF281c0140da59d64f6847c4d40d115434",
"uuid": "3f0ad52b-adf7-4a84-96b7-a4d861f36ce3"
},
{
"event": "deliveryFailure",
"conditions": [],
"next": null,
"uuid": "29685da9-d96f-4ffb-9efd-d3aedf150fcc"
}
],
"sid": "FF02c7f0ae5e56783db6a514543d3c7305"
},
{
"name": "ConfirmOrder",
"type": "Branch",
"properties": {
"offset": {
"x": -400,
"y": 2120
},
"input": "{{widgets.ConfirmMessage.inbound.Body}}"
},
"transitions": [
{
"event": "noMatch",
"conditions": [],
"next": "FF9658f343a4f52a2c3b652b9d6aa15ff0",
"uuid": "8804a3e1-f412-4efd-8dd5-f3e695541940"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "Cancel",
"type": "matches_any_of",
"arguments": ["{{widgets.ConfirmMessage.inbound.Body}}"],
"value": "cancel, Cancel, CANCEL, stop, Stop, STOP, nevermind, Nevermind, NEVERMIND"
}
],
"next": "FF281c0140da59d64f6847c4d40d115434",
"uuid": "e5ca8912-25d7-4353-afea-43ff8e4454c5"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "Confirmed",
"type": "matches_any_of",
"arguments": ["{{widgets.ConfirmMessage.inbound.Body}}"],
"value": "yes, Yes, YES"
}
],
"next": "FFe995127903a9280720af9e48d68527a2",
"uuid": "07fceae6-ebc0-4e1b-b967-4c2a891bd432"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "Done Ordering",
"type": "matches_any_of",
"arguments": ["{{widgets.ConfirmMessage.inbound.Body}}"],
"value": "no, No, NO"
}
],
"next": "FF61143ab3df39b351b66cc78e34b9d173",
"uuid": "6b1d8f9e-8758-4a40-a10b-d8dd2b995e5d"
}
],
"sid": "FF226e17d5468c91d6d7a148674be78770"
},
{
"name": "GetNameAndAddress",
"type": "MessagePrompt",
"properties": {
"offset": {
"x": -270,
"y": 2380
},
"body": "Good deal! Can we please have your name and address for delivery?\nEnter: Name, address",
"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": "FF86e0bca75b3eba731ac6eb5ed45bb164",
"uuid": "a31a1e01-26eb-4c60-830c-c6643205189d"
},
{
"event": "timeout",
"conditions": [],
"next": "FF281c0140da59d64f6847c4d40d115434",
"uuid": "5ae59b93-92fb-492f-92fb-c2fa81c4073f"
},
{
"event": "deliveryFailure",
"conditions": [],
"next": null,
"uuid": "6bae3026-350e-49b5-902d-a274ae99adcc"
}
],
"sid": "FF4f55bd108232d96898c9447d96fe1fce"
},
{
"name": "UpdateDeliveryDetails",
"type": "Webhook",
"properties": {
"offset": {
"x": -280,
"y": 2620
},
"method": "POST",
"url": "<Your REST Service>/orders/{{flow.variables.orderId}}/details",
"body": "{\n\"nameAndAddress\": \"{{widgets.GetNameAndAddress.inbound.Body}} \"\n}",
"timeout": null,
"parameters": null,
"save_response_as": null,
"content_type": "application/json;charset=utf-8"
},
"transitions": [
{
"event": "success",
"conditions": [],
"next": "FFd40e05373807a194abffec59500e3b10",
"uuid": "93b998cb-25a8-473c-a969-c83165773852"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "4214d5ac-763c-4816-b9c0-9de2f3945c6b"
}
],
"sid": "FF86e0bca75b3eba731ac6eb5ed45bb164"
},
{
"name": "GetDeliveryDate",
"type": "MessagePrompt",
"properties": {
"offset": {
"x": 230,
"y": 2130
},
"body": "Great! What day would you like your order delivered?\nEnter month/date (i.e. 4/16)",
"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": "FF6e58ebc66f0c80015c05e621ac41cd14",
"uuid": "fc762fd7-70dc-4283-890e-448bd55e1b5e"
},
{
"event": "timeout",
"conditions": [],
"next": null,
"uuid": "38acd808-e077-48c6-8755-14ebac35dce7"
},
{
"event": "deliveryFailure",
"conditions": [],
"next": null,
"uuid": "0bb699d6-b427-44d3-ae74-08f3b280de32"
}
],
"sid": "FF61143ab3df39b351b66cc78e34b9d173"
},
{
"name": "ValidateDeliveryDate",
"type": "Webhook",
"properties": {
"offset": {
"x": 220,
"y": 2540
},
"method": "POST",
"url": "<Your REST Service>/orders/{{flow.variables.orderId}}/delivery",
"body": "{\n\"date\": \"{{widgets.GetDeliveryDate.inbound.Body}}\" \n}",
"timeout": null,
"parameters": null,
"save_response_as": null,
"content_type": "application/json;charset=utf-8"
},
"transitions": [
{
"event": "success",
"conditions": [],
"next": "FFdc341a89cf4ea9be9859a4b84f56e9b7",
"uuid": "09de6e6c-5f4c-49fa-91d8-43c5cda58635"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "f7972290-fbc1-4dc5-a845-0dfeb5bdbf9c"
}
],
"sid": "FFe2b21349b4cfc391082a9dd608833059"
},
{
"name": "ValidDate",
"type": "Branch",
"properties": {
"offset": {
"x": 240,
"y": 2780
},
"input": "{{widgets.ValidateDeliveryDate.body}}"
},
"transitions": [
{
"event": "noMatch",
"conditions": [],
"next": "FFad821504720beda57931d45307720f02",
"uuid": "7220848f-1f7f-41c1-9824-b65a4a6356f6"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "IsValid",
"type": "equal_to",
"arguments": ["{{widgets.ValidateDeliveryDate.body}}"],
"value": "true"
}
],
"next": "FF4f55bd108232d96898c9447d96fe1fce",
"uuid": "641fb12e-c620-43b5-8696-b95bb7f8962e"
}
],
"sid": "FFdc341a89cf4ea9be9859a4b84f56e9b7"
},
{
"name": "GetAlternateDelivery",
"type": "MessagePrompt",
"properties": {
"offset": {
"x": 770,
"y": 2310
},
"body": "We want to make sure we deliver your meal on the right date. You can order between today and one week from now. \nPlease enter a date in the format: month/day",
"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": "FF543c2d52db2b95749a1690729a003a38",
"uuid": "dfe7ab14-f338-4b4f-b307-3f704971a99a"
},
{
"event": "timeout",
"conditions": [],
"next": "FF281c0140da59d64f6847c4d40d115434",
"uuid": "7d1bafec-0722-466c-86bc-89f547fe26a3"
},
{
"event": "deliveryFailure",
"conditions": [],
"next": null,
"uuid": "9ff5cc93-56c2-49fc-9edc-c2b712c5d919"
}
],
"sid": "FFad821504720beda57931d45307720f02"
},
{
"name": "ValidateAlternateDeliveryDate",
"type": "Webhook",
"properties": {
"offset": {
"x": 780,
"y": 2540
},
"method": "POST",
"url": "<Your REST Service>/orders/{{flow.variables.orderId}}/delivery",
"body": "{\n\"date\": \"{{widgets.GetAlternateDelivery.inbound.Body}}\" \n}",
"timeout": null,
"parameters": null,
"save_response_as": null,
"content_type": "application/json;charset=utf-8"
},
"transitions": [
{
"event": "success",
"conditions": [],
"next": "FF842dea554e8c3445174c7d68124440b8",
"uuid": "828bda58-b0bd-4b1b-8fc4-b583da653d76"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "4afc63bc-ac28-4954-99f3-859fb9edb59a"
}
],
"sid": "FF543c2d52db2b95749a1690729a003a38"
},
{
"name": "AlternateDateIsValid",
"type": "Branch",
"properties": {
"offset": {
"x": 720,
"y": 2850
},
"input": "{{widgets.ValidateAlternateDeliveryDate.body}}"
},
"transitions": [
{
"event": "noMatch",
"conditions": [],
"next": "FFad821504720beda57931d45307720f02",
"uuid": "d5cadf5c-65c4-411d-ba61-557d4b5654cf"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "If value equal_to true",
"type": "equal_to",
"arguments": ["{{widgets.ValidateAlternateDeliveryDate.body}}"],
"value": "true"
}
],
"next": "FF4f55bd108232d96898c9447d96fe1fce",
"uuid": "de99fe25-f2a1-49e5-9a22-3f368fbd96cc"
}
],
"sid": "FF842dea554e8c3445174c7d68124440b8"
},
{
"name": "StartOrder",
"type": "Webhook",
"properties": {
"offset": {
"x": -520,
"y": -20
},
"method": "POST",
"url": "<Your REST Service>/orders",
"body": "{\n\"phone\": \"{{trigger.message.From}}\" \n}",
"timeout": null,
"parameters": null,
"save_response_as": null,
"content_type": "application/json;charset=utf-8"
},
"transitions": [
{
"event": "success",
"conditions": [],
"next": "FF30dda88fa96181fdac0f91738702925b",
"uuid": "a3c58324-db45-4c8c-921f-9669536fb230"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "52d6df66-3e8a-441f-a1a0-f868ea51d60b"
}
],
"sid": "FFc6bc6619caa89bea231713b739e94ccf"
},
{
"name": "SetOrderVariables",
"type": "SetVariables",
"properties": {
"offset": {
"x": -890,
"y": -10
},
"variables": [
{
"key": "orderId",
"value": "{{widgets.StartOrder.parsed.orderId}}"
},
{
"key": "confirmationNumber",
"value": "{{widgets.StartOrder.parsed.confirmationNumber}}"
}
]
},
"transitions": [
{
"event": "next",
"conditions": [],
"next": "FFe995127903a9280720af9e48d68527a2",
"uuid": "713a4bf7-4f96-451e-aa63-dbd90f971af3"
}
],
"sid": "FF30dda88fa96181fdac0f91738702925b"
},
{
"name": "AddDish",
"type": "Webhook",
"properties": {
"offset": {
"x": -270,
"y": 1330
},
"method": "POST",
"url": "<Your REST Service>/orders/{{flow.variables.orderId}}/dishes",
"body": "{\n\"mealId\": {{widgets.GetMealChoice.inbound.Body}} ,\n\"number\": {{widgets.ConfirmNumberOfPeople.inbound.Body}} \n}",
"timeout": null,
"parameters": null,
"save_response_as": null,
"content_type": "application/json;charset=utf-8"
},
"transitions": [
{
"event": "success",
"conditions": [],
"next": "FFe46734a61fedb8cfbd63cf7abce3cc7a",
"uuid": "12211b3f-fdfc-40dc-8278-6e99ea5eaec5"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "bbd45340-3ee6-442a-a44b-ec4f5e16ec80"
}
],
"sid": "FF747f080c2b96dac55869ec0715f6b96f"
},
{
"name": "ConfirmInvalidNumberOfPeople",
"type": "MessagePrompt",
"properties": {
"offset": {
"x": -1100,
"y": 1060
},
"body": "Got it. How many plates would you like? 1 plate will feed 1 person. \nEnter 2-20.",
"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": "FFe1283cf4beff25883c3f76a1b6632ef4",
"uuid": "503596ea-7104-4e14-b14f-2e0786ad95a2"
},
{
"event": "timeout",
"conditions": [],
"next": null,
"uuid": "e45d1386-e445-4e73-8c56-34a8b24f1ec2"
},
{
"event": "deliveryFailure",
"conditions": [],
"next": null,
"uuid": "d2cad7bc-af8d-4b72-9b2d-e1e3e06a3ca9"
}
],
"sid": "FF5337edd4b3f1de9110706d2aab6795e5"
},
{
"name": "VerifyInvalidNumberOfPeople",
"type": "Branch",
"properties": {
"offset": {
"x": -1110,
"y": 1330
},
"input": "{{widgets.ConfirmNumberOfPeople.inbound.Body}}"
},
"transitions": [
{
"event": "noMatch",
"conditions": [],
"next": "FF5337edd4b3f1de9110706d2aab6795e5",
"uuid": "3f87238d-defb-42de-81ae-ab7f26c5c44b"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "Cancel",
"type": "matches_any_of",
"arguments": ["{{widgets.ConfirmNumberOfPeople.inbound.Body}}"],
"value": "cancel, Cancel, CANCEL, stop, Stop, STOP, nevermind, Nevermind, NEVERMIND"
}
],
"next": "FF281c0140da59d64f6847c4d40d115434",
"uuid": "b8e832b6-9558-4a84-84c2-ee7fcfae4f09"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "Valid",
"type": "matches_any_of",
"arguments": ["{{widgets.ConfirmNumberOfPeople.inbound.Body}}"],
"value": "2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20"
}
],
"next": "FF2109cf9a0ab9c7add0013d50be273254",
"uuid": "a6e2cf6e-3a6a-4a1c-b5f4-b701e6dd93b0"
}
],
"sid": "FFe1283cf4beff25883c3f76a1b6632ef4"
},
{
"name": "AddInvalidDish",
"type": "Webhook",
"properties": {
"offset": {
"x": -1110,
"y": 1580
},
"method": "POST",
"url": "<Your REST Service>/orders/{{flow.variables.orderId}}/dishes",
"body": "{\n\"mealId\": {{widgets.InvalidMealChoice.inbound.Body}} ,\n\"number\": \"{{widgets.ConfirmInvalidNumberOfPeople.inbound.Body}}\" \n}",
"timeout": null,
"parameters": null,
"save_response_as": null,
"content_type": "application/json;charset=utf-8"
},
"transitions": [
{
"event": "success",
"conditions": [],
"next": "FFfa3248e687879c01bdb6606a878e90cd",
"uuid": "01ba4ed5-8ccf-4c40-b04a-921ad9bae3d8"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "0aac4ca4-5471-49e9-a286-e6335241d73f"
}
],
"sid": "FF2109cf9a0ab9c7add0013d50be273254"
},
{
"name": "CancelOrder",
"type": "Webhook",
"properties": {
"offset": {
"x": 480,
"y": 770
},
"method": "POST",
"url": "<Your REST Service>/orders/{{flow.variables.orderId}}/cancel",
"body": null,
"timeout": null,
"parameters": null,
"save_response_as": null,
"content_type": "application/json;charset=utf-8"
},
"transitions": [
{
"event": "success",
"conditions": [],
"next": null,
"uuid": "93daf531-88a2-421e-8c8a-83244108513f"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "7e930712-8d3f-4cd0-836f-848bcd17cc93"
}
],
"sid": "FF7c3657d3614680f1bea601925bd6919b"
},
{
"name": "SetAddDishVariables",
"type": "SetVariables",
"properties": {
"offset": {
"x": -270,
"y": 1550
},
"variables": [
{
"key": "numPlates",
"value": "{{widgets.AddDish.parsed.numPlates}}",
"index": "0"
},
{
"key": "totalPrice",
"value": "{{widgets.AddDish.parsed.totalPrice}}"
}
]
},
"transitions": [
{
"event": "next",
"conditions": [],
"next": "FF02c7f0ae5e56783db6a514543d3c7305",
"uuid": "2fbab543-d2fd-40ee-af56-25f16d964db5"
}
],
"sid": "FFe46734a61fedb8cfbd63cf7abce3cc7a"
},
{
"name": "SetInvalidAddDishVariables",
"type": "SetVariables",
"properties": {
"offset": {
"x": -1100,
"y": 1800
},
"variables": [
{
"key": "numPlates",
"value": "{{widgets.AddInvalidDish.parsed.numPlates}}",
"index": "0"
},
{
"key": "totalPrice",
"value": "{{widgets.AddInvalidDish.parsed.totalPrice}}",
"index": "1"
}
]
},
"transitions": [
{
"event": "next",
"conditions": [],
"next": "FF02c7f0ae5e56783db6a514543d3c7305",
"uuid": "c124b4cf-46b1-4bda-955f-3ddb750de513"
}
],
"sid": "FFfa3248e687879c01bdb6606a878e90cd"
},
{
"name": "InitialGreeting",
"type": "Message",
"properties": {
"offset": {
"x": 20,
"y": -30
},
"body": "Welcome to the <Your Company Name> automated ordering system. \nAll meals are <Your price> per person, minimum 2 per order.",
"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": "FFc6bc6619caa89bea231713b739e94ccf",
"uuid": "f976be6d-02ef-4d53-94c7-c416e6c978d4"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "1ee98e11-7527-46e2-b894-d092ad1bd925"
}
],
"sid": "FF2d9702b2eee6a5e9cb44b15185aa45ee"
},
{
"name": "SubmitOrder",
"type": "Webhook",
"properties": {
"offset": {
"x": -290,
"y": 2840
},
"method": "POST",
"url": "<Your REST Service>/orders/{{flow.variables.orderId}}/submit",
"body": null,
"timeout": null,
"parameters": null,
"save_response_as": null,
"content_type": "application/json;charset=utf-8"
},
"transitions": [
{
"event": "success",
"conditions": [],
"next": "FF67aeabcbeb1cc5f4b218712d34e16292",
"uuid": "e1e65b27-471f-4ce1-af65-80e58740b6e1"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "6b7e1086-ea76-48d2-961e-d845167ed3fc"
}
],
"sid": "FFd40e05373807a194abffec59500e3b10"
},
{
"name": "SendConfirmationMessage",
"type": "Message",
"properties": {
"offset": {
"x": -293,
"y": 3121
},
"body": "Thank you for your order! Your confirmation number is {{flow.variables.confirmationNumber}}",
"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": "80ae9083-3f44-4f41-9a2c-9f6a0b39a369"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "96e4598b-ae46-4416-8e0a-e9e04af9c408"
}
],
"sid": "FF67aeabcbeb1cc5f4b218712d34e16292"
},
{
"name": "CheckDeliveryDate",
"type": "Branch",
"properties": {
"offset": {
"x": 220,
"y": 2340
},
"input": "{{widgets.GetDeliveryDate.inbound.Body}}"
},
"transitions": [
{
"event": "noMatch",
"conditions": [],
"next": "FFe2b21349b4cfc391082a9dd608833059",
"uuid": "9dd04eed-706d-4cfc-b521-d0bb1513377c"
},
{
"event": "match",
"conditions": [
{
"friendly_name": "Cancel",
"type": "matches_any_of",
"arguments": ["{{widgets.GetDeliveryDate.inbound.Body}}"],
"value": "nevermind, Nevermind, NEVERMIND, stop, Stop, STOP, cancel, Cancel, CANCEL"
}
],
"next": "FF281c0140da59d64f6847c4d40d115434",
"uuid": "f183786e-e117-4cbf-b5ab-c0e628fc51c9"
}
],
"sid": "FF6e58ebc66f0c80015c05e621ac41cd14"
},
{
"name": "SendInvalidMessage",
"type": "Message",
"properties": {
"offset": {
"x": 330,
"y": 1290
},
"body": "That was not a valid number of plates",
"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": "FF7d9f19b96cabb4c1b822a22dbd88f4bc",
"uuid": "820e0001-681d-4daa-978d-96e6ea709c86"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "7e62456a-4e92-431a-8033-36cfe724e3ca"
}
],
"sid": "FFd3810f8552ed269d7cffa9d3adebdf59"
},
{
"name": "ConfirmErrorMessage",
"type": "Message",
"properties": {
"offset": {
"x": -820,
"y": 2130
},
"body": "Sorry, I didn't understand your response.",
"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": "FF02c7f0ae5e56783db6a514543d3c7305",
"uuid": "90f58217-6ff8-4aa6-b385-52c3bc87ba47"
},
{
"event": "failed",
"conditions": [],
"next": null,
"uuid": "4e6320f7-81f6-48e1-98ba-1032f8f848bf"
}
],
"sid": "FF9658f343a4f52a2c3b652b9d6aa15ff0"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment