Last active
August 14, 2023 08:18
-
-
Save bastienbot/909843aa8f52135cee1f80f3e67c89b1 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
start: | |
// If the user doesn't exist, we create a new id using the uuid app | |
if (!user_id) remember user_id = Fn("utils/uuid", version="v4") | |
say "Hi, let's subscribe to an awesome newsletter 💌 !" | |
do Fn("google/analytics", method="sendEvent", params={"user_id": user_id,"category": "csml_nl_chatbot","action": "flow_process","label": "start"}) | |
goto firstname | |
firstname: | |
say "What's your firstname?" | |
hold | |
remember firstname = event | |
do Fn("google/analytics", method="sendEvent", params={"user_id": user_id,"category": "csml_nl_chatbot","action": "flow_process","label": "firstname"}) | |
goto lastname | |
lastname: | |
say "What's your lastname?" | |
hold | |
remember lastname = event | |
do Fn("google/analytics", method="sendEvent", params={"user_id": user_id,"category": "csml_nl_chatbot","action": "flow_process","label": "lastname"}) | |
goto email | |
email: | |
say "What's your email address?" | |
hold | |
if (!event.contains("@")) { | |
say "Please enter a valid email address" | |
goto email | |
} | |
remember email = event | |
do Fn("google/analytics", method="sendEvent", params={"user_id": user_id,"category": "csml_nl_chatbot","action": "flow_process","label": "email"}) | |
goto save | |
save: | |
do Fn("zapier", | |
hook="myhook/myhookid", | |
payload={ | |
"firstname": firstname, | |
"lastname": lastname, | |
"email": email | |
} | |
) | |
say "Ok **{{firstname}} {{lastname}}**, I have registered your email **{{email}}** to our newsletter!" | |
say "Enjoy the great content 🎉" | |
do Fn("google/analytics", method="sendEvent", params={"user_id": user_id,"category": "csml_nl_chatbot","action": "flow_process","label": "end"}) | |
goto end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment