Last active
September 26, 2019 16:38
-
-
Save Xabadu/8c1634dbcc811a42c14c595c4bac127a to your computer and use it in GitHub Desktop.
Twilio Studio Flow to create SMS based interactions
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": [ | |
{ | |
"type": "InitialState", | |
"name": "Trigger", | |
"properties": { | |
"offset": { | |
"x": -10, | |
"y": 0 | |
}, | |
"flow_url": "https://webhooks.twilio.com/v1/Accounts/AC2335a74ad5fd08ca1030e3d53e1f7ff9/Flows/FWe823d9a8953e5c4f9f1c9066798fb8e3" | |
}, | |
"transitions": [ | |
{ | |
"event": "incomingMessage", | |
"conditions": [], | |
"next": "FF2b1b799d7be91cb161598e68a073e59c", | |
"uuid": "97cbed86-47ec-40d8-9e73-ceaf00b71924" | |
}, | |
{ | |
"event": "incomingCall", | |
"conditions": [], | |
"next": null, | |
"uuid": "45e815b0-2f4f-4256-b2f3-b4d50690d204" | |
}, | |
{ | |
"event": "incomingRequest", | |
"conditions": [], | |
"next": null, | |
"uuid": "3e0300e5-b2dd-4d97-a6ed-49dd34cd173f" | |
} | |
], | |
"sid": "FF6cf7ed89193019a46c5e786b9a1bde84" | |
}, | |
{ | |
"type": "Branch", | |
"name": "MainCTA", | |
"properties": { | |
"offset": { | |
"x": -140, | |
"y": 370 | |
}, | |
"input": "{{trigger.message.Body}}" | |
}, | |
"transitions": [ | |
{ | |
"event": "noMatch", | |
"conditions": [], | |
"next": "FF2941daecae4b62e90ecb8c0df4f42194", | |
"uuid": "10266856-8a37-43a5-8a51-a1b8b88360fd" | |
}, | |
{ | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "If value contains OPTION1", | |
"type": "contains", | |
"arguments": [ | |
"{{trigger.message.Body}}" | |
], | |
"value": "OPTION1" | |
} | |
], | |
"next": "FFd69f30251aac7afa3dec2210a46cb76a", | |
"uuid": "e1c51b05-2b2f-44f9-9d52-989b1c5675d0" | |
}, | |
{ | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "If value contains OPTION2", | |
"type": "contains", | |
"arguments": [ | |
"{{trigger.message.Body}}" | |
], | |
"value": "OPTION2" | |
} | |
], | |
"next": "FFb0afd9b1d8812a7654ab0f9e917f0a38", | |
"uuid": "195fd6c7-c13b-428e-b94b-f32f01215392" | |
}, | |
{ | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "If value contains OPTION3", | |
"type": "contains", | |
"arguments": [ | |
"{{trigger.message.Body}}" | |
], | |
"value": "OPTION3" | |
} | |
], | |
"next": "FF216ed3e1f62fc75175cf9d07bfca55b1", | |
"uuid": "62cac55c-82af-4a55-95d0-2ac5b6916f10" | |
}, | |
{ | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "If value contains OPTION4", | |
"type": "contains", | |
"arguments": [ | |
"{{trigger.message.Body}}" | |
], | |
"value": "OPTION4" | |
} | |
], | |
"next": "FF23c0fca40c9414b6976c2c02389ec5bd", | |
"uuid": "ba2f868a-d245-4121-8391-9066a73595c9" | |
}, | |
{ | |
"event": "match", | |
"conditions": [ | |
{ | |
"friendly_name": "If value contains OPTION5", | |
"type": "contains", | |
"arguments": [ | |
"{{trigger.message.Body}}" | |
], | |
"value": "OPTION5" | |
} | |
], | |
"next": "FFefc410ba74c5b2abcc06fc44b4de418c", | |
"uuid": "a640af19-7ce6-435e-bfba-c6aa851de392" | |
} | |
], | |
"sid": "FF2b1b799d7be91cb161598e68a073e59c" | |
}, | |
{ | |
"type": "Message", | |
"name": "OPTION1", | |
"properties": { | |
"offset": { | |
"x": -230, | |
"y": 780 | |
}, | |
"body": "This is information about Option 1", | |
"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": "FFb190e062e080497afa31f82b127f055f", | |
"uuid": "d471d19d-079b-42b8-8ed7-539c588f3bc9" | |
}, | |
{ | |
"event": "failed", | |
"conditions": [], | |
"next": null, | |
"uuid": "4f7068b8-26dd-4bae-9da7-744686ca98cd" | |
} | |
], | |
"sid": "FFd69f30251aac7afa3dec2210a46cb76a" | |
}, | |
{ | |
"type": "Message", | |
"name": "OPTION2", | |
"properties": { | |
"offset": { | |
"x": 110, | |
"y": 780 | |
}, | |
"body": "This is information about Option 2", | |
"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": "FFb190e062e080497afa31f82b127f055f", | |
"uuid": "b07ed766-009c-4bdc-8ff9-d8cd60762677" | |
}, | |
{ | |
"event": "failed", | |
"conditions": [], | |
"next": null, | |
"uuid": "760c3d4d-8d74-4eae-b3e9-647f5643f9c1" | |
} | |
], | |
"sid": "FFb0afd9b1d8812a7654ab0f9e917f0a38" | |
}, | |
{ | |
"type": "Message", | |
"name": "OPTION3", | |
"properties": { | |
"offset": { | |
"x": 450, | |
"y": 780 | |
}, | |
"body": "This is information about Option 3", | |
"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": "FFb190e062e080497afa31f82b127f055f", | |
"uuid": "18de2c36-23ba-4f6b-9671-844c9694d12b" | |
}, | |
{ | |
"event": "failed", | |
"conditions": [], | |
"next": null, | |
"uuid": "77bdf37e-78f8-4359-a6aa-a7eeea29f11c" | |
} | |
], | |
"sid": "FF216ed3e1f62fc75175cf9d07bfca55b1" | |
}, | |
{ | |
"type": "Message", | |
"name": "OPTION4", | |
"properties": { | |
"offset": { | |
"x": 780, | |
"y": 780 | |
}, | |
"body": "This is information about Option 4", | |
"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": "FFb190e062e080497afa31f82b127f055f", | |
"uuid": "53cc62ce-ba5c-4790-aad9-65985f03aeac" | |
}, | |
{ | |
"event": "failed", | |
"conditions": [], | |
"next": null, | |
"uuid": "2de01cda-4561-4e7b-a145-75734e345606" | |
} | |
], | |
"sid": "FF23c0fca40c9414b6976c2c02389ec5bd" | |
}, | |
{ | |
"type": "Message", | |
"name": "OPTION5", | |
"properties": { | |
"offset": { | |
"x": 1130, | |
"y": 780 | |
}, | |
"body": "This is information about Option 5", | |
"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": "FFb190e062e080497afa31f82b127f055f", | |
"uuid": "3d449c99-5565-4506-81d8-260e970cfc20" | |
}, | |
{ | |
"event": "failed", | |
"conditions": [], | |
"next": null, | |
"uuid": "fe884d0f-2e9d-446b-837c-15a34da8df5d" | |
} | |
], | |
"sid": "FFefc410ba74c5b2abcc06fc44b4de418c" | |
}, | |
{ | |
"type": "Message", | |
"name": "Welcome", | |
"properties": { | |
"offset": { | |
"x": -570, | |
"y": 790 | |
}, | |
"body": "This is your welcome message.\n\nText \"OPTION1\" to receive information about Option 1.\n\nText \"OPTION2\" to receive information about Option 2.\n\nText \"OPTION3\" to receive information about Option 3.\n\nText \"OPTION4\" to receive information about Option 4.\n\nText \"OPTION5\" to receive information about Option 5.", | |
"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": "bc431dab-c619-4cbb-8635-2e8b093137a4" | |
}, | |
{ | |
"event": "failed", | |
"conditions": [], | |
"next": null, | |
"uuid": "7680ae47-9352-44c3-adcb-39567aab4530" | |
} | |
], | |
"sid": "FF2941daecae4b62e90ecb8c0df4f42194" | |
}, | |
{ | |
"type": "SetVariables", | |
"name": "setDestination", | |
"properties": { | |
"offset": { | |
"x": 280, | |
"y": 1490 | |
}, | |
"variables": [ | |
{ | |
"key": "destination", | |
"value": "{% assign input = trigger.message.Body | downcase %}{% if input contains 'option1' %}{% assign res = 'Option 1' %}{% elsif input contains 'option2' %}{% assign res = 'Option 2' %}{% elsif input contains 'option3' %}{% assign res = 'Option 3' %}{% elsif input contains 'option4' %}{% assign res = 'Option 4' %}{% elsif input contains 'option5' %}{% assign res = 'Option 5' %}{% endif %}{{res | strip_newlines}}", | |
"index": "0" | |
} | |
] | |
}, | |
"transitions": [ | |
{ | |
"event": "next", | |
"conditions": [], | |
"next": "FFaa472099dba215adfe583a46a7360c99", | |
"uuid": "f65f2f87-58b3-4bd6-9e71-2ba155d3f279" | |
} | |
], | |
"sid": "FFb796c6b31b7db27338707c75c658cf41" | |
}, | |
{ | |
"type": "Function", | |
"name": "thankYouPause", | |
"properties": { | |
"offset": { | |
"x": 250, | |
"y": 1180 | |
}, | |
"url": "", | |
"timeout": null, | |
"parameters": null | |
}, | |
"transitions": [ | |
{ | |
"event": "success", | |
"conditions": [], | |
"next": "FFb796c6b31b7db27338707c75c658cf41", | |
"uuid": "fee37ab3-7cd0-48cb-b306-54ac7aae1121" | |
}, | |
{ | |
"event": "fail", | |
"conditions": [], | |
"next": "FFb796c6b31b7db27338707c75c658cf41", | |
"uuid": "3e59a7ad-435e-49d7-be56-a3002fc76e62" | |
} | |
], | |
"sid": "FFb190e062e080497afa31f82b127f055f" | |
}, | |
{ | |
"sid": "FFaa472099dba215adfe583a46a7360c99", | |
"name": "thanksMessage", | |
"type": "Message", | |
"properties": { | |
"from": "{{flow.channel.address}}", | |
"to": "{{contact.channel.address}}", | |
"channel": "{{trigger.message.ChannelSid}}", | |
"service": "{{trigger.message.InstanceSid}}", | |
"offset": { | |
"x": 270, | |
"y": 1790 | |
}, | |
"body": "Thank you for your interest in {{ flow.variables.destination}}!" | |
}, | |
"transitions": [ | |
{ | |
"widgetId": "FFaa472099dba215adfe583a46a7360c99", | |
"uuid": "8c729a06-9c10-42c7-af12-280e7ddec334", | |
"event": "sent", | |
"conditions": [], | |
"next": null | |
}, | |
{ | |
"widgetId": "FFaa472099dba215adfe583a46a7360c99", | |
"uuid": "b31535f4-88d5-498a-a14e-ed21db61f8ca", | |
"event": "failed", | |
"conditions": [], | |
"next": null | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment