From 02e591fcbdcbc741b4061ca5f4f28a990a12ac5f Mon Sep 17 00:00:00 2001 From: Gerrit Vermeulen Date: Wed, 9 Oct 2024 16:48:54 +0200 Subject: [PATCH 1/7] Prep for push messaging --- .gitignore | 1 - .../flows}/schedule_next_push_message.md | 116 +++++++------- .../flows}/send_next_message_callback.md | 149 +++++++++--------- .../{ => QA/flows}/signup.md | 134 ++++++++-------- .../schedule_next_push_message.json | 1 + .../send_next_message_callback.json | 1 + .../QA/flows_json/signup.json | 1 + .../QA/tests/signup_test.exs | 69 ++++++++ Stage based messaging/stacks_config.yaml | 14 ++ 9 files changed, 298 insertions(+), 188 deletions(-) rename Stage based messaging/{ => QA/flows}/schedule_next_push_message.md (74%) rename Stage based messaging/{ => QA/flows}/send_next_message_callback.md (73%) rename Stage based messaging/{ => QA/flows}/signup.md (69%) create mode 100644 Stage based messaging/QA/flows_json/schedule_next_push_message.json create mode 100644 Stage based messaging/QA/flows_json/send_next_message_callback.json create mode 100644 Stage based messaging/QA/flows_json/signup.json create mode 100644 Stage based messaging/QA/tests/signup_test.exs create mode 100644 Stage based messaging/stacks_config.yaml diff --git a/.gitignore b/.gitignore index d692cd0..0baa544 100644 --- a/.gitignore +++ b/.gitignore @@ -113,7 +113,6 @@ GitHub.sublime-settings # Visual Studio Code # .vscode/* -!.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json diff --git a/Stage based messaging/schedule_next_push_message.md b/Stage based messaging/QA/flows/schedule_next_push_message.md similarity index 74% rename from Stage based messaging/schedule_next_push_message.md rename to Stage based messaging/QA/flows/schedule_next_push_message.md index 9683888..3911dde 100644 --- a/Stage based messaging/schedule_next_push_message.md +++ b/Stage based messaging/QA/flows/schedule_next_push_message.md @@ -1,55 +1,63 @@ - - -| Key | Value | -| ----------------- | ---------------------------------------- | -| contentrepo_token | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | - -This stack schedules the send message callback stack, at the correct time as specified on the current message of the ordered content set. - -It fetches the details from the contentrepo for the user's current content set. - -If there are no more messages in the content set, then it sends the user a message that they've completed the content set. - -It then calculates the timestamp when the next message should be sent, according to the specified contact field and time delta specified in content repo. - - - -```stack -card GetContentSet, then: ScheduleNextMessage do - contentset = - get( - "https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/@contact.push_messaging_content_set/", - headers: [ - ["Authorization", "Token @config.items.contentrepo_token"] - ] - ) -end - -card ScheduleNextMessage - when count(contentset.body.pages) == contact.push_messaging_content_set_position do - text("Content set complete, no more messages") -end - -card ScheduleNextMessage do - page = contentset.body.pages[contact.push_messaging_content_set_position] - contact_field = page.contact_field - - unit = - find( - [["minutes", "m"], ["hours", "h"], ["days", "D"], ["months", "M"]], - &(&1[0] == page.unit) - )[1] - - offset = if(page.before_or_after == "before", page.time * -1, page.time * 1) - - timestamp = datetime_add(contact[contact_field], offset, unit) - # SBM: Schedule message callback - schedule_stack("54e7fe5d-983a-4292-a768-ca2e95466a6a", at: timestamp) - write_result("message_scheduled_at", "@timestamp") -end - +# Stage Based Messaging: Schedule Next Push Message + +This stack schedules the send message callback stack, at the correct time as specified on the current message of the ordered content set. + +It fetches the details from the contentrepo for the user's current content set. + +If there are no more messages in the content set, then it sends the user a message that they've completed the content set. + +It then calculates the timestamp when the next message should be sent, according to the specified contact field and time delta specified in content repo. + +## Configuration + +This Journey requires the `config.contentrepo_token` global variable to be set. + +## Contact fields + +This Journey doesn't use or set any contact fields + +## Flow results + +* message_scheduled_at, when the message is scheduled for + +## Connections to other stacks + +* Schedules the stack to send the next push message + + + +```stack +card GetContentSet, then: ScheduleNextMessage do + contentset = + get( + "https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/@contact.push_messaging_content_set/", + headers: [ + ["Authorization", "Token @global.config.contentrepo_token"] + ] + ) +end + +card ScheduleNextMessage + when count(contentset.body.pages) == contact.push_messaging_content_set_position do + text("Content set complete, no more messages") +end + +card ScheduleNextMessage do + page = contentset.body.pages[contact.push_messaging_content_set_position] + contact_field = page.contact_field + + unit = + find( + [["minutes", "m"], ["hours", "h"], ["days", "D"], ["months", "M"]], + &(&1[0] == page.unit) + )[1] + + offset = if(page.before_or_after == "before", page.time * -1, page.time * 1) + + timestamp = datetime_add(contact[contact_field], offset, unit) + # SBM: Schedule message callback + schedule_stack("8eb4490c-dc45-4c1f-bf10-1a95158ef45f", at: timestamp) + write_result("message_scheduled_at", "@timestamp") +end + ``` \ No newline at end of file diff --git a/Stage based messaging/send_next_message_callback.md b/Stage based messaging/QA/flows/send_next_message_callback.md similarity index 73% rename from Stage based messaging/send_next_message_callback.md rename to Stage based messaging/QA/flows/send_next_message_callback.md index 589fa4e..476cf5f 100644 --- a/Stage based messaging/send_next_message_callback.md +++ b/Stage based messaging/QA/flows/send_next_message_callback.md @@ -1,72 +1,79 @@ - - -| Key | Value | -| ----------------- | ---------------------------------------- | -| contentrepo_token | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | - -This stack fetches the current message for the current message set, as defined in the contact fields. - -It handles the following message types: - -* Template messages. Assumes template message with two variables. Sets the first to the contact's whatsapp profile name, and the second to the literal "Second" -* Text messages. Sends the title, followed by the body, of the whatsapp message, in a single message to the user. - -It then increments the content set position on the contact, and runs the stack that handles scheduling the next message in the message set. - - - -```stack -card GetMessage, then: SendMessage do - contentset = - get( - "https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/@contact.push_messaging_content_set/", - headers: [ - ["Authorization", "Token @config.items.contentrepo_token"] - ] - ) - - contentset_item = contentset.body.pages[contact.push_messaging_content_set_position] - - page = - get( - "https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/pages/@contentset_item.id/", - headers: [ - ["Authorization", "Token @config.items.contentrepo_token"] - ], - query: [["whatsapp", "true"]] - ) -end - -card SendMessage when page.body.body.is_whatsapp_template, then: ScheduleNextMessage do - write_result("template_sent", "@page.body.body.whatsapp_template_name") - - send_message_template("@page.body.body.whatsapp_template_name", "en_US", [ - "@contact.whatsapp_profile_name", - "Second" - ]) -end - -card SendMessage, then: ScheduleNextMessage do - write_result("message_sent", "@page.body.id") - - text(""" - @page.body.title - - @page.body.body.text.value.message - """) -end - -card ScheduleNextMessage do - update_contact( - push_messaging_content_set_position: "@(contact.push_messaging_content_set_position + 1)" - ) - - # SBM: Schedule next push message - run_stack("f7a966e0-2945-455e-a3d2-519b750e20aa") -end - +This stack fetches the current message for the current message set, as defined in the contact fields. + +It handles the following message types: + +* Template messages. Assumes template message with two variables. Sets the first to the contact's whatsapp profile name, and the second to the literal "Second" +* Text messages. Sends the title, followed by the body, of the whatsapp message, in a single message to the user. + +It then increments the content set position on the contact, and runs the stack that handles scheduling the next message in the message set. + +## Configuration + +This Journey requires the `config.contentrepo_token` global variable to be set. + +## Contact fields + +* push_messaging_content_set_position: Start at 0, to always start at the beginning of the message set +* whatsapp_profile_name, used to personalise the template sent to the user + +## Flow results + +* message_sent, The message sent to the user + +## Connections to other stacks + +* Runs the stack to schedule the next push message at the end + + + +```stack +card GetMessage, then: SendMessage do + contentset = + get( + "https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/@contact.push_messaging_content_set/", + headers: [ + ["Authorization", "Token @global.config.contentrepo_token"] + ] + ) + + contentset_item = contentset.body.pages[contact.push_messaging_content_set_position] + + page = + get( + "https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/pages/@contentset_item.id/", + headers: [ + ["Authorization", "Token @global.config.contentrepo_token"] + ], + query: [["whatsapp", "true"]] + ) +end + +card SendMessage when page.body.body.is_whatsapp_template, then: ScheduleNextMessage do + write_result("template_sent", "@page.body.body.whatsapp_template_name") + + send_message_template("@page.body.body.whatsapp_template_name", "en_US", [ + "@contact.whatsapp_profile_name", + "Second" + ]) +end + +card SendMessage, then: ScheduleNextMessage do + write_result("message_sent", "@page.body.id") + + text(""" + @page.body.title + + @page.body.body.text.value.message + """) +end + +card ScheduleNextMessage do + update_contact( + push_messaging_content_set_position: "@(contact.push_messaging_content_set_position + 1)" + ) + + # SBM: Schedule next push message + run_stack("f291b782-72d3-49eb-8434-e47e388c2ea1") +end + ``` \ No newline at end of file diff --git a/Stage based messaging/signup.md b/Stage based messaging/QA/flows/signup.md similarity index 69% rename from Stage based messaging/signup.md rename to Stage based messaging/QA/flows/signup.md index d504ba9..08eb209 100644 --- a/Stage based messaging/signup.md +++ b/Stage based messaging/QA/flows/signup.md @@ -1,63 +1,73 @@ - - -| Key | Value | -| ----------------- | ---------------------------------------- | -| contentrepo_token | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | - -This flow asks the user whether they want to sign up for the testing stage based messaging. - -If they decline, then we exit - -If they accept, then we search the ordered content sets on contentrepo for one called "demo", and store the following values on the contact: - -* push_messaging_signup: The timestamp when the user accepts the sign up -* push_messaging_content_set: The ID of the ordered content set named "demo" -* push_messaging_content_set_position: Start at 0, to always start at the beginning of the message set - - - -```stack -card AskSignup do - buttons(FetchContentSet: "Yes, please", Exit: "No, thank you") do - text(""" - Hi! - - Would you like to sign up to our testing messaging set? - - You will receive 5 messages, one every 5 minutes. - """) - end -end - -card FetchContentSet, then: CompleteSignup do - contentsets = - get( - "https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/", - headers: [ - ["Authorization", "Token @config.items.contentrepo_token"] - ] - ) - - contentset = find(contentsets.body.results, &(&1.name == "demo")) -end - -card CompleteSignup do - write_result("sbm_signup", "@contentset.id") - update_contact(push_messaging_signup: "@now()") - update_contact(push_messaging_content_set: "@contentset.id") - update_contact(push_messaging_content_set_position: 0) - text("Thank you for signing up! You will receive your first message shortly") - # SBM: Schedule next push message - run_stack("f7a966e0-2945-455e-a3d2-519b750e20aa") -end - -card Exit do - write_result("sbm_signup", "no") - text("Thank you! You will not be sent any messages") -end - +# Stage Based Messaging: Signup + +This flow asks the user whether they want to sign up for the testing stage based messaging. + +If they decline, then we exit + +If they accept, then we search the ordered content sets on contentrepo for one called "demo", and store the following values on the contact: + +* push_messaging_signup: The timestamp when the user accepts the sign up +* push_messaging_content_set: The ID of the ordered content set named "demo" +* push_messaging_content_set_position: Start at 0, to always start at the beginning of the message set + +## Configuration + +This Journey requires the `config.contentrepo_token` global variable to be set. + +## Contact fields + +* push_messaging_signup: The timestamp when the user accepts the sign up +* push_messaging_content_set: The ID of the ordered content set named "demo" +* push_messaging_content_set_position: Start at 0, to always start at the beginning of the message set + +## Flow results + +* sbm_signup, whether or not the user signed up for push messages + +## Connections to other stacks + +* Runs the stack to schedule the next push message + + + +```stack +card AskSignup do + buttons(FetchContentSet: "Yes, please", Exit: "No, thank you") do + text(""" + Hi! + + Would you like to sign up to our testing messaging set? + + You will receive 5 messages, one every 5 minutes. + """) + end +end + +card FetchContentSet, then: CompleteSignup do + contentsets = + get( + "https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/", + headers: [ + ["Authorization", "Token @global.config.contentrepo_token"] + ] + ) + + contentset = find(contentsets.body.results, &(&1.name == "demo")) +end + +card CompleteSignup do + write_result("sbm_signup", "@contentset.id") + update_contact(push_messaging_signup: "@now()") + update_contact(push_messaging_content_set: "@contentset.id") + update_contact(push_messaging_content_set_position: 0) + text("Thank you for signing up! You will receive your first message shortly") + # SBM: Schedule next push message + run_stack("f291b782-72d3-49eb-8434-e47e388c2ea1") +end + +card Exit do + write_result("sbm_signup", "no") + text("Thank you! You will not be sent any messages") +end + ``` \ No newline at end of file diff --git a/Stage based messaging/QA/flows_json/schedule_next_push_message.json b/Stage based messaging/QA/flows_json/schedule_next_push_message.json new file mode 100644 index 0000000..8f1cae6 --- /dev/null +++ b/Stage based messaging/QA/flows_json/schedule_next_push_message.json @@ -0,0 +1 @@ +{"name":"odc-schedule-next-push-message","description":"Default description","uuid":"f291b782-72d3-49eb-8434-e47e388c2ea1","resources":[{"values":[{"value":"Content set complete, no more messages","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"e83350e8-d186-4813-8655-b0bd4e61b0f3"}],"uuid":"5cb737f4-a474-45ea-bdfb-9832e0093c0e"}],"flows":[{"label":null,"name":"stack","blocks":[{"label":null,"name":"schedule_next_message_case","type":"Core.Case","config":{},"tags":[],"uuid":"9e4d88f3-c69c-559d-a9fb-c92bccadd905","ui_metadata":{},"exits":[{"default":false,"name":"Exit for schedule_next_message_case_condition_0","config":{},"test":"count(contentset.body.pages) == contact.push_messaging_content_set_position","uuid":"73dceb01-8355-4a8d-87aa-b01fbda1779f","destination_block":"e8dcfb9c-3c9b-5c24-9a70-5e10d845d434","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"Exit for schedule_next_message_case_condition_1","config":{},"test":null,"uuid":"2911399a-bee7-4fa2-816b-28cae623154c","destination_block":"3b542704-3580-507b-9558-f2d5683a8bbb","semantic_label":null,"vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{}},{"label":null,"name":"page","type":"Core.Case","config":{},"tags":[],"uuid":"3b542704-3580-507b-9558-f2d5683a8bbb","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentset.body.pages[contact.push_messaging_content_set_position]","config":{},"test":"","uuid":"ce6477fe-4d9f-4684-aedf-3badb11861de","destination_block":"71e53c09-ff55-566b-b5d6-84297b45fbe9","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"expression":{},"meta":{"column":3,"line":17},"type":"expression"},"index":1}}}}}},{"label":null,"name":"contact_field","type":"Core.Case","config":{},"tags":[],"uuid":"71e53c09-ff55-566b-b5d6-84297b45fbe9","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"page.contact_field","config":{},"test":"","uuid":"d812eae4-1595-455e-b5d0-aac86ae6999d","destination_block":"eeaef0cf-3fb3-564e-8b04-c3a525512ff4","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"expression":{},"meta":{"column":3,"line":18},"type":"expression"},"index":0}}}}}},{"label":null,"name":"unit","type":"Core.Case","config":{},"tags":[],"uuid":"eeaef0cf-3fb3-564e-8b04-c3a525512ff4","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"find([[\"minutes\", \"m\"], [\"hours\", \"h\"], [\"days\", \"D\"], [\"months\", \"M\"]],\n&(&1[0] == page.unit))[1]","config":{},"test":"","uuid":"0e9550f6-c84a-4850-b09f-51fe2f6e83e4","destination_block":"ef95e080-1070-5291-aeed-ee5b54983e2d","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"expression":{},"meta":{"column":3,"line":20},"type":"expression"},"index":0}}}}}},{"label":null,"name":"offset","type":"Core.Case","config":{},"tags":[],"uuid":"ef95e080-1070-5291-aeed-ee5b54983e2d","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"if(page.before_or_after == \"before\", page.time * -1, page.time * 1)","config":{},"test":"","uuid":"2b85ef0f-2297-48bc-a722-a1e4c7a4e565","destination_block":"b97e80e8-0672-582f-8912-cfa06f396c38","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"expression":{},"meta":{"column":3,"line":26},"type":"expression"},"index":0}}}}}},{"label":null,"name":"timestamp","type":"Core.Case","config":{},"tags":[],"uuid":"b97e80e8-0672-582f-8912-cfa06f396c38","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"datetime_add(contact[contact_field], offset, unit)","config":{},"test":"","uuid":"0e77a179-9319-4f10-b5b4-edac58e77574","destination_block":"17555509-92df-5668-8359-34cc78221e7d","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"expression":{},"meta":{"column":3,"line":28},"type":"expression"},"index":0}}}}}},{"label":null,"name":"schedule_next_message_case_condition_1_schedule_stack","type":"Io.Turn.ScheduleFlow","config":{"flow_id":"8eb4490c-dc45-4c1f-bf10-1a95158ef45f","schedule_at":"timestamp"},"tags":[],"uuid":"17555509-92df-5668-8359-34cc78221e7d","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"schedule_next_message_case_condition_1_schedule_stack","config":{},"test":"","uuid":"d50c2b03-2987-435e-a097-2def1ed39454","destination_block":"9d2c50d9-b32e-502a-bb72-77055a88a4f9","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"meta":{"column":3,"line":30},"schedule_stack":{},"type":"schedule_stack"},"index":0}}}}}},{"label":null,"name":"message_scheduled_at","type":"Core.Output","config":{"value":"\"@timestamp\""},"tags":[],"uuid":"9d2c50d9-b32e-502a-bb72-77055a88a4f9","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"message_scheduled_at","config":{},"test":"","uuid":"cabe596a-7256-4ad4-964c-79f6ec5424b3","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"meta":{"column":3,"line":31},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"schedule_next_message_case_condition_0_text","type":"MobilePrimitives.Message","config":{"prompt":"5cb737f4-a474-45ea-bdfb-9832e0093c0e"},"tags":[],"uuid":"e8dcfb9c-3c9b-5c24-9a70-5e10d845d434","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"schedule_next_message_case_condition_0_text","config":{},"test":"","uuid":"d9bce2fe-942b-4264-b634-e984187c57c6","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"count(contentset.body.pages) == contact.push_messaging_content_set_position","meta":{"column":1,"line":11},"name":"ScheduleNextMessage","uuid":"9e4d88f3-c69c-559d-a9fb-c92bccadd905"},"card_item":{"meta":{"column":3,"line":13},"text":{},"type":"text"},"index":0}}}}}},{"label":null,"name":"contentset","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/@contact.push_messaging_content_set/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"13f70cd6-081d-57f6-903c-8562b00f3fb6","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"Default exit to \"ScheduleNextMessage\"","config":{},"test":"","uuid":"eac1f717-448c-4620-bf4e-57b2143ad036","destination_block":"9e4d88f3-c69c-559d-a9fb-c92bccadd905","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":1},"name":"GetContentSet","uuid":"26e7e17c-08a7-5f24-971c-0a542996de11"},"card_item":{"meta":{"column":3,"line":2},"type":"webhook","webhook":{}},"index":0}}}}}}],"last_modified":"2024-10-09T14:43:45.911316Z","uuid":"cce3cb8a-105b-5804-a279-dc3bc15e90bc","languages":[{"id":"e83350e8-d186-4813-8655-b0bd4e61b0f3","label":"English","variant":null,"iso_639_3":"eng","bcp_47":null}],"first_block_id":"13f70cd6-081d-57f6-903c-8562b00f3fb6","interaction_timeout":300,"vendor_metadata":{},"supported_modes":["RICH_MESSAGING"],"exit_block_id":""}],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file diff --git a/Stage based messaging/QA/flows_json/send_next_message_callback.json b/Stage based messaging/QA/flows_json/send_next_message_callback.json new file mode 100644 index 0000000..699fed5 --- /dev/null +++ b/Stage based messaging/QA/flows_json/send_next_message_callback.json @@ -0,0 +1 @@ +{"name":"odc-send-next-message-callback","description":"Default description","uuid":"8eb4490c-dc45-4c1f-bf10-1a95158ef45f","resources":[{"values":[{"value":"@page.body.title\n\n@page.body.body.text.value.message\n","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"35b5e073-c595-4a10-92cc-3a797b138ee8"}],"uuid":"b67bf6c2-b62e-4d2f-8697-25052ecd1a2e"}],"flows":[{"label":null,"name":"stack","blocks":[{"label":null,"name":"contentset","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/@contact.push_messaging_content_set/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"13f70cd6-081d-57f6-903c-8562b00f3fb6","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentset","config":{},"test":"","uuid":"44d7a13a-cbb6-4ea8-8fe2-bd0f4700b849","destination_block":"952eb2a3-039f-539d-ab01-f0836b320e0c","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":1},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"meta":{"column":3,"line":2},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"contentset_item","type":"Core.Case","config":{},"tags":[],"uuid":"952eb2a3-039f-539d-ab01-f0836b320e0c","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentset.body.pages[contact.push_messaging_content_set_position]","config":{},"test":"","uuid":"68b5ef83-cb31-43c2-a7ee-75ef2ac0fbaf","destination_block":"088cd6c4-92f9-58c1-9a8b-bd069be737d9","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":1},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"expression":{},"meta":{"column":3,"line":10},"type":"expression"},"index":0}}}}}},{"label":null,"name":"page","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[["whatsapp","true"]],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/pages/@contentset_item.id/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"088cd6c4-92f9-58c1-9a8b-bd069be737d9","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"Default exit to \"SendMessage\"","config":{},"test":"","uuid":"fe72315d-ea89-4188-96b8-4f7a1ac7f1a8","destination_block":"4a33bb3c-ce05-5ffc-a22a-aedae889d235","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":1},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"meta":{"column":3,"line":12},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"schedule_next_message_contact_update_push_messaging_content_set_position","type":"Core.SetContactProperty","config":{"set_contact_property":{"property_key":"push_messaging_content_set_position","property_value":"@(contact.push_messaging_content_set_position + 1)"}},"tags":[],"uuid":"f8b48d63-17e7-5be1-aeb4-ae59452ea22a","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"schedule_next_message_contact_update_push_messaging_content_set_position","config":{},"test":"","uuid":"a128b7cd-d60a-4d94-b10d-8d20a6999e7c","destination_block":"9f360c2c-2e98-543a-8515-1463951bc4e8","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":41},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"meta":{"column":3,"line":42},"type":"update_contact","update_contact":{}},"index":0}}}}}},{"label":null,"name":"schedule_next_message_run_stack","type":"Core.RunFlow","config":{"flow_id":"f291b782-72d3-49eb-8434-e47e388c2ea1"},"tags":[],"uuid":"9f360c2c-2e98-543a-8515-1463951bc4e8","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"schedule_next_message_run_stack","config":{},"test":"","uuid":"9ec4b824-b640-4801-bfc9-28b0b321dffc","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":41},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"meta":{"column":3,"line":47},"run_stack":{},"type":"run_stack"},"index":0}}}}}},{"label":null,"name":"send_message_case","type":"Core.Case","config":{},"tags":[],"uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235","ui_metadata":{},"exits":[{"default":false,"name":"Exit for send_message_case_condition_0","config":{},"test":"page.body.body.is_whatsapp_template","uuid":"2048ac05-f1b2-4428-b778-412cd113b815","destination_block":"7c4e852a-5293-5fa3-a02e-5f5b6f37d76b","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"Exit for send_message_case_condition_1","config":{},"test":null,"uuid":"12226865-2081-4634-91fa-9bf305183297","destination_block":"373475d1-7f73-5db4-be43-481760e2ce92","semantic_label":null,"vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{}},{"label":null,"name":"message_sent","type":"Core.Output","config":{"value":"\"@page.body.id\""},"tags":[],"uuid":"373475d1-7f73-5db4-be43-481760e2ce92","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"message_sent","config":{},"test":"","uuid":"a276837a-0c31-42b9-8e1e-cff637c5381e","destination_block":"1474d567-3b5b-5b43-a26a-b0da3a20563e","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":31},"name":"SendMessage","uuid":"b2c3e2ca-ba63-5954-bcc6-346d54f6e74e"},"card_item":{"meta":{"column":3,"line":32},"type":"write_result","write_result":{}},"index":1}}}}}},{"label":null,"name":"send_message_case_condition_1_text","type":"MobilePrimitives.Message","config":{"prompt":"b67bf6c2-b62e-4d2f-8697-25052ecd1a2e"},"tags":[],"uuid":"1474d567-3b5b-5b43-a26a-b0da3a20563e","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"Default exit to \"ScheduleNextMessage\"","config":{},"test":"","uuid":"11a6dd5c-595f-4141-a97a-ea3883ccd83a","destination_block":"f8b48d63-17e7-5be1-aeb4-ae59452ea22a","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":31},"name":"SendMessage","uuid":"b2c3e2ca-ba63-5954-bcc6-346d54f6e74e"},"card_item":{"meta":{"column":3,"line":34},"text":{},"type":"text"},"index":0}}}}}},{"label":null,"name":"template_sent","type":"Core.Output","config":{"value":"\"@page.body.body.whatsapp_template_name\""},"tags":[],"uuid":"7c4e852a-5293-5fa3-a02e-5f5b6f37d76b","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"template_sent","config":{},"test":"","uuid":"cd43926c-7b01-4e67-84cc-8665b7d76165","destination_block":"e2a3909b-e829-55a0-b52d-20aaca46f855","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"page.body.body.is_whatsapp_template","meta":{"column":1,"line":22},"name":"SendMessage","uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235"},"card_item":{"meta":{"column":3,"line":23},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"send_message_case_condition_0_whatsapp_template_message","type":"Io.Turn.WhatsAppTemplateMessage","config":{"template":{"name":"\"@page.body.body.whatsapp_template_name\"","components":[{"index":null,"type":"body","parameters":[{"type":"text","text":"\"@contact.whatsapp_profile_name\""},{"type":"text","text":"\"Second\""}],"sub_type":null}],"language":{"code":"\"en_US\""},"tracking":null}},"tags":[],"uuid":"e2a3909b-e829-55a0-b52d-20aaca46f855","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"Default exit to \"ScheduleNextMessage\"","config":{},"test":"","uuid":"de9d7472-b854-4a53-9a83-ca182559cc0a","destination_block":"f8b48d63-17e7-5be1-aeb4-ae59452ea22a","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"page.body.body.is_whatsapp_template","meta":{"column":1,"line":22},"name":"SendMessage","uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235"},"card_item":{"meta":{"column":3,"line":25},"type":"whatsapp_template_message","whatsapp_template_message":{}},"index":0}}}}}}],"last_modified":"2024-10-09T14:34:21.036895Z","uuid":"cd151682-0f27-58a0-a7b3-281620f3513d","languages":[{"id":"35b5e073-c595-4a10-92cc-3a797b138ee8","label":"English","variant":null,"iso_639_3":"eng","bcp_47":null}],"first_block_id":"13f70cd6-081d-57f6-903c-8562b00f3fb6","interaction_timeout":300,"vendor_metadata":{},"supported_modes":["RICH_MESSAGING"],"exit_block_id":""}],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file diff --git a/Stage based messaging/QA/flows_json/signup.json b/Stage based messaging/QA/flows_json/signup.json new file mode 100644 index 0000000..d2286df --- /dev/null +++ b/Stage based messaging/QA/flows_json/signup.json @@ -0,0 +1 @@ +{"name":"odc-signup","description":"Default description","uuid":"ce9d3d33-8760-47fe-a6c2-298991cb5764","resources":[{"values":[{"value":"Thank you for signing up! You will receive your first message shortly","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8dcaf30-67b1-4edf-9f62-409e4666e7d4"}],"uuid":"1576086c-40f3-47e5-91a2-ac71edbf1048"},{"values":[{"value":"Hi!\n\nWould you like to sign up to our testing messaging set?\n\nYou will receive 5 messages, one every 5 minutes.\n","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8dcaf30-67b1-4edf-9f62-409e4666e7d4"}],"uuid":"2d587c85-e8c1-485b-9b6a-36d7944b0031"},{"values":[{"value":"Yes, please","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8dcaf30-67b1-4edf-9f62-409e4666e7d4"}],"uuid":"40521dd8-a865-4efa-a4f7-02c2dba0156c"},{"values":[{"value":"No, thank you","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8dcaf30-67b1-4edf-9f62-409e4666e7d4"}],"uuid":"a5196014-ef27-4f79-88a0-8c3a9e2d0534"},{"values":[{"value":"Thank you! You will not be sent any messages","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8dcaf30-67b1-4edf-9f62-409e4666e7d4"}],"uuid":"71ac4b3f-2a9c-4e70-b24e-9dc095d6ef60"}],"flows":[{"label":null,"name":"stack","blocks":[{"label":null,"name":"sbm_signup","type":"Core.Output","config":{"value":"\"@contentset.id\""},"tags":[],"uuid":"59c38606-7bd9-5030-869b-e41e3394814b","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"sbm_signup","config":{},"test":"","uuid":"fdda0206-ab68-4be2-8e54-e4cf03c0b17a","destination_block":"e3cf31d2-4870-50d8-b01a-d26d42a0e55f","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":25},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":26},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"complete_signup_contact_update_push_messaging_signup","type":"Core.SetContactProperty","config":{"set_contact_property":{"property_key":"push_messaging_signup","property_value":"@now()"}},"tags":[],"uuid":"e3cf31d2-4870-50d8-b01a-d26d42a0e55f","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_contact_update_push_messaging_signup","config":{},"test":"","uuid":"8693b4cd-b36b-4365-9ac1-7fdb0ecbaa9a","destination_block":"8b3ebbb1-b672-526a-82d5-07a4c4ec5d91","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":25},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":27},"type":"update_contact","update_contact":{}},"index":0}}}}}},{"label":null,"name":"complete_signup_contact_update_push_messaging_content_set","type":"Core.SetContactProperty","config":{"set_contact_property":{"property_key":"push_messaging_content_set","property_value":"@contentset.id"}},"tags":[],"uuid":"8b3ebbb1-b672-526a-82d5-07a4c4ec5d91","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_contact_update_push_messaging_content_set","config":{},"test":"","uuid":"a5c98b42-eb5f-4977-a2c5-dab5e22480cd","destination_block":"f00341ec-ee66-586c-952c-4535b6ce1b4b","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":25},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":28},"type":"update_contact","update_contact":{}},"index":0}}}}}},{"label":null,"name":"complete_signup_contact_update_push_messaging_content_set_position","type":"Core.SetContactProperty","config":{"set_contact_property":{"property_key":"push_messaging_content_set_position","property_value":0}},"tags":[],"uuid":"f00341ec-ee66-586c-952c-4535b6ce1b4b","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_contact_update_push_messaging_content_set_position","config":{},"test":"","uuid":"6ebb7580-71c2-4dba-bfca-3c2f05c462fd","destination_block":"6738d34e-e262-5bcf-a1e2-cd6a2014d89f","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":25},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":29},"type":"update_contact","update_contact":{}},"index":0}}}}}},{"label":null,"name":"complete_signup_text","type":"MobilePrimitives.Message","config":{"prompt":"1576086c-40f3-47e5-91a2-ac71edbf1048"},"tags":[],"uuid":"6738d34e-e262-5bcf-a1e2-cd6a2014d89f","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_text","config":{},"test":"","uuid":"48a2e846-685e-4964-acfb-f9c7313581fd","destination_block":"13395c42-8d9a-5c78-bd2a-594d96281210","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":25},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":30},"text":{},"type":"text"},"index":0}}}}}},{"label":null,"name":"complete_signup_run_stack","type":"Core.RunFlow","config":{"flow_id":"f291b782-72d3-49eb-8434-e47e388c2ea1"},"tags":[],"uuid":"13395c42-8d9a-5c78-bd2a-594d96281210","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_run_stack","config":{},"test":"","uuid":"edc2613d-a512-4d38-976e-87b54b2261dc","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":25},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":32},"run_stack":{},"type":"run_stack"},"index":0}}}}}},{"label":null,"name":"contentsets","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"8a9d592c-78fe-51c6-b606-6cfe0ae61532","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets","config":{},"test":"","uuid":"2a0fc4cb-2201-4560-82f7-fdb2f1629839","destination_block":"39a6a669-d465-5cbf-9486-a7ad9903ade3","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":13},"name":"FetchContentSet","uuid":"92819633-e996-5604-98ba-cba44404a436"},"card_item":{"meta":{"column":3,"line":14},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"contentset","type":"Core.Case","config":{},"tags":[],"uuid":"39a6a669-d465-5cbf-9486-a7ad9903ade3","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"find(contentsets.body.results, &(&1.name == \"demo\"))","config":{},"test":"","uuid":"5404687e-7750-4aee-b290-3494f1fc8752","destination_block":"59c38606-7bd9-5030-869b-e41e3394814b","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":13},"name":"FetchContentSet","uuid":"92819633-e996-5604-98ba-cba44404a436"},"card_item":{"expression":{},"meta":{"column":3,"line":22},"type":"expression"},"index":0}}}}}},{"label":null,"name":"ask_signup","type":"MobilePrimitives.SelectOneResponse","config":{"prompt":"2d587c85-e8c1-485b-9b6a-36d7944b0031","choices":[{"name":"fetch_content_set","prompt":"40521dd8-a865-4efa-a4f7-02c2dba0156c","test":"block.response = \"Yes, please\""},{"name":"exit","prompt":"a5196014-ef27-4f79-88a0-8c3a9e2d0534","test":"block.response = \"No, thank you\""}]},"tags":[],"uuid":"a66f9ab6-6df0-5346-8a85-ab464aa255ae","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":null,"name":"fetch_content_set","config":{},"test":"block.value = \"fetch_content_set\"","uuid":"d55a3d08-9038-4f78-a26b-313010183a2a","destination_block":"8a9d592c-78fe-51c6-b606-6cfe0ae61532","semantic_label":null,"vendor_metadata":{}},{"default":null,"name":"exit","config":{},"test":"block.value = \"exit\"","uuid":"3a84ec34-db5c-48bc-856d-4fcf7722d75a","destination_block":"9b1a8746-f34d-5e14-981d-8ebb7c4b0cd9","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"ask_signup","config":{},"test":"","uuid":"81acf5fa-5dc3-46d3-bfc3-e706d4919731","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"buttons_metadata":{},"card":{"condition":null,"meta":{"column":1,"line":1},"name":"AskSignup","uuid":"cfb4f4a6-6310-525f-a473-bc5b6eda1dc2"},"card_item":{"button_block":{},"meta":{"column":3,"line":2},"type":"button_block"},"index":0}}}}}},{"label":null,"name":"sbm_signup","type":"Core.Output","config":{"value":"\"no\""},"tags":[],"uuid":"9b1a8746-f34d-5e14-981d-8ebb7c4b0cd9","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"sbm_signup","config":{},"test":"","uuid":"197e656c-245d-4496-848a-3f705391607a","destination_block":"8826940e-f002-5b02-a070-76edf4d06773","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":35},"name":"Exit","uuid":"eddf05c3-f6d4-5ba8-ab1a-e317ec59b710"},"card_item":{"meta":{"column":3,"line":36},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"exit_text","type":"MobilePrimitives.Message","config":{"prompt":"71ac4b3f-2a9c-4e70-b24e-9dc095d6ef60"},"tags":[],"uuid":"8826940e-f002-5b02-a070-76edf4d06773","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"exit_text","config":{},"test":"","uuid":"37e79d02-d069-4530-88f5-8a85daee98bf","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":35},"name":"Exit","uuid":"eddf05c3-f6d4-5ba8-ab1a-e317ec59b710"},"card_item":{"meta":{"column":3,"line":37},"text":{},"type":"text"},"index":0}}}}}}],"last_modified":"2024-10-09T14:35:54.649919Z","uuid":"4803777a-bf6a-53e4-acae-4d5cdb5f47b7","languages":[{"id":"a8dcaf30-67b1-4edf-9f62-409e4666e7d4","label":"English","variant":null,"iso_639_3":"eng","bcp_47":null}],"first_block_id":"a66f9ab6-6df0-5346-8a85-ab464aa255ae","interaction_timeout":300,"vendor_metadata":{},"supported_modes":["RICH_MESSAGING"],"exit_block_id":""}],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file diff --git a/Stage based messaging/QA/tests/signup_test.exs b/Stage based messaging/QA/tests/signup_test.exs new file mode 100644 index 0000000..f93c77f --- /dev/null +++ b/Stage based messaging/QA/tests/signup_test.exs @@ -0,0 +1,69 @@ +defmodule SignupTest do + use FlowTester.Case + use FakeCMS + + alias FlowTester.WebhookHandler, as: WH + + defp flow_path(flow_name), do: Path.join([__DIR__, "..", "flows_json", flow_name <> ".json"]) + + def setup_fake_cms(auth_token) do + # Start the handler. + wh_pid = start_link_supervised!({FakeCMS, %FakeCMS.Config{auth_token: auth_token}}) + + topic1_index = %Index{slug: "topic-1", title: "Topic 1"} + + leaf_page = %ContentPage{ + parent: "topic-1", + slug: "leaf-page-1", + title: "Leaf Page 1", + wa_messages: [ + %WAMsg{ + message: "Test leaf content page", + buttons: [%Btn.Next{title: "Next"}] + }, + %WAMsg{ + message: "Last message" + } + ] + } + + assert :ok = + FakeCMS.add_pages(wh_pid, [ + topic1_index, + leaf_page, + ]) + + assert :ok = FakeCMS.add_images(wh_pid, [image]) + + # Return the adapter. + FakeCMS.wh_adapter(wh_pid) + end + + defp fake_cms(step, base_url, auth_token), + do: WH.set_adapter(step, base_url, setup_fake_cms(auth_token)) + + defp setup_contact_fields(context) do + context |> FlowTester.set_contact_properties(%{"gender" => ""}) + end + + defp setup_flow() do + auth_token = "testtoken" + + flow_path("signup") + |> FlowTester.from_json!() + |> fake_cms("https://content-repo-api-qa.prk-k8s.prd-p6t.org/", auth_token) + |> FlowTester.set_global_dict("config", %{"contentrepo_token" => auth_token}) + |> setup_contact_fields() + end + + describe "stage based messaging signup" do + test "show menu of index pages when starting the flow" do + setup_flow() + |> FlowTester.start() + |> receive_message(%{ + text: "*How can I help you today?*\n-----\nSelect the topic that you're interested in.\n", + list: {"Select topic", [{"Topic 1", "Topic 1"}, {"Media Topic", "Media Topic"}]} + }) + end + end +end diff --git a/Stage based messaging/stacks_config.yaml b/Stage based messaging/stacks_config.yaml new file mode 100644 index 0000000..1853d14 --- /dev/null +++ b/Stage based messaging/stacks_config.yaml @@ -0,0 +1,14 @@ +urls: + - name: contentrepo + qa_url: https://content-repo-api-qa.prk-k8s.prd-p6t.org + prod_url: https://platform-mnch-contentrepo.prk-k8s.prd-p6t.org +stack_uuids: +- name: signup + qa_uuid: ce9d3d33-8760-47fe-a6c2-298991cb5764 + prod_uuid: todo +- name: schedule_next_push_message + qa_uuid: f291b782-72d3-49eb-8434-e47e388c2ea1 + prod_uuid: todo +- name: send_next_message_callback + qa_uuid: 8eb4490c-dc45-4c1f-bf10-1a95158ef45f + prod_uuid: todo From e8f0d01e082df8ec78bee53a9b051e87e4e51af4 Mon Sep 17 00:00:00 2001 From: Gerrit Vermeulen Date: Thu, 17 Oct 2024 14:09:28 +0200 Subject: [PATCH 2/7] Add signup and send_next_message flows. TODO: Tests --- Push messaging/QA/flows/send_next_message.md | 96 +++++++++++ Push messaging/QA/flows/signup.md | 69 ++++++++ .../QA/flows_json/send_next_message.json | 1 + Push messaging/QA/flows_json/signup.json | 1 + Push messaging/QA/tests/signup_test.exs | 149 ++++++++++++++++++ Push messaging/stacks_config.yaml | 15 ++ .../QA/tests/signup_test.exs | 69 -------- 7 files changed, 331 insertions(+), 69 deletions(-) create mode 100644 Push messaging/QA/flows/send_next_message.md create mode 100644 Push messaging/QA/flows/signup.md create mode 100644 Push messaging/QA/flows_json/send_next_message.json create mode 100644 Push messaging/QA/flows_json/signup.json create mode 100644 Push messaging/QA/tests/signup_test.exs create mode 100644 Push messaging/stacks_config.yaml delete mode 100644 Stage based messaging/QA/tests/signup_test.exs diff --git a/Push messaging/QA/flows/send_next_message.md b/Push messaging/QA/flows/send_next_message.md new file mode 100644 index 0000000..a47656f --- /dev/null +++ b/Push messaging/QA/flows/send_next_message.md @@ -0,0 +1,96 @@ +```stack + # One trigger for each message that needs to be sent in OCS + + trigger(interval: "+5m", relative_to: "contact.push_messaging_signup") + trigger(interval: "+10m", relative_to: "contact.push_messaging_signup") + +``` + +This stack fetches the message to be sent based on the difference between the current time and the signup time. + +It handles the following message types: + +* Template messages. Assumes template message with two variables. Sets the first to the contact's whatsapp profile name, and the second to the literal "Second" +* Text messages. Sends the title, followed by the body, of the whatsapp message, in a single message to the user. + +It then increments the content set position on the contact, and runs the stack that handles scheduling the next message in the message set. + +## Configuration + +This Journey requires the `config.contentrepo_token` global variable to be set. + +This Journey also requires configuration for "gender", "age", and/or "relationship" which is used to fetch the correct Ordered Content Set. + +## Contact fields + +* push_messaging_scheduled_at, when the next message is scheduled to be sent. The name of this contact field should be changed according to the implementation, otherwise all the push messages will overwrite each other's scheduled times. +* whatsapp_profile_name, used to personalise the template sent to the user + +## Flow results + +* template_sent, which message template was sent +* message_sent, the message sent to the user + +## Connections to other stacks + +This Journey does not link to any other Journeys + +```stack +card DetermineMessage when contact.push_messaging_signup >= datetime_add(now(), 5, "m") and contact.push_messaging_signup < datetime_add(now(), 10, "m"), then: GetMessage do + # send first message + push_messaging_content_set_position = 0 +end + +# Add your other conditions here + +card DetermineMessage, then: GetMessage do + # send second message + push_messaging_content_set_position = 1 +end +``` + +```stack +card GetMessage, then: SendMessage do + contentsets = + get( + "https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/", + headers: [ + ["Authorization", "Token @global.config.contentrepo_token"] + ], + query: [["gender", "@config.gender"], ["age", "@config.age"], ["relationship", "@config.relationship"]] + ) + + contentset = contentsets.body.results[0] + + contentset_item = contentset.body.pages[push_messaging_content_set_position] + + page = + get( + "https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/pages/@contentset_item.id/", + headers: [ + ["Authorization", "Token @global.config.contentrepo_token"] + ], + query: [["whatsapp", "true"]] + ) +end + +card SendMessage when page.body.body.is_whatsapp_template do + write_result("template_sent", "@page.body.body.whatsapp_template_name") + + send_message_template("@page.body.body.whatsapp_template_name", "en_US", [ + "@contact.whatsapp_profile_name", + "Second" + ]) +end + +card SendMessage do + write_result("message_sent", "@page.body.id") + + text(""" + @page.body.title + + @page.body.body.text.value.message + """) +end + +``` \ No newline at end of file diff --git a/Push messaging/QA/flows/signup.md b/Push messaging/QA/flows/signup.md new file mode 100644 index 0000000..ebe95e2 --- /dev/null +++ b/Push messaging/QA/flows/signup.md @@ -0,0 +1,69 @@ +# Push Messaging: Signup + +This flow asks the user whether they want to sign up for the testing push messaging. + +If they decline, then we exit + +If they accept, then we search the ordered content sets on contentrepo for the one with the profile fields specified in the config. + +## Configuration + +This Journey requires the `config.contentrepo_token` global variable to be set. + +This Journey also requires configuration for "gender", "age", and/or "relationship" which is used to fetch the correct Ordered Content Set. + +## Contact fields + +* push_messaging_signup, the time when they signed up for push messages + +## Flow results + +* push_messaging_signup, the id of the content set that the user signed up for, or no if they didn't sign up + +## Connections to other stacks + +This Journey does not link to any other Journeys + +```stack +card AskSignup do + buttons(FetchContentSet: "Yes, please", Exit: "No, thank you") do + text(""" + Hi! + + Would you like to sign up to our testing messaging set? + + You will receive 5 messages, one every 5 minutes. + """) + end +end + +card FetchContentSet, then: CompleteSignup do + contentsets = + get( + "https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/", + headers: [ + ["Authorization", "Token @global.config.contentrepo_token"] + ], + query: [ + ["gender", "@config.gender"], + ["age", "@config.age"], + ["relationship", "@config.relationship"] + ] + ) + + contentset = contentsets.body.results[0] +end + +card CompleteSignup do + signup_time = now() + update_contact(push_messaging_signup: "@signup_time") + write_result("push_messaging_signup", "@contentset.id") + text("Thank you for signing up! You will receive your first message shortly") +end + +card Exit do + write_result("push_messaging_signup", "no") + text("Thank you! You will not be sent any messages.") +end + +``` \ No newline at end of file diff --git a/Push messaging/QA/flows_json/send_next_message.json b/Push messaging/QA/flows_json/send_next_message.json new file mode 100644 index 0000000..52784f6 --- /dev/null +++ b/Push messaging/QA/flows_json/send_next_message.json @@ -0,0 +1 @@ +{"name":"pm-send-next-message","description":"Default description","uuid":"55b1690d-a546-4d33-912c-7f2b83665ef0","resources":[],"flows":[],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file diff --git a/Push messaging/QA/flows_json/signup.json b/Push messaging/QA/flows_json/signup.json new file mode 100644 index 0000000..6e006d6 --- /dev/null +++ b/Push messaging/QA/flows_json/signup.json @@ -0,0 +1 @@ +{"name":"pm-signup","description":"Default description","uuid":"ec6311dc-6447-4701-9c35-7e4a26ec6c3f","resources":[{"values":[{"value":"Thank you for signing up! You will receive your first message shortly","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8cdf511-03cf-4315-84f6-29091c48e320"}],"uuid":"9234f123-d3c0-4773-8a79-5d262f086a9b"},{"values":[{"value":"Hi!\n\nWould you like to sign up to our testing messaging set?\n\nYou will receive 5 messages, one every 5 minutes.\n","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8cdf511-03cf-4315-84f6-29091c48e320"}],"uuid":"d89faa92-1fe5-42a8-ab05-9b325ee4ee6b"},{"values":[{"value":"Yes, please","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8cdf511-03cf-4315-84f6-29091c48e320"}],"uuid":"beabbd10-5225-4f9e-8f17-a2b60ca56a09"},{"values":[{"value":"No, thank you","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8cdf511-03cf-4315-84f6-29091c48e320"}],"uuid":"0976a748-8606-4538-9394-a0a011fcec57"},{"values":[{"value":"Thank you! You will not be sent any messages.","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8cdf511-03cf-4315-84f6-29091c48e320"}],"uuid":"c2970897-2309-4716-8106-76aa02812f53"}],"flows":[{"label":null,"name":"stack","blocks":[{"label":null,"name":"signup_time","type":"Core.Case","config":{},"tags":[],"uuid":"8c3a9347-333a-51dd-b02f-38f652dbfd6c","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"now()","config":{},"test":"","uuid":"7d355f72-6b35-4e35-81ff-857ddb142ed6","destination_block":"0a30b02f-7ca8-578a-8847-ba76093420f0","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":30},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"expression":{},"meta":{"column":3,"line":31},"type":"expression"},"index":0}}}}}},{"label":null,"name":"complete_signup_contact_update_push_messaging_signup","type":"Core.SetContactProperty","config":{"set_contact_property":{"property_key":"push_messaging_signup","property_value":"@signup_time"}},"tags":[],"uuid":"0a30b02f-7ca8-578a-8847-ba76093420f0","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_contact_update_push_messaging_signup","config":{},"test":"","uuid":"00d19ffc-3dfc-4b96-9cec-7c8bb98dfb6f","destination_block":"1cd04018-728c-5838-95fc-997677eabedb","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":30},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":32},"type":"update_contact","update_contact":{}},"index":0}}}}}},{"label":null,"name":"push_messaging_signup","type":"Core.Output","config":{"value":"\"@contentset.id\""},"tags":[],"uuid":"1cd04018-728c-5838-95fc-997677eabedb","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"push_messaging_signup","config":{},"test":"","uuid":"6914d376-bb56-4001-8c5f-352040d2afbd","destination_block":"1474d567-3b5b-5b43-a26a-b0da3a20563e","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":30},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":33},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"complete_signup_text","type":"MobilePrimitives.Message","config":{"prompt":"9234f123-d3c0-4773-8a79-5d262f086a9b"},"tags":[],"uuid":"1474d567-3b5b-5b43-a26a-b0da3a20563e","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_text","config":{},"test":"","uuid":"7b1a89f2-f557-4d3f-b257-81b0730964fb","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":30},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":34},"text":{},"type":"text"},"index":0}}}}}},{"label":null,"name":"contentsets","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[["gender","@config.gender"],["age","@config.age"],["relationship","@config.relationship"]],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"8a9d592c-78fe-51c6-b606-6cfe0ae61532","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets","config":{},"test":"","uuid":"5182424b-a74a-4e83-8355-a1df21d64f2b","destination_block":"9b5f468c-de1e-54f0-a04b-db1c3551c16c","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":13},"name":"FetchContentSet","uuid":"92819633-e996-5604-98ba-cba44404a436"},"card_item":{"meta":{"column":3,"line":14},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"contentset","type":"Core.Case","config":{},"tags":[],"uuid":"9b5f468c-de1e-54f0-a04b-db1c3551c16c","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets.body.results[0]","config":{},"test":"","uuid":"f25d2e17-168a-40f4-ae23-ecd40ae69e9c","destination_block":"8c3a9347-333a-51dd-b02f-38f652dbfd6c","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":13},"name":"FetchContentSet","uuid":"92819633-e996-5604-98ba-cba44404a436"},"card_item":{"expression":{},"meta":{"column":3,"line":27},"type":"expression"},"index":0}}}}}},{"label":null,"name":"ask_signup","type":"MobilePrimitives.SelectOneResponse","config":{"prompt":"d89faa92-1fe5-42a8-ab05-9b325ee4ee6b","choices":[{"name":"fetch_content_set","prompt":"beabbd10-5225-4f9e-8f17-a2b60ca56a09","test":"block.response = \"Yes, please\""},{"name":"exit","prompt":"0976a748-8606-4538-9394-a0a011fcec57","test":"block.response = \"No, thank you\""}]},"tags":[],"uuid":"a66f9ab6-6df0-5346-8a85-ab464aa255ae","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":null,"name":"fetch_content_set","config":{},"test":"block.value = \"fetch_content_set\"","uuid":"bfa226c8-980b-4712-9b57-794dd2bb4490","destination_block":"8a9d592c-78fe-51c6-b606-6cfe0ae61532","semantic_label":null,"vendor_metadata":{}},{"default":null,"name":"exit","config":{},"test":"block.value = \"exit\"","uuid":"b205cc07-af41-4584-a108-662cc0c0fea8","destination_block":"f73d5e2f-8a8a-5a03-81e7-2d45760098c2","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"ask_signup","config":{},"test":"","uuid":"a998219f-e25b-43f1-842d-17c7e309c903","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"buttons_metadata":{},"card":{"condition":null,"meta":{"column":1,"line":1},"name":"AskSignup","uuid":"cfb4f4a6-6310-525f-a473-bc5b6eda1dc2"},"card_item":{"button_block":{},"meta":{"column":3,"line":2},"type":"button_block"},"index":0}}}}}},{"label":null,"name":"push_messaging_signup","type":"Core.Output","config":{"value":"\"no\""},"tags":[],"uuid":"f73d5e2f-8a8a-5a03-81e7-2d45760098c2","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"push_messaging_signup","config":{},"test":"","uuid":"2656d443-22e0-4fb9-bc57-42d6f2e71fb0","destination_block":"10963182-6b29-5516-91cc-d2dde6537555","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":37},"name":"Exit","uuid":"eddf05c3-f6d4-5ba8-ab1a-e317ec59b710"},"card_item":{"meta":{"column":3,"line":38},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"exit_text","type":"MobilePrimitives.Message","config":{"prompt":"c2970897-2309-4716-8106-76aa02812f53"},"tags":[],"uuid":"10963182-6b29-5516-91cc-d2dde6537555","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"exit_text","config":{},"test":"","uuid":"89373d44-b2a7-452b-a83d-aa7de148d172","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":37},"name":"Exit","uuid":"eddf05c3-f6d4-5ba8-ab1a-e317ec59b710"},"card_item":{"meta":{"column":3,"line":39},"text":{},"type":"text"},"index":0}}}}}}],"last_modified":"2024-10-14T10:37:15.767122Z","uuid":"6db00ef4-1fbe-572e-aaf5-ca314ca81c79","languages":[{"id":"a8cdf511-03cf-4315-84f6-29091c48e320","label":"English","variant":null,"iso_639_3":"eng","bcp_47":null}],"first_block_id":"a66f9ab6-6df0-5346-8a85-ab464aa255ae","interaction_timeout":300,"vendor_metadata":{},"supported_modes":["RICH_MESSAGING"],"exit_block_id":""}],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file diff --git a/Push messaging/QA/tests/signup_test.exs b/Push messaging/QA/tests/signup_test.exs new file mode 100644 index 0000000..91dfa4f --- /dev/null +++ b/Push messaging/QA/tests/signup_test.exs @@ -0,0 +1,149 @@ +defmodule SignupTest do + use FlowTester.Case + use FakeCMS + + alias FlowTester.WebhookHandler, as: WH + + defp flow_path(flow_name), do: Path.join([__DIR__, "..", "flows_json", flow_name <> ".json"]) + + def setup_fake_cms(auth_token) do + # Start the handler. + wh_pid = start_link_supervised!({FakeCMS, %FakeCMS.Config{auth_token: auth_token}}) + + topic1_index = %Index{slug: "topic-1", title: "Topic 1"} + + leaf_page = %ContentPage{ + parent: "topic-1", + slug: "leaf-page-1", + title: "Leaf Page 1", + wa_messages: [ + %WAMsg{ + message: "Test leaf content page", + buttons: [%Btn.Next{title: "Next"}] + }, + %WAMsg{ + message: "Last message" + } + ] + } + + leaf_page2 = %ContentPage{ + parent: "topic-1", + slug: "leaf-page-2", + title: "Leaf Page 2", + wa_messages: [ + %WAMsg{ + message: "Test leaf content page 2", + buttons: [%Btn.Next{title: "Next"}] + }, + %WAMsg{ + message: "Last message" + } + ] + } + + ocs1 = %OrderedContentSet{ + id: 1, + name: "Test Ordered Content Set", + profile_fields: [%ProfileField{name: "relationship", value: "single"}], + pages: [ + %OrderedContentSetPage{ + contentpage_id: 2, + time: 1, + unit: "day", + before_or_after: "before", + contact_field: "edd" + } + ] + } + + ocs2 = %OrderedContentSet{ + id: 2, + name: "Test Ordered Content Set 2", + profile_fields: [%ProfileField{name: "relationship", value: "it's complicated"}], + pages: [ + %OrderedContentSetPage{ + contentpage_id: 3, + time: 5, + unit: "minutes", + before_or_after: "after", + contact_field: "edd" + } + ] + } + + assert :ok = + FakeCMS.add_pages(wh_pid, [ + topic1_index, + leaf_page, + leaf_page2 + ]) + + assert :ok = + FakeCMS.add_ordered_content_sets(wh_pid, [ + ocs1, + ocs2 + ]) + + # Return the adapter. + FakeCMS.wh_adapter(wh_pid) + end + + defp fake_cms(step, base_url, auth_token), + do: WH.set_adapter(step, base_url, setup_fake_cms(auth_token)) + + defp setup_contact_fields(context) do + context |> FlowTester.set_contact_properties(%{"gender" => "", "age" => "", "relationship" => ""}) + end + + defp setup_flow() do + auth_token = "testtoken" + + flow_path("signup") + |> FlowTester.from_json!() + |> fake_cms("https://content-repo-api-qa.prk-k8s.prd-p6t.org/", auth_token) + |> FlowTester.set_global_dict("config", %{"contentrepo_token" => auth_token}) + |> setup_contact_fields() + end + + describe "push messaging signup" do + test "AskSignup" do + setup_flow() + |> FlowTester.start() + |> receive_message(%{ + text: + "Hi!\n\nWould you like to sign up to our testing messaging set?\n\nYou will receive 5 messages, one every 5 minutes.\n", + buttons: [{"Yes, please", "Yes, please"}, {"No, thank you", "No, thank you"}] + }) + end + + test "AskSignup -> Exit" do + setup_flow() + |> FlowTester.start() + |> receive_message(%{}) + |> FlowTester.send("No, thank you") + |> receive_message(%{ + text: "Thank you! You will not be sent any messages." + }) + |> result_matches(%{name: "push_messaging_signup", value: "no"}) + |> flow_finished() + end + + test "AskSignup -> CompleteSignup" do + fake_time = ~U[2023-02-28 00:00:00Z] + string_fake_time = DateTime.to_iso8601(fake_time) + + setup_flow() + |> FlowTester.set_fake_time(fake_time) + |> FlowTester.start() + |> receive_message(%{}) + |> FlowTester.send("Yes, please") + |> receive_message(%{ + text: "Thank you for signing up! You will receive your first message shortly" + }) + |> contact_matches(%{"push_messaging_signup" => ^string_fake_time}) + |> result_matches(%{name: "push_messaging_signup", value: "contentset_id"}) + |> flow_finished() + end + end +end diff --git a/Push messaging/stacks_config.yaml b/Push messaging/stacks_config.yaml new file mode 100644 index 0000000..44470e1 --- /dev/null +++ b/Push messaging/stacks_config.yaml @@ -0,0 +1,15 @@ +base_url: https://whatsapp.turn.io/ +prod_dir: Prod +qa_dir: QA +stack_uuids: +- name: signup + qa_uuid: ec6311dc-6447-4701-9c35-7e4a26ec6c3f + prod_uuid: todo +- name: send_next_message + qa_uuid: 55b1690d-a546-4d33-912c-7f2b83665ef0 + prod_uuid: todo +tokens: [] +urls: +- name: contentrepo + prod_url: https://platform-mnch-contentrepo.prk-k8s.prd-p6t.org + qa_url: https://content-repo-api-qa.prk-k8s.prd-p6t.org diff --git a/Stage based messaging/QA/tests/signup_test.exs b/Stage based messaging/QA/tests/signup_test.exs deleted file mode 100644 index f93c77f..0000000 --- a/Stage based messaging/QA/tests/signup_test.exs +++ /dev/null @@ -1,69 +0,0 @@ -defmodule SignupTest do - use FlowTester.Case - use FakeCMS - - alias FlowTester.WebhookHandler, as: WH - - defp flow_path(flow_name), do: Path.join([__DIR__, "..", "flows_json", flow_name <> ".json"]) - - def setup_fake_cms(auth_token) do - # Start the handler. - wh_pid = start_link_supervised!({FakeCMS, %FakeCMS.Config{auth_token: auth_token}}) - - topic1_index = %Index{slug: "topic-1", title: "Topic 1"} - - leaf_page = %ContentPage{ - parent: "topic-1", - slug: "leaf-page-1", - title: "Leaf Page 1", - wa_messages: [ - %WAMsg{ - message: "Test leaf content page", - buttons: [%Btn.Next{title: "Next"}] - }, - %WAMsg{ - message: "Last message" - } - ] - } - - assert :ok = - FakeCMS.add_pages(wh_pid, [ - topic1_index, - leaf_page, - ]) - - assert :ok = FakeCMS.add_images(wh_pid, [image]) - - # Return the adapter. - FakeCMS.wh_adapter(wh_pid) - end - - defp fake_cms(step, base_url, auth_token), - do: WH.set_adapter(step, base_url, setup_fake_cms(auth_token)) - - defp setup_contact_fields(context) do - context |> FlowTester.set_contact_properties(%{"gender" => ""}) - end - - defp setup_flow() do - auth_token = "testtoken" - - flow_path("signup") - |> FlowTester.from_json!() - |> fake_cms("https://content-repo-api-qa.prk-k8s.prd-p6t.org/", auth_token) - |> FlowTester.set_global_dict("config", %{"contentrepo_token" => auth_token}) - |> setup_contact_fields() - end - - describe "stage based messaging signup" do - test "show menu of index pages when starting the flow" do - setup_flow() - |> FlowTester.start() - |> receive_message(%{ - text: "*How can I help you today?*\n-----\nSelect the topic that you're interested in.\n", - list: {"Select topic", [{"Topic 1", "Topic 1"}, {"Media Topic", "Media Topic"}]} - }) - end - end -end From cd789bcbeb529a52372b6128d0e7438b1f4f0c27 Mon Sep 17 00:00:00 2001 From: Gerrit Vermeulen Date: Mon, 21 Oct 2024 12:37:07 +0200 Subject: [PATCH 3/7] Add send next message test --- .github/workflows/test.yaml | 6 +- Push messaging/QA/flows/send_next_message.md | 28 +++- Push messaging/QA/flows/signup.md | 6 +- .../QA/flows_json/send_next_message.json | 2 +- Push messaging/QA/flows_json/signup.json | 2 +- .../QA/tests/send_next_message_test.exs | 132 ++++++++++++++++++ Push messaging/QA/tests/signup_test.exs | 5 +- 7 files changed, 164 insertions(+), 17 deletions(-) create mode 100644 Push messaging/QA/tests/send_next_message_test.exs diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8f9ccf4..2754a3b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,10 +20,10 @@ jobs: uses: actions/checkout@v4 with: repository: praekeltfoundation/flow_tester - ref: v0.3.3 + ref: v0.3.5 path: flow_tester ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Check formatting - run: mix format --check-formatted "Browsable FAQs/QA/tests/*.exs" + run: mix format --check-formatted "Browsable FAQs/QA/tests/*.exs" "Push messaging/QA/tests/*.exs" - name: Test flows - run: ./flow_tester/run_flow_tests.exs "Browsable FAQs/QA/tests/" \ No newline at end of file + run: ./flow_tester/run_flow_tests.exs "Browsable FAQs/QA/tests/" "Push messaging/QA/tests/" \ No newline at end of file diff --git a/Push messaging/QA/flows/send_next_message.md b/Push messaging/QA/flows/send_next_message.md index a47656f..6dccfb6 100644 --- a/Push messaging/QA/flows/send_next_message.md +++ b/Push messaging/QA/flows/send_next_message.md @@ -1,8 +1,8 @@ ```stack - # One trigger for each message that needs to be sent in OCS +# One trigger for each message that needs to be sent in OCS - trigger(interval: "+5m", relative_to: "contact.push_messaging_signup") - trigger(interval: "+10m", relative_to: "contact.push_messaging_signup") +trigger(interval: "+5m", relative_to: "contact.push_messaging_signup") +trigger(interval: "+10m", relative_to: "contact.push_messaging_signup") ``` @@ -23,7 +23,7 @@ This Journey also requires configuration for "gender", "age", and/or "relationsh ## Contact fields -* push_messaging_scheduled_at, when the next message is scheduled to be sent. The name of this contact field should be changed according to the implementation, otherwise all the push messages will overwrite each other's scheduled times. +* push_messaging_signup, the time the user signed up for these messages. The name of this contact field should be changed according to the implementation, otherwise all the push messages will overwrite each other's scheduled times. * whatsapp_profile_name, used to personalise the template sent to the user ## Flow results @@ -35,8 +35,15 @@ This Journey also requires configuration for "gender", "age", and/or "relationsh This Journey does not link to any other Journeys +## Determine message + +This block figures out which message to send to the user based on the difference between the current time plus the trigger time, and when the user signed up. This way if we update CMS with a new message then the correct sequence is still followed for users partway through. + ```stack -card DetermineMessage when contact.push_messaging_signup >= datetime_add(now(), 5, "m") and contact.push_messaging_signup < datetime_add(now(), 10, "m"), then: GetMessage do +card DetermineMessage + when now() >= datetime_add(contact.push_messaging_signup, 5, "m") and + now() < datetime_add(contact.push_messaging_signup, 10, "m"), + then: GetMessage do # send first message push_messaging_content_set_position = 0 end @@ -47,6 +54,7 @@ card DetermineMessage, then: GetMessage do # send second message push_messaging_content_set_position = 1 end + ``` ```stack @@ -57,12 +65,16 @@ card GetMessage, then: SendMessage do headers: [ ["Authorization", "Token @global.config.contentrepo_token"] ], - query: [["gender", "@config.gender"], ["age", "@config.age"], ["relationship", "@config.relationship"]] + query: [ + ["gender", "@contact.gender"], + ["age", "@contact.age"], + ["relationship", "@contact.relationship"] + ] ) contentset = contentsets.body.results[0] - contentset_item = contentset.body.pages[push_messaging_content_set_position] + contentset_item = contentset.pages[push_messaging_content_set_position] page = get( @@ -72,6 +84,8 @@ card GetMessage, then: SendMessage do ], query: [["whatsapp", "true"]] ) + + log("page @page") end card SendMessage when page.body.body.is_whatsapp_template do diff --git a/Push messaging/QA/flows/signup.md b/Push messaging/QA/flows/signup.md index ebe95e2..e461e31 100644 --- a/Push messaging/QA/flows/signup.md +++ b/Push messaging/QA/flows/signup.md @@ -45,9 +45,9 @@ card FetchContentSet, then: CompleteSignup do ["Authorization", "Token @global.config.contentrepo_token"] ], query: [ - ["gender", "@config.gender"], - ["age", "@config.age"], - ["relationship", "@config.relationship"] + ["gender", "@contact.gender"], + ["age", "@contact.age"], + ["relationship", "@contact.relationship"] ] ) diff --git a/Push messaging/QA/flows_json/send_next_message.json b/Push messaging/QA/flows_json/send_next_message.json index 52784f6..14724f6 100644 --- a/Push messaging/QA/flows_json/send_next_message.json +++ b/Push messaging/QA/flows_json/send_next_message.json @@ -1 +1 @@ -{"name":"pm-send-next-message","description":"Default description","uuid":"55b1690d-a546-4d33-912c-7f2b83665ef0","resources":[],"flows":[],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file +{"name":"pm-send-next-message","description":"Default description","uuid":"55b1690d-a546-4d33-912c-7f2b83665ef0","resources":[{"values":[{"value":"contentset @contentset","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"b262996b-9f64-420e-9e07-941370649939"}],"uuid":"558854d1-b10d-43e0-821e-98e24c856808"},{"values":[{"value":"contentset_item @contentset_item","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"b262996b-9f64-420e-9e07-941370649939"}],"uuid":"ea1eb830-0692-4f04-848c-84ce4cbe1860"},{"values":[{"value":"page @page","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"b262996b-9f64-420e-9e07-941370649939"}],"uuid":"4cf38c39-840f-4570-b68c-d0b5c7178230"},{"values":[{"value":"@page.body.title\n\n@page.body.body.text.value.message\n","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"b262996b-9f64-420e-9e07-941370649939"}],"uuid":"2869d711-a603-460d-a455-31e4e86580b4"}],"flows":[{"label":null,"name":"stack","blocks":[{"label":null,"name":"contentsets","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[["gender","@contact.gender"],["age","@contact.age"],["relationship","@contact.relationship"]],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"dbac9ec2-01d2-508f-a240-35a681f9c520","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets","config":{},"test":"","uuid":"5deb4d32-5756-41ca-a86a-b61c683990b5","destination_block":"3c894579-86e8-5648-9c68-408ebc9e6ef5","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"meta":{"column":3,"line":22},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"contentset","type":"Core.Case","config":{},"tags":[],"uuid":"3c894579-86e8-5648-9c68-408ebc9e6ef5","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets.body.results[0]","config":{},"test":"","uuid":"beffe596-12c7-46d7-86c2-0330bfdde493","destination_block":"25131a36-ab31-5cf0-b17e-ac6ea41d0263","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"expression":{},"meta":{"column":3,"line":35},"type":"expression"},"index":0}}}}}},{"label":null,"name":"get_message_log","type":"Core.Log","config":{"message":"558854d1-b10d-43e0-821e-98e24c856808"},"tags":[],"uuid":"25131a36-ab31-5cf0-b17e-ac6ea41d0263","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"get_message_log","config":{},"test":"","uuid":"d0a930be-5340-4ee9-b495-56244e94791c","destination_block":"85a0770f-f213-5c97-8ba8-85baa0289540","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"log":{},"meta":{"column":3,"line":37},"type":"log"},"index":0}}}}}},{"label":null,"name":"contentset_item","type":"Core.Case","config":{},"tags":[],"uuid":"85a0770f-f213-5c97-8ba8-85baa0289540","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentset.pages[push_messaging_content_set_position]","config":{},"test":"","uuid":"03be7d0a-aa93-4018-8046-b7511a0e5c81","destination_block":"e616d211-01d4-5f07-ba39-84be6af786db","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"expression":{},"meta":{"column":3,"line":39},"type":"expression"},"index":0}}}}}},{"label":null,"name":"get_message_log","type":"Core.Log","config":{"message":"ea1eb830-0692-4f04-848c-84ce4cbe1860"},"tags":[],"uuid":"e616d211-01d4-5f07-ba39-84be6af786db","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"get_message_log","config":{},"test":"","uuid":"10d8e744-d0cb-4ebd-8d0e-8bb8186e4805","destination_block":"0648433f-e886-5484-b0f2-97ed39940c33","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"log":{},"meta":{"column":3,"line":41},"type":"log"},"index":0}}}}}},{"label":null,"name":"page","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[["whatsapp","true"]],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/pages/@contentset_item.id/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"0648433f-e886-5484-b0f2-97ed39940c33","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"page","config":{},"test":"","uuid":"fb0da4b0-e205-4339-b452-c22c12ba02a9","destination_block":"a70063f3-22c2-55b5-ad1c-e19d34739d9d","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"meta":{"column":3,"line":43},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"get_message_log","type":"Core.Log","config":{"message":"4cf38c39-840f-4570-b68c-d0b5c7178230"},"tags":[],"uuid":"a70063f3-22c2-55b5-ad1c-e19d34739d9d","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"Default exit to \"SendMessage\"","config":{},"test":"","uuid":"d72c19cc-c803-479b-8ddd-b7334b5abd7a","destination_block":"4a33bb3c-ce05-5ffc-a22a-aedae889d235","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"log":{},"meta":{"column":3,"line":52},"type":"log"},"index":0}}}}}},{"label":null,"name":"determine_message_case","type":"Core.Case","config":{},"tags":[],"uuid":"bf5bcec3-e178-5b01-b978-15752029ab5a","ui_metadata":{},"exits":[{"default":false,"name":"Exit for determine_message_case_condition_0","config":{},"test":"and(now() >= datetime_add(contact.push_messaging_signup, 5, \"m\"), now() < datetime_add(contact.push_messaging_signup, 10, \"m\"))","uuid":"11a51081-3b57-40bc-aa73-9c806e465a9d","destination_block":"b7a96e2c-5091-5f8b-8baa-b25f461d5c0c","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"Exit for determine_message_case_condition_1","config":{},"test":null,"uuid":"ef4b09ef-a0f5-4131-a327-56e94598b949","destination_block":"0bc54330-8f14-52f5-a7a6-d232c81e6ba4","semantic_label":null,"vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{}},{"label":null,"name":"push_messaging_content_set_position","type":"Core.Case","config":{},"tags":[],"uuid":"0bc54330-8f14-52f5-a7a6-d232c81e6ba4","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"1","config":{},"test":"","uuid":"f6bea62c-98de-49d3-a415-15356e125847","destination_block":"dbac9ec2-01d2-508f-a240-35a681f9c520","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"DetermineMessage","uuid":"59296584-a983-57eb-ad8e-77b3bc994dee"},"card_item":{"literal":{},"meta":{"column":3,"line":18},"type":"literal"},"index":1}}}}}},{"label":null,"name":"push_messaging_content_set_position","type":"Core.Case","config":{},"tags":[],"uuid":"b7a96e2c-5091-5f8b-8baa-b25f461d5c0c","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"0","config":{},"test":"","uuid":"cd3b9eb7-cff5-41ca-b273-6856963c2697","destination_block":"dbac9ec2-01d2-508f-a240-35a681f9c520","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"now() >= datetime_add(contact.push_messaging_signup, 5, \"m\") and now() < datetime_add(contact.push_messaging_signup, 10, \"m\")","meta":{"column":1,"line":6},"name":"DetermineMessage","uuid":"bf5bcec3-e178-5b01-b978-15752029ab5a"},"card_item":{"literal":{},"meta":{"column":3,"line":11},"type":"literal"},"index":0}}}}}},{"label":null,"name":"send_message_case","type":"Core.Case","config":{},"tags":[],"uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235","ui_metadata":{},"exits":[{"default":false,"name":"Exit for send_message_case_condition_0","config":{},"test":"page.body.body.is_whatsapp_template","uuid":"dbee2250-426c-47fb-91a4-069988624784","destination_block":"d6a6bacc-b77a-5d5f-a0b8-6928b890d0c9","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"Exit for send_message_case_condition_1","config":{},"test":null,"uuid":"1841b226-3c87-4294-8a75-e3bd839cfc15","destination_block":"706ac53f-c36d-5a29-af9d-2fd4a5fd9321","semantic_label":null,"vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{}},{"label":null,"name":"message_sent","type":"Core.Output","config":{"value":"\"@page.body.id\""},"tags":[],"uuid":"706ac53f-c36d-5a29-af9d-2fd4a5fd9321","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"message_sent","config":{},"test":"","uuid":"fcc5968a-5b91-4b1a-99c4-6a65a5e42403","destination_block":"31147028-1d40-5e89-845a-327a0ea1835e","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":64},"name":"SendMessage","uuid":"b2c3e2ca-ba63-5954-bcc6-346d54f6e74e"},"card_item":{"meta":{"column":3,"line":65},"type":"write_result","write_result":{}},"index":1}}}}}},{"label":null,"name":"send_message_case_condition_1_text","type":"MobilePrimitives.Message","config":{"prompt":"2869d711-a603-460d-a455-31e4e86580b4"},"tags":[],"uuid":"31147028-1d40-5e89-845a-327a0ea1835e","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"send_message_case_condition_1_text","config":{},"test":"","uuid":"1cf89d88-02e0-444c-8828-c9779c133d33","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":64},"name":"SendMessage","uuid":"b2c3e2ca-ba63-5954-bcc6-346d54f6e74e"},"card_item":{"meta":{"column":3,"line":67},"text":{},"type":"text"},"index":0}}}}}},{"label":null,"name":"template_sent","type":"Core.Output","config":{"value":"\"@page.body.body.whatsapp_template_name\""},"tags":[],"uuid":"d6a6bacc-b77a-5d5f-a0b8-6928b890d0c9","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"template_sent","config":{},"test":"","uuid":"ae7901c7-dd65-4e02-9761-51130e6b2703","destination_block":"9f52cd8a-61bf-5105-8b62-26046e7a6902","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"page.body.body.is_whatsapp_template","meta":{"column":1,"line":55},"name":"SendMessage","uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235"},"card_item":{"meta":{"column":3,"line":56},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"send_message_case_condition_0_whatsapp_template_message","type":"Io.Turn.WhatsAppTemplateMessage","config":{"template":{"name":"\"@page.body.body.whatsapp_template_name\"","language":{"code":"\"en_US\""},"components":[{"index":null,"type":"body","parameters":[{"type":"text","text":"\"@contact.whatsapp_profile_name\""},{"type":"text","text":"\"Second\""}],"sub_type":null}],"tracking":null}},"tags":[],"uuid":"9f52cd8a-61bf-5105-8b62-26046e7a6902","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"send_message_case_condition_0_whatsapp_template_message","config":{},"test":"","uuid":"81eb8384-5e80-4138-8222-15b2c2927971","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"page.body.body.is_whatsapp_template","meta":{"column":1,"line":55},"name":"SendMessage","uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235"},"card_item":{"meta":{"column":3,"line":58},"type":"whatsapp_template_message","whatsapp_template_message":{}},"index":0}}}}}}],"last_modified":"2024-10-17T14:34:53.741200Z","uuid":"cd151682-0f27-58a0-a7b3-281620f3513d","languages":[{"id":"b262996b-9f64-420e-9e07-941370649939","label":"English","variant":null,"iso_639_3":"eng","bcp_47":null}],"first_block_id":"bf5bcec3-e178-5b01-b978-15752029ab5a","interaction_timeout":300,"vendor_metadata":{},"supported_modes":["RICH_MESSAGING"],"exit_block_id":""}],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file diff --git a/Push messaging/QA/flows_json/signup.json b/Push messaging/QA/flows_json/signup.json index 6e006d6..7421b81 100644 --- a/Push messaging/QA/flows_json/signup.json +++ b/Push messaging/QA/flows_json/signup.json @@ -1 +1 @@ -{"name":"pm-signup","description":"Default description","uuid":"ec6311dc-6447-4701-9c35-7e4a26ec6c3f","resources":[{"values":[{"value":"Thank you for signing up! You will receive your first message shortly","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8cdf511-03cf-4315-84f6-29091c48e320"}],"uuid":"9234f123-d3c0-4773-8a79-5d262f086a9b"},{"values":[{"value":"Hi!\n\nWould you like to sign up to our testing messaging set?\n\nYou will receive 5 messages, one every 5 minutes.\n","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8cdf511-03cf-4315-84f6-29091c48e320"}],"uuid":"d89faa92-1fe5-42a8-ab05-9b325ee4ee6b"},{"values":[{"value":"Yes, please","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8cdf511-03cf-4315-84f6-29091c48e320"}],"uuid":"beabbd10-5225-4f9e-8f17-a2b60ca56a09"},{"values":[{"value":"No, thank you","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8cdf511-03cf-4315-84f6-29091c48e320"}],"uuid":"0976a748-8606-4538-9394-a0a011fcec57"},{"values":[{"value":"Thank you! You will not be sent any messages.","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8cdf511-03cf-4315-84f6-29091c48e320"}],"uuid":"c2970897-2309-4716-8106-76aa02812f53"}],"flows":[{"label":null,"name":"stack","blocks":[{"label":null,"name":"signup_time","type":"Core.Case","config":{},"tags":[],"uuid":"8c3a9347-333a-51dd-b02f-38f652dbfd6c","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"now()","config":{},"test":"","uuid":"7d355f72-6b35-4e35-81ff-857ddb142ed6","destination_block":"0a30b02f-7ca8-578a-8847-ba76093420f0","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":30},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"expression":{},"meta":{"column":3,"line":31},"type":"expression"},"index":0}}}}}},{"label":null,"name":"complete_signup_contact_update_push_messaging_signup","type":"Core.SetContactProperty","config":{"set_contact_property":{"property_key":"push_messaging_signup","property_value":"@signup_time"}},"tags":[],"uuid":"0a30b02f-7ca8-578a-8847-ba76093420f0","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_contact_update_push_messaging_signup","config":{},"test":"","uuid":"00d19ffc-3dfc-4b96-9cec-7c8bb98dfb6f","destination_block":"1cd04018-728c-5838-95fc-997677eabedb","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":30},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":32},"type":"update_contact","update_contact":{}},"index":0}}}}}},{"label":null,"name":"push_messaging_signup","type":"Core.Output","config":{"value":"\"@contentset.id\""},"tags":[],"uuid":"1cd04018-728c-5838-95fc-997677eabedb","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"push_messaging_signup","config":{},"test":"","uuid":"6914d376-bb56-4001-8c5f-352040d2afbd","destination_block":"1474d567-3b5b-5b43-a26a-b0da3a20563e","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":30},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":33},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"complete_signup_text","type":"MobilePrimitives.Message","config":{"prompt":"9234f123-d3c0-4773-8a79-5d262f086a9b"},"tags":[],"uuid":"1474d567-3b5b-5b43-a26a-b0da3a20563e","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_text","config":{},"test":"","uuid":"7b1a89f2-f557-4d3f-b257-81b0730964fb","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":30},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":34},"text":{},"type":"text"},"index":0}}}}}},{"label":null,"name":"contentsets","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[["gender","@config.gender"],["age","@config.age"],["relationship","@config.relationship"]],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"8a9d592c-78fe-51c6-b606-6cfe0ae61532","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets","config":{},"test":"","uuid":"5182424b-a74a-4e83-8355-a1df21d64f2b","destination_block":"9b5f468c-de1e-54f0-a04b-db1c3551c16c","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":13},"name":"FetchContentSet","uuid":"92819633-e996-5604-98ba-cba44404a436"},"card_item":{"meta":{"column":3,"line":14},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"contentset","type":"Core.Case","config":{},"tags":[],"uuid":"9b5f468c-de1e-54f0-a04b-db1c3551c16c","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets.body.results[0]","config":{},"test":"","uuid":"f25d2e17-168a-40f4-ae23-ecd40ae69e9c","destination_block":"8c3a9347-333a-51dd-b02f-38f652dbfd6c","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":13},"name":"FetchContentSet","uuid":"92819633-e996-5604-98ba-cba44404a436"},"card_item":{"expression":{},"meta":{"column":3,"line":27},"type":"expression"},"index":0}}}}}},{"label":null,"name":"ask_signup","type":"MobilePrimitives.SelectOneResponse","config":{"prompt":"d89faa92-1fe5-42a8-ab05-9b325ee4ee6b","choices":[{"name":"fetch_content_set","prompt":"beabbd10-5225-4f9e-8f17-a2b60ca56a09","test":"block.response = \"Yes, please\""},{"name":"exit","prompt":"0976a748-8606-4538-9394-a0a011fcec57","test":"block.response = \"No, thank you\""}]},"tags":[],"uuid":"a66f9ab6-6df0-5346-8a85-ab464aa255ae","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":null,"name":"fetch_content_set","config":{},"test":"block.value = \"fetch_content_set\"","uuid":"bfa226c8-980b-4712-9b57-794dd2bb4490","destination_block":"8a9d592c-78fe-51c6-b606-6cfe0ae61532","semantic_label":null,"vendor_metadata":{}},{"default":null,"name":"exit","config":{},"test":"block.value = \"exit\"","uuid":"b205cc07-af41-4584-a108-662cc0c0fea8","destination_block":"f73d5e2f-8a8a-5a03-81e7-2d45760098c2","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"ask_signup","config":{},"test":"","uuid":"a998219f-e25b-43f1-842d-17c7e309c903","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"buttons_metadata":{},"card":{"condition":null,"meta":{"column":1,"line":1},"name":"AskSignup","uuid":"cfb4f4a6-6310-525f-a473-bc5b6eda1dc2"},"card_item":{"button_block":{},"meta":{"column":3,"line":2},"type":"button_block"},"index":0}}}}}},{"label":null,"name":"push_messaging_signup","type":"Core.Output","config":{"value":"\"no\""},"tags":[],"uuid":"f73d5e2f-8a8a-5a03-81e7-2d45760098c2","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"push_messaging_signup","config":{},"test":"","uuid":"2656d443-22e0-4fb9-bc57-42d6f2e71fb0","destination_block":"10963182-6b29-5516-91cc-d2dde6537555","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":37},"name":"Exit","uuid":"eddf05c3-f6d4-5ba8-ab1a-e317ec59b710"},"card_item":{"meta":{"column":3,"line":38},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"exit_text","type":"MobilePrimitives.Message","config":{"prompt":"c2970897-2309-4716-8106-76aa02812f53"},"tags":[],"uuid":"10963182-6b29-5516-91cc-d2dde6537555","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"exit_text","config":{},"test":"","uuid":"89373d44-b2a7-452b-a83d-aa7de148d172","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":37},"name":"Exit","uuid":"eddf05c3-f6d4-5ba8-ab1a-e317ec59b710"},"card_item":{"meta":{"column":3,"line":39},"text":{},"type":"text"},"index":0}}}}}}],"last_modified":"2024-10-14T10:37:15.767122Z","uuid":"6db00ef4-1fbe-572e-aaf5-ca314ca81c79","languages":[{"id":"a8cdf511-03cf-4315-84f6-29091c48e320","label":"English","variant":null,"iso_639_3":"eng","bcp_47":null}],"first_block_id":"a66f9ab6-6df0-5346-8a85-ab464aa255ae","interaction_timeout":300,"vendor_metadata":{},"supported_modes":["RICH_MESSAGING"],"exit_block_id":""}],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file +{"name":"pm-signup","description":"Default description","uuid":"ec6311dc-6447-4701-9c35-7e4a26ec6c3f","resources":[{"values":[{"value":"Thank you for signing up! You will receive your first message shortly","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"49445b03-8237-478f-84e2-db5fc5da044b"}],"uuid":"5e3dfb20-c214-42be-b2ff-bb17494a3492"},{"values":[{"value":"Hi!\n\nWould you like to sign up to our testing messaging set?\n\nYou will receive 5 messages, one every 5 minutes.\n","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"49445b03-8237-478f-84e2-db5fc5da044b"}],"uuid":"12739269-dd56-453f-8692-f549e68b69b8"},{"values":[{"value":"Yes, please","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"49445b03-8237-478f-84e2-db5fc5da044b"}],"uuid":"5360a871-fd32-44b7-8cca-5c6c9400603b"},{"values":[{"value":"No, thank you","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"49445b03-8237-478f-84e2-db5fc5da044b"}],"uuid":"5a3526af-b789-46e6-b550-a7cd49b1fffd"},{"values":[{"value":"Thank you! You will not be sent any messages.","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"49445b03-8237-478f-84e2-db5fc5da044b"}],"uuid":"c1211df1-77b0-4af8-b9cf-9b0d7628f14c"}],"flows":[{"label":null,"name":"stack","blocks":[{"label":null,"name":"signup_time","type":"Core.Case","config":{},"tags":[],"uuid":"8c3a9347-333a-51dd-b02f-38f652dbfd6c","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"now()","config":{},"test":"","uuid":"9d7b472f-fef1-490e-bc32-105b67e4ec1b","destination_block":"0a30b02f-7ca8-578a-8847-ba76093420f0","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":30},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"expression":{},"meta":{"column":3,"line":31},"type":"expression"},"index":0}}}}}},{"label":null,"name":"complete_signup_contact_update_push_messaging_signup","type":"Core.SetContactProperty","config":{"set_contact_property":{"property_key":"push_messaging_signup","property_value":"@signup_time"}},"tags":[],"uuid":"0a30b02f-7ca8-578a-8847-ba76093420f0","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_contact_update_push_messaging_signup","config":{},"test":"","uuid":"b8856eb0-5228-4d22-99b4-fcc4293a8be7","destination_block":"1cd04018-728c-5838-95fc-997677eabedb","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":30},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":32},"type":"update_contact","update_contact":{}},"index":0}}}}}},{"label":null,"name":"push_messaging_signup","type":"Core.Output","config":{"value":"\"@contentset.id\""},"tags":[],"uuid":"1cd04018-728c-5838-95fc-997677eabedb","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"push_messaging_signup","config":{},"test":"","uuid":"2f06f06e-fcaf-40eb-9e80-dae56207cd06","destination_block":"1474d567-3b5b-5b43-a26a-b0da3a20563e","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":30},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":33},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"complete_signup_text","type":"MobilePrimitives.Message","config":{"prompt":"5e3dfb20-c214-42be-b2ff-bb17494a3492"},"tags":[],"uuid":"1474d567-3b5b-5b43-a26a-b0da3a20563e","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_text","config":{},"test":"","uuid":"d91c5fb3-25ad-4024-8c0b-8a1fc9c3bc52","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":30},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":34},"text":{},"type":"text"},"index":0}}}}}},{"label":null,"name":"contentsets","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[["gender","@contact.gender"],["age","@contact.age"],["relationship","@contact.relationship"]],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"8a9d592c-78fe-51c6-b606-6cfe0ae61532","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets","config":{},"test":"","uuid":"c22cfb17-0a9d-4062-abdc-f30bc7a6dae4","destination_block":"9b5f468c-de1e-54f0-a04b-db1c3551c16c","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":13},"name":"FetchContentSet","uuid":"92819633-e996-5604-98ba-cba44404a436"},"card_item":{"meta":{"column":3,"line":14},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"contentset","type":"Core.Case","config":{},"tags":[],"uuid":"9b5f468c-de1e-54f0-a04b-db1c3551c16c","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets.body.results[0]","config":{},"test":"","uuid":"ecd67d0b-bf92-4034-b0b0-de2cf8036507","destination_block":"8c3a9347-333a-51dd-b02f-38f652dbfd6c","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":13},"name":"FetchContentSet","uuid":"92819633-e996-5604-98ba-cba44404a436"},"card_item":{"expression":{},"meta":{"column":3,"line":27},"type":"expression"},"index":0}}}}}},{"label":null,"name":"ask_signup","type":"MobilePrimitives.SelectOneResponse","config":{"prompt":"12739269-dd56-453f-8692-f549e68b69b8","choices":[{"name":"fetch_content_set","prompt":"5360a871-fd32-44b7-8cca-5c6c9400603b","test":"block.response = \"Yes, please\""},{"name":"exit","prompt":"5a3526af-b789-46e6-b550-a7cd49b1fffd","test":"block.response = \"No, thank you\""}]},"tags":[],"uuid":"a66f9ab6-6df0-5346-8a85-ab464aa255ae","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":null,"name":"fetch_content_set","config":{},"test":"block.value = \"fetch_content_set\"","uuid":"7972f09a-613d-48a8-afb8-268c63d6b88c","destination_block":"8a9d592c-78fe-51c6-b606-6cfe0ae61532","semantic_label":null,"vendor_metadata":{}},{"default":null,"name":"exit","config":{},"test":"block.value = \"exit\"","uuid":"4071da74-0057-4b1f-a3f1-2eb3153e894a","destination_block":"f73d5e2f-8a8a-5a03-81e7-2d45760098c2","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"ask_signup","config":{},"test":"","uuid":"742720d5-da76-48ce-8ade-a8c06153b104","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"buttons_metadata":{},"card":{"condition":null,"meta":{"column":1,"line":1},"name":"AskSignup","uuid":"cfb4f4a6-6310-525f-a473-bc5b6eda1dc2"},"card_item":{"button_block":{},"meta":{"column":3,"line":2},"type":"button_block"},"index":0}}}}}},{"label":null,"name":"push_messaging_signup","type":"Core.Output","config":{"value":"\"no\""},"tags":[],"uuid":"f73d5e2f-8a8a-5a03-81e7-2d45760098c2","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"push_messaging_signup","config":{},"test":"","uuid":"e6b3acc7-ccec-4571-a1e5-6a953e0ffcd6","destination_block":"10963182-6b29-5516-91cc-d2dde6537555","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":37},"name":"Exit","uuid":"eddf05c3-f6d4-5ba8-ab1a-e317ec59b710"},"card_item":{"meta":{"column":3,"line":38},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"exit_text","type":"MobilePrimitives.Message","config":{"prompt":"c1211df1-77b0-4af8-b9cf-9b0d7628f14c"},"tags":[],"uuid":"10963182-6b29-5516-91cc-d2dde6537555","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"exit_text","config":{},"test":"","uuid":"f066141a-07ea-45b6-927a-b7f52fa6f078","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":37},"name":"Exit","uuid":"eddf05c3-f6d4-5ba8-ab1a-e317ec59b710"},"card_item":{"meta":{"column":3,"line":39},"text":{},"type":"text"},"index":0}}}}}}],"last_modified":"2024-10-17T13:11:03.104919Z","uuid":"6db00ef4-1fbe-572e-aaf5-ca314ca81c79","languages":[{"id":"49445b03-8237-478f-84e2-db5fc5da044b","label":"English","variant":null,"iso_639_3":"eng","bcp_47":null}],"first_block_id":"a66f9ab6-6df0-5346-8a85-ab464aa255ae","interaction_timeout":300,"vendor_metadata":{},"supported_modes":["RICH_MESSAGING"],"exit_block_id":""}],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file diff --git a/Push messaging/QA/tests/send_next_message_test.exs b/Push messaging/QA/tests/send_next_message_test.exs new file mode 100644 index 0000000..b76ed96 --- /dev/null +++ b/Push messaging/QA/tests/send_next_message_test.exs @@ -0,0 +1,132 @@ +defmodule SendNextMessageTest do + use FlowTester.Case + use FakeCMS + + alias FlowTester.WebhookHandler, as: WH + + defp flow_path(flow_name), do: Path.join([__DIR__, "..", "flows_json", flow_name <> ".json"]) + + def setup_fake_cms(auth_token) do + # Start the handler. + wh_pid = start_link_supervised!({FakeCMS, %FakeCMS.Config{auth_token: auth_token}}) + + topic1_index = %Index{slug: "topic-1", title: "Topic 1"} + + leaf_page = %ContentPage{ + parent: "topic-1", + slug: "leaf-page-1", + title: "Leaf Page 1", + whatsapp_template_name: "test_name", + wa_messages: [ + %WAMsg{ + message: "Test leaf content page", + buttons: [%Btn.Next{title: "Next"}] + }, + %WAMsg{ + message: "Last message" + } + ] + } + + leaf_page2 = %ContentPage{ + parent: "topic-1", + slug: "leaf-page-2", + title: "Leaf Page 2", + wa_messages: [ + %WAMsg{ + message: "Test leaf content page 2", + buttons: [%Btn.Next{title: "Next"}] + }, + %WAMsg{ + message: "Last message" + } + ] + } + + ocs1 = %OrderedContentSet{ + id: 1, + name: "Test Ordered Content Set", + profile_fields: [%ProfileField{name: "relationship", value: "single"}], + pages: [ + %OrderedContentSetPage{ + contentpage_id: 2, + time: 1, + unit: "day", + before_or_after: "before", + contact_field: "edd" + }, + %OrderedContentSetPage{ + contentpage_id: 3, + time: 5, + unit: "minutes", + before_or_after: "after", + contact_field: "edd" + } + ] + } + + assert :ok = + FakeCMS.add_pages(wh_pid, [ + topic1_index, + leaf_page, + leaf_page2 + ]) + + assert :ok = + FakeCMS.add_ordered_content_sets(wh_pid, [ + ocs1 + ]) + + # Return the adapter. + FakeCMS.wh_adapter(wh_pid) + end + + defp fake_cms(step, base_url, auth_token), + do: WH.set_adapter(step, base_url, setup_fake_cms(auth_token)) + + defp setup_contact_fields(context) do + context + |> FlowTester.set_contact_properties(%{"gender" => "", "age" => "", "relationship" => ""}) + end + + defp setup_flow() do + auth_token = "testtoken" + + flow_path("send_next_message") + |> FlowTester.from_json!() + |> fake_cms("https://content-repo-api-qa.prk-k8s.prd-p6t.org/", auth_token) + |> FlowTester.set_global_dict("config", %{"contentrepo_token" => auth_token}) + |> setup_contact_fields() + end + + describe "push messaging" do + test "send whatsapp template" do + fake_time = ~U[2023-02-28 00:00:00Z] + # 5.5 minutes later + future_fake_time = DateTime.add(fake_time, 330, :second) + string_fake_time = DateTime.to_iso8601(fake_time) + + setup_flow() + |> FlowTester.set_fake_time(future_fake_time) + |> FlowTester.set_contact_properties(%{"push_messaging_signup" => string_fake_time}) + |> FlowTester.start() + |> result_matches(%{name: "template_sent", value: "test_name"}) + end + + test "send regular message" do + fake_time = ~U[2023-02-28 00:00:00Z] + # 3 minutes later + future_fake_time = DateTime.add(fake_time, 180, :second) + string_fake_time = DateTime.to_iso8601(fake_time) + + setup_flow() + |> FlowTester.set_fake_time(future_fake_time) + |> FlowTester.set_contact_properties(%{"push_messaging_signup" => string_fake_time}) + |> FlowTester.start() + |> receive_message(%{ + text: "Leaf Page 2\n\nTest leaf content page 2\n" + }) + |> result_matches(%{name: "message_sent", value: "3"}) + end + end +end diff --git a/Push messaging/QA/tests/signup_test.exs b/Push messaging/QA/tests/signup_test.exs index 91dfa4f..4ce316b 100644 --- a/Push messaging/QA/tests/signup_test.exs +++ b/Push messaging/QA/tests/signup_test.exs @@ -93,7 +93,8 @@ defmodule SignupTest do do: WH.set_adapter(step, base_url, setup_fake_cms(auth_token)) defp setup_contact_fields(context) do - context |> FlowTester.set_contact_properties(%{"gender" => "", "age" => "", "relationship" => ""}) + context + |> FlowTester.set_contact_properties(%{"gender" => "", "age" => "", "relationship" => ""}) end defp setup_flow() do @@ -142,7 +143,7 @@ defmodule SignupTest do text: "Thank you for signing up! You will receive your first message shortly" }) |> contact_matches(%{"push_messaging_signup" => ^string_fake_time}) - |> result_matches(%{name: "push_messaging_signup", value: "contentset_id"}) + |> result_matches(%{name: "push_messaging_signup", value: "1"}) |> flow_finished() end end From ef374eafb4acf2fbe4c8378398d0466facf134ac Mon Sep 17 00:00:00 2001 From: Gerrit Vermeulen Date: Mon, 21 Oct 2024 15:37:29 +0200 Subject: [PATCH 4/7] Fix tests for new Flow Tester --- .github/workflows/test.yaml | 2 +- Push messaging/QA/tests/send_next_message_test.exs | 4 ++-- Push messaging/QA/tests/signup_test.exs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2754a3b..0a97b20 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: uses: actions/checkout@v4 with: repository: praekeltfoundation/flow_tester - ref: v0.3.5 + ref: v0.3.7 path: flow_tester ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Check formatting diff --git a/Push messaging/QA/tests/send_next_message_test.exs b/Push messaging/QA/tests/send_next_message_test.exs index b76ed96..0420409 100644 --- a/Push messaging/QA/tests/send_next_message_test.exs +++ b/Push messaging/QA/tests/send_next_message_test.exs @@ -49,14 +49,14 @@ defmodule SendNextMessageTest do profile_fields: [%ProfileField{name: "relationship", value: "single"}], pages: [ %OrderedContentSetPage{ - contentpage_id: 2, + slug: "leaf-page-1", time: 1, unit: "day", before_or_after: "before", contact_field: "edd" }, %OrderedContentSetPage{ - contentpage_id: 3, + slug: "leaf-page-2", time: 5, unit: "minutes", before_or_after: "after", diff --git a/Push messaging/QA/tests/signup_test.exs b/Push messaging/QA/tests/signup_test.exs index 4ce316b..397dff6 100644 --- a/Push messaging/QA/tests/signup_test.exs +++ b/Push messaging/QA/tests/signup_test.exs @@ -48,7 +48,7 @@ defmodule SignupTest do profile_fields: [%ProfileField{name: "relationship", value: "single"}], pages: [ %OrderedContentSetPage{ - contentpage_id: 2, + slug: "leaf-page-1", time: 1, unit: "day", before_or_after: "before", @@ -63,7 +63,7 @@ defmodule SignupTest do profile_fields: [%ProfileField{name: "relationship", value: "it's complicated"}], pages: [ %OrderedContentSetPage{ - contentpage_id: 3, + slug: "leaf-page-2", time: 5, unit: "minutes", before_or_after: "after", From 61f622bcbfd704142dd540fe2d4308baf3391c5b Mon Sep 17 00:00:00 2001 From: Gerrit Vermeulen Date: Mon, 21 Oct 2024 15:42:49 +0200 Subject: [PATCH 5/7] FT v 0.3.6 dummy --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0a97b20..67ef039 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,7 +20,7 @@ jobs: uses: actions/checkout@v4 with: repository: praekeltfoundation/flow_tester - ref: v0.3.7 + ref: v0.3.6 path: flow_tester ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Check formatting From d857b77e7082e50bc4b8c61210f53e6d6d707cc1 Mon Sep 17 00:00:00 2001 From: Gerrit Vermeulen Date: Mon, 28 Oct 2024 15:26:25 +0200 Subject: [PATCH 6/7] Add tests for filtering by contact fields --- Push messaging/QA/flows/send_next_message.md | 48 +++- .../QA/flows_json/send_next_message.json | 2 +- .../QA/tests/send_next_message_test.exs | 222 +++++++++++++++++- Push messaging/README.md | 8 + .../schedule_next_push_message.json | 1 - .../send_next_message_callback.json | 1 - .../QA/flows_json/signup.json | 1 - 7 files changed, 269 insertions(+), 14 deletions(-) create mode 100644 Push messaging/README.md delete mode 100644 Stage based messaging/QA/flows_json/schedule_next_push_message.json delete mode 100644 Stage based messaging/QA/flows_json/send_next_message_callback.json delete mode 100644 Stage based messaging/QA/flows_json/signup.json diff --git a/Push messaging/QA/flows/send_next_message.md b/Push messaging/QA/flows/send_next_message.md index 6dccfb6..bea5992 100644 --- a/Push messaging/QA/flows/send_next_message.md +++ b/Push messaging/QA/flows/send_next_message.md @@ -37,26 +37,62 @@ This Journey does not link to any other Journeys ## Determine message -This block figures out which message to send to the user based on the difference between the current time plus the trigger time, and when the user signed up. This way if we update CMS with a new message then the correct sequence is still followed for users partway through. +This block figures out which message to send to the user based on the difference between the current time, and when the user signed up plus the trigger time. This way if we update CMS with a new message then the correct sequence is still followed for users partway through. ```stack card DetermineMessage when now() >= datetime_add(contact.push_messaging_signup, 5, "m") and now() < datetime_add(contact.push_messaging_signup, 10, "m"), - then: GetMessage do + then: CalculateAge do # send first message push_messaging_content_set_position = 0 end # Add your other conditions here -card DetermineMessage, then: GetMessage do +card DetermineMessage, then: CalculateAge do # send second message push_messaging_content_set_position = 1 end ``` +## Calculate Age & Determine Age Range + +CMS uses age ranges, so in order to filter by age, we need get the age either from the `age` contact field or calculate it from the `year_of_birth` contact field, and then determine which age range it falls into. + +```stack +card CalculateAge, then: DetermineAgeRange do + # age = + # if is_nil_or_empty(contact.age) do + # year(now()) - contact.year_of_birth + # else + # contact.age + # end + # we don't currently have an age contact field and it seems silly to have to create it for + # this journey + age = + if is_nil_or_empty(contact.year_of_birth) do + 0 + else + year(now()) - contact.year_of_birth + end +end + +card DetermineAgeRange when age >= 15 and age <= 18, then: GetMessage do + age_range = "15 - 18" +end + +card DetermineAgeRange when age >= 25 and age <= 30, then: GetMessage do + age_range = "25 - 30" +end + +card DetermineAgeRange, then: GetMessage do + age_range = "" +end + +``` + ```stack card GetMessage, then: SendMessage do contentsets = @@ -67,8 +103,8 @@ card GetMessage, then: SendMessage do ], query: [ ["gender", "@contact.gender"], - ["age", "@contact.age"], - ["relationship", "@contact.relationship"] + ["age", "@age_range"], + ["relationship", "@contact.relationship_status"] ] ) @@ -84,8 +120,6 @@ card GetMessage, then: SendMessage do ], query: [["whatsapp", "true"]] ) - - log("page @page") end card SendMessage when page.body.body.is_whatsapp_template do diff --git a/Push messaging/QA/flows_json/send_next_message.json b/Push messaging/QA/flows_json/send_next_message.json index 14724f6..d0b7adc 100644 --- a/Push messaging/QA/flows_json/send_next_message.json +++ b/Push messaging/QA/flows_json/send_next_message.json @@ -1 +1 @@ -{"name":"pm-send-next-message","description":"Default description","uuid":"55b1690d-a546-4d33-912c-7f2b83665ef0","resources":[{"values":[{"value":"contentset @contentset","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"b262996b-9f64-420e-9e07-941370649939"}],"uuid":"558854d1-b10d-43e0-821e-98e24c856808"},{"values":[{"value":"contentset_item @contentset_item","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"b262996b-9f64-420e-9e07-941370649939"}],"uuid":"ea1eb830-0692-4f04-848c-84ce4cbe1860"},{"values":[{"value":"page @page","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"b262996b-9f64-420e-9e07-941370649939"}],"uuid":"4cf38c39-840f-4570-b68c-d0b5c7178230"},{"values":[{"value":"@page.body.title\n\n@page.body.body.text.value.message\n","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"b262996b-9f64-420e-9e07-941370649939"}],"uuid":"2869d711-a603-460d-a455-31e4e86580b4"}],"flows":[{"label":null,"name":"stack","blocks":[{"label":null,"name":"contentsets","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[["gender","@contact.gender"],["age","@contact.age"],["relationship","@contact.relationship"]],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"dbac9ec2-01d2-508f-a240-35a681f9c520","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets","config":{},"test":"","uuid":"5deb4d32-5756-41ca-a86a-b61c683990b5","destination_block":"3c894579-86e8-5648-9c68-408ebc9e6ef5","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"meta":{"column":3,"line":22},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"contentset","type":"Core.Case","config":{},"tags":[],"uuid":"3c894579-86e8-5648-9c68-408ebc9e6ef5","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets.body.results[0]","config":{},"test":"","uuid":"beffe596-12c7-46d7-86c2-0330bfdde493","destination_block":"25131a36-ab31-5cf0-b17e-ac6ea41d0263","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"expression":{},"meta":{"column":3,"line":35},"type":"expression"},"index":0}}}}}},{"label":null,"name":"get_message_log","type":"Core.Log","config":{"message":"558854d1-b10d-43e0-821e-98e24c856808"},"tags":[],"uuid":"25131a36-ab31-5cf0-b17e-ac6ea41d0263","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"get_message_log","config":{},"test":"","uuid":"d0a930be-5340-4ee9-b495-56244e94791c","destination_block":"85a0770f-f213-5c97-8ba8-85baa0289540","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"log":{},"meta":{"column":3,"line":37},"type":"log"},"index":0}}}}}},{"label":null,"name":"contentset_item","type":"Core.Case","config":{},"tags":[],"uuid":"85a0770f-f213-5c97-8ba8-85baa0289540","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentset.pages[push_messaging_content_set_position]","config":{},"test":"","uuid":"03be7d0a-aa93-4018-8046-b7511a0e5c81","destination_block":"e616d211-01d4-5f07-ba39-84be6af786db","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"expression":{},"meta":{"column":3,"line":39},"type":"expression"},"index":0}}}}}},{"label":null,"name":"get_message_log","type":"Core.Log","config":{"message":"ea1eb830-0692-4f04-848c-84ce4cbe1860"},"tags":[],"uuid":"e616d211-01d4-5f07-ba39-84be6af786db","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"get_message_log","config":{},"test":"","uuid":"10d8e744-d0cb-4ebd-8d0e-8bb8186e4805","destination_block":"0648433f-e886-5484-b0f2-97ed39940c33","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"log":{},"meta":{"column":3,"line":41},"type":"log"},"index":0}}}}}},{"label":null,"name":"page","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[["whatsapp","true"]],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/pages/@contentset_item.id/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"0648433f-e886-5484-b0f2-97ed39940c33","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"page","config":{},"test":"","uuid":"fb0da4b0-e205-4339-b452-c22c12ba02a9","destination_block":"a70063f3-22c2-55b5-ad1c-e19d34739d9d","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"meta":{"column":3,"line":43},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"get_message_log","type":"Core.Log","config":{"message":"4cf38c39-840f-4570-b68c-d0b5c7178230"},"tags":[],"uuid":"a70063f3-22c2-55b5-ad1c-e19d34739d9d","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"Default exit to \"SendMessage\"","config":{},"test":"","uuid":"d72c19cc-c803-479b-8ddd-b7334b5abd7a","destination_block":"4a33bb3c-ce05-5ffc-a22a-aedae889d235","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"log":{},"meta":{"column":3,"line":52},"type":"log"},"index":0}}}}}},{"label":null,"name":"determine_message_case","type":"Core.Case","config":{},"tags":[],"uuid":"bf5bcec3-e178-5b01-b978-15752029ab5a","ui_metadata":{},"exits":[{"default":false,"name":"Exit for determine_message_case_condition_0","config":{},"test":"and(now() >= datetime_add(contact.push_messaging_signup, 5, \"m\"), now() < datetime_add(contact.push_messaging_signup, 10, \"m\"))","uuid":"11a51081-3b57-40bc-aa73-9c806e465a9d","destination_block":"b7a96e2c-5091-5f8b-8baa-b25f461d5c0c","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"Exit for determine_message_case_condition_1","config":{},"test":null,"uuid":"ef4b09ef-a0f5-4131-a327-56e94598b949","destination_block":"0bc54330-8f14-52f5-a7a6-d232c81e6ba4","semantic_label":null,"vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{}},{"label":null,"name":"push_messaging_content_set_position","type":"Core.Case","config":{},"tags":[],"uuid":"0bc54330-8f14-52f5-a7a6-d232c81e6ba4","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"1","config":{},"test":"","uuid":"f6bea62c-98de-49d3-a415-15356e125847","destination_block":"dbac9ec2-01d2-508f-a240-35a681f9c520","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"DetermineMessage","uuid":"59296584-a983-57eb-ad8e-77b3bc994dee"},"card_item":{"literal":{},"meta":{"column":3,"line":18},"type":"literal"},"index":1}}}}}},{"label":null,"name":"push_messaging_content_set_position","type":"Core.Case","config":{},"tags":[],"uuid":"b7a96e2c-5091-5f8b-8baa-b25f461d5c0c","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"0","config":{},"test":"","uuid":"cd3b9eb7-cff5-41ca-b273-6856963c2697","destination_block":"dbac9ec2-01d2-508f-a240-35a681f9c520","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"now() >= datetime_add(contact.push_messaging_signup, 5, \"m\") and now() < datetime_add(contact.push_messaging_signup, 10, \"m\")","meta":{"column":1,"line":6},"name":"DetermineMessage","uuid":"bf5bcec3-e178-5b01-b978-15752029ab5a"},"card_item":{"literal":{},"meta":{"column":3,"line":11},"type":"literal"},"index":0}}}}}},{"label":null,"name":"send_message_case","type":"Core.Case","config":{},"tags":[],"uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235","ui_metadata":{},"exits":[{"default":false,"name":"Exit for send_message_case_condition_0","config":{},"test":"page.body.body.is_whatsapp_template","uuid":"dbee2250-426c-47fb-91a4-069988624784","destination_block":"d6a6bacc-b77a-5d5f-a0b8-6928b890d0c9","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"Exit for send_message_case_condition_1","config":{},"test":null,"uuid":"1841b226-3c87-4294-8a75-e3bd839cfc15","destination_block":"706ac53f-c36d-5a29-af9d-2fd4a5fd9321","semantic_label":null,"vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{}},{"label":null,"name":"message_sent","type":"Core.Output","config":{"value":"\"@page.body.id\""},"tags":[],"uuid":"706ac53f-c36d-5a29-af9d-2fd4a5fd9321","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"message_sent","config":{},"test":"","uuid":"fcc5968a-5b91-4b1a-99c4-6a65a5e42403","destination_block":"31147028-1d40-5e89-845a-327a0ea1835e","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":64},"name":"SendMessage","uuid":"b2c3e2ca-ba63-5954-bcc6-346d54f6e74e"},"card_item":{"meta":{"column":3,"line":65},"type":"write_result","write_result":{}},"index":1}}}}}},{"label":null,"name":"send_message_case_condition_1_text","type":"MobilePrimitives.Message","config":{"prompt":"2869d711-a603-460d-a455-31e4e86580b4"},"tags":[],"uuid":"31147028-1d40-5e89-845a-327a0ea1835e","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"send_message_case_condition_1_text","config":{},"test":"","uuid":"1cf89d88-02e0-444c-8828-c9779c133d33","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":64},"name":"SendMessage","uuid":"b2c3e2ca-ba63-5954-bcc6-346d54f6e74e"},"card_item":{"meta":{"column":3,"line":67},"text":{},"type":"text"},"index":0}}}}}},{"label":null,"name":"template_sent","type":"Core.Output","config":{"value":"\"@page.body.body.whatsapp_template_name\""},"tags":[],"uuid":"d6a6bacc-b77a-5d5f-a0b8-6928b890d0c9","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"template_sent","config":{},"test":"","uuid":"ae7901c7-dd65-4e02-9761-51130e6b2703","destination_block":"9f52cd8a-61bf-5105-8b62-26046e7a6902","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"page.body.body.is_whatsapp_template","meta":{"column":1,"line":55},"name":"SendMessage","uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235"},"card_item":{"meta":{"column":3,"line":56},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"send_message_case_condition_0_whatsapp_template_message","type":"Io.Turn.WhatsAppTemplateMessage","config":{"template":{"name":"\"@page.body.body.whatsapp_template_name\"","language":{"code":"\"en_US\""},"components":[{"index":null,"type":"body","parameters":[{"type":"text","text":"\"@contact.whatsapp_profile_name\""},{"type":"text","text":"\"Second\""}],"sub_type":null}],"tracking":null}},"tags":[],"uuid":"9f52cd8a-61bf-5105-8b62-26046e7a6902","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"send_message_case_condition_0_whatsapp_template_message","config":{},"test":"","uuid":"81eb8384-5e80-4138-8222-15b2c2927971","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"page.body.body.is_whatsapp_template","meta":{"column":1,"line":55},"name":"SendMessage","uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235"},"card_item":{"meta":{"column":3,"line":58},"type":"whatsapp_template_message","whatsapp_template_message":{}},"index":0}}}}}}],"last_modified":"2024-10-17T14:34:53.741200Z","uuid":"cd151682-0f27-58a0-a7b3-281620f3513d","languages":[{"id":"b262996b-9f64-420e-9e07-941370649939","label":"English","variant":null,"iso_639_3":"eng","bcp_47":null}],"first_block_id":"bf5bcec3-e178-5b01-b978-15752029ab5a","interaction_timeout":300,"vendor_metadata":{},"supported_modes":["RICH_MESSAGING"],"exit_block_id":""}],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file +{"name":"pm-send-next-message","description":"Default description","uuid":"55b1690d-a546-4d33-912c-7f2b83665ef0","resources":[{"values":[{"value":"@page.body.title\n\n@page.body.body.text.value.message\n","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"248f684f-005e-49e8-a567-072ea71d3a8a"}],"uuid":"085fb255-222f-44e4-82e1-baa654437922"}],"flows":[{"label":null,"name":"stack","blocks":[{"label":null,"name":"send_message_case","type":"Core.Case","config":{},"tags":[],"uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235","ui_metadata":{},"exits":[{"default":false,"name":"Exit for send_message_case_condition_0","config":{},"test":"page.body.body.is_whatsapp_template","uuid":"3066c9b1-294a-4e1a-80e9-cd5a7328ca9c","destination_block":"bd67ea29-74a9-57db-b900-1beac600c99d","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"Exit for send_message_case_condition_1","config":{},"test":null,"uuid":"15c36c7a-13f8-4dc8-8265-5356e7989303","destination_block":"0653cac5-4125-50a2-b335-1c1a9c9439c4","semantic_label":null,"vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{}},{"label":null,"name":"message_sent","type":"Core.Output","config":{"value":"\"@page.body.id\""},"tags":[],"uuid":"0653cac5-4125-50a2-b335-1c1a9c9439c4","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"message_sent","config":{},"test":"","uuid":"909777bc-0bb7-41ad-ac4b-fb05243dbdd0","destination_block":"8b939f5b-ac37-5a69-b67d-a160209775a8","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":87},"name":"SendMessage","uuid":"b2c3e2ca-ba63-5954-bcc6-346d54f6e74e"},"card_item":{"meta":{"column":3,"line":88},"type":"write_result","write_result":{}},"index":1}}}}}},{"label":null,"name":"send_message_case_condition_1_text","type":"MobilePrimitives.Message","config":{"prompt":"085fb255-222f-44e4-82e1-baa654437922"},"tags":[],"uuid":"8b939f5b-ac37-5a69-b67d-a160209775a8","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"send_message_case_condition_1_text","config":{},"test":"","uuid":"7401eff7-3221-4e00-9b19-9b37d63b8acd","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":87},"name":"SendMessage","uuid":"b2c3e2ca-ba63-5954-bcc6-346d54f6e74e"},"card_item":{"meta":{"column":3,"line":90},"text":{},"type":"text"},"index":0}}}}}},{"label":null,"name":"template_sent","type":"Core.Output","config":{"value":"\"@page.body.body.whatsapp_template_name\""},"tags":[],"uuid":"bd67ea29-74a9-57db-b900-1beac600c99d","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"template_sent","config":{},"test":"","uuid":"73eb97ad-ddd2-49a8-aa70-4565256717de","destination_block":"b295e1ff-ce5e-51db-9528-16246c1ed8fa","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"page.body.body.is_whatsapp_template","meta":{"column":1,"line":78},"name":"SendMessage","uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235"},"card_item":{"meta":{"column":3,"line":79},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"send_message_case_condition_0_whatsapp_template_message","type":"Io.Turn.WhatsAppTemplateMessage","config":{"template":{"name":"\"@page.body.body.whatsapp_template_name\"","components":[{"index":null,"type":"body","parameters":[{"type":"text","text":"\"@contact.whatsapp_profile_name\""},{"type":"text","text":"\"Second\""}],"sub_type":null}],"language":{"code":"\"en_US\""},"tracking":null}},"tags":[],"uuid":"b295e1ff-ce5e-51db-9528-16246c1ed8fa","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"send_message_case_condition_0_whatsapp_template_message","config":{},"test":"","uuid":"cfc8e9ee-1cf7-4e00-b9d0-b8d797dcec7c","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"page.body.body.is_whatsapp_template","meta":{"column":1,"line":78},"name":"SendMessage","uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235"},"card_item":{"meta":{"column":3,"line":81},"type":"whatsapp_template_message","whatsapp_template_message":{}},"index":0}}}}}},{"label":null,"name":"contentsets","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[["gender","@contact.gender"],["age","@age_range"],["relationship","@contact.relationship_status"]],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"f85a3051-65de-50ae-b66f-88435574da02","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets","config":{},"test":"","uuid":"55e9ce5c-4666-4aa0-a752-2ece27f7f471","destination_block":"b3d4494d-6566-55de-b7b1-3c9e3f9c190a","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":50},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"meta":{"column":3,"line":51},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"contentset","type":"Core.Case","config":{},"tags":[],"uuid":"b3d4494d-6566-55de-b7b1-3c9e3f9c190a","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets.body.results[0]","config":{},"test":"","uuid":"7524505e-da97-4650-b35c-ed132c099c06","destination_block":"6f89661d-0a3f-5bea-849e-2aaf3475d136","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":50},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"expression":{},"meta":{"column":3,"line":64},"type":"expression"},"index":0}}}}}},{"label":null,"name":"contentset_item","type":"Core.Case","config":{},"tags":[],"uuid":"6f89661d-0a3f-5bea-849e-2aaf3475d136","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentset.pages[push_messaging_content_set_position]","config":{},"test":"","uuid":"28af9ccd-0edc-4499-a9ff-eee30177a1cf","destination_block":"c4968226-2322-5be4-9f4d-883bf37c5004","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":50},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"expression":{},"meta":{"column":3,"line":66},"type":"expression"},"index":0}}}}}},{"label":null,"name":"page","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[["whatsapp","true"]],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/pages/@contentset_item.id/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"c4968226-2322-5be4-9f4d-883bf37c5004","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"Default exit to \"SendMessage\"","config":{},"test":"","uuid":"55ab551f-20a1-43d5-8d54-cd75451c25d7","destination_block":"4a33bb3c-ce05-5ffc-a22a-aedae889d235","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":50},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"meta":{"column":3,"line":68},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"determine_age_range_case","type":"Core.Case","config":{},"tags":[],"uuid":"4693f64a-a63a-533d-be3a-ed5d3bf3b09a","ui_metadata":{},"exits":[{"default":false,"name":"Exit for determine_age_range_case_condition_0","config":{},"test":"and(age >= 15, age <= 18)","uuid":"36b1cfca-9540-47fc-8661-d9b4ff5ced8d","destination_block":"9a65ffbb-f616-59a0-a519-0ec008fcc5a7","semantic_label":null,"vendor_metadata":{}},{"default":false,"name":"Exit for determine_age_range_case_condition_1","config":{},"test":"and(age >= 25, age <= 30)","uuid":"69acfc8c-ae13-41f0-beae-5c36f6207779","destination_block":"bfaacd08-57b5-57a0-a215-5d65553f2bc3","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"Exit for determine_age_range_case_condition_2","config":{},"test":null,"uuid":"d3ebf181-54f5-4d29-9099-c4681263355b","destination_block":"0b45d8e6-4cf8-5158-a770-d331adb4ba3d","semantic_label":null,"vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{}},{"label":null,"name":"age_range","type":"Core.Case","config":{},"tags":[],"uuid":"0b45d8e6-4cf8-5158-a770-d331adb4ba3d","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"\"\"","config":{},"test":"","uuid":"aa34615f-0bc8-4fe9-898d-5ff3d92a6580","destination_block":"f85a3051-65de-50ae-b66f-88435574da02","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":46},"name":"DetermineAgeRange","uuid":"0eb1372c-ccc7-54fe-be99-539a4d72659c"},"card_item":{"literal":{},"meta":{"column":3,"line":47},"type":"literal"},"index":2}}}}}},{"label":null,"name":"age_range","type":"Core.Case","config":{},"tags":[],"uuid":"bfaacd08-57b5-57a0-a215-5d65553f2bc3","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"\"25 - 30\"","config":{},"test":"","uuid":"3a8a60dc-474f-4989-b73d-ecff96ba8679","destination_block":"f85a3051-65de-50ae-b66f-88435574da02","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"age >= 25 and age <= 30","meta":{"column":1,"line":42},"name":"DetermineAgeRange","uuid":"a5caae72-e322-5ec3-82d1-e395dc3a507c"},"card_item":{"literal":{},"meta":{"column":3,"line":43},"type":"literal"},"index":1}}}}}},{"label":null,"name":"age_range","type":"Core.Case","config":{},"tags":[],"uuid":"9a65ffbb-f616-59a0-a519-0ec008fcc5a7","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"\"15 - 18\"","config":{},"test":"","uuid":"f0f8380c-f719-4027-b887-1cd64c1a66e8","destination_block":"f85a3051-65de-50ae-b66f-88435574da02","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"age >= 15 and age <= 18","meta":{"column":1,"line":38},"name":"DetermineAgeRange","uuid":"4693f64a-a63a-533d-be3a-ed5d3bf3b09a"},"card_item":{"literal":{},"meta":{"column":3,"line":39},"type":"literal"},"index":0}}}}}},{"label":null,"name":"age","type":"Core.Case","config":{},"tags":[],"uuid":"48bb0531-d96f-593c-81fb-1ad12d44742e","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"if(is_nil_or_empty(contact.year_of_birth), 0, year(now()) - contact.year_of_birth)","config":{},"test":"","uuid":"9f1bc2ee-1ae5-46dd-9222-b6847c9ba0b9","destination_block":"4693f64a-a63a-533d-be3a-ed5d3bf3b09a","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":21},"name":"CalculateAge","uuid":"c26d6e5f-ae37-5937-ba8d-bc9408d944b2"},"card_item":{"expression":{},"meta":{"column":3,"line":30},"type":"expression"},"index":0}}}}}},{"label":null,"name":"determine_message_case","type":"Core.Case","config":{},"tags":[],"uuid":"bf5bcec3-e178-5b01-b978-15752029ab5a","ui_metadata":{},"exits":[{"default":false,"name":"Exit for determine_message_case_condition_0","config":{},"test":"and(now() >= datetime_add(contact.push_messaging_signup, 5, \"m\"), now() < datetime_add(contact.push_messaging_signup, 10, \"m\"))","uuid":"742c9ca0-9a2f-4e63-b02b-b24a126d8f47","destination_block":"b7a96e2c-5091-5f8b-8baa-b25f461d5c0c","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"Exit for determine_message_case_condition_1","config":{},"test":null,"uuid":"64b2aca4-16d9-49ee-9f51-f7566b9f9eae","destination_block":"0bc54330-8f14-52f5-a7a6-d232c81e6ba4","semantic_label":null,"vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{}},{"label":null,"name":"push_messaging_content_set_position","type":"Core.Case","config":{},"tags":[],"uuid":"0bc54330-8f14-52f5-a7a6-d232c81e6ba4","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"1","config":{},"test":"","uuid":"bf4ed9d5-bacb-4725-b0db-7cdcf619b56a","destination_block":"48bb0531-d96f-593c-81fb-1ad12d44742e","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"DetermineMessage","uuid":"59296584-a983-57eb-ad8e-77b3bc994dee"},"card_item":{"literal":{},"meta":{"column":3,"line":18},"type":"literal"},"index":1}}}}}},{"label":null,"name":"push_messaging_content_set_position","type":"Core.Case","config":{},"tags":[],"uuid":"b7a96e2c-5091-5f8b-8baa-b25f461d5c0c","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"0","config":{},"test":"","uuid":"c5b15e3f-fc9c-4a5e-8680-d393932c8e26","destination_block":"48bb0531-d96f-593c-81fb-1ad12d44742e","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"now() >= datetime_add(contact.push_messaging_signup, 5, \"m\") and now() < datetime_add(contact.push_messaging_signup, 10, \"m\")","meta":{"column":1,"line":6},"name":"DetermineMessage","uuid":"bf5bcec3-e178-5b01-b978-15752029ab5a"},"card_item":{"literal":{},"meta":{"column":3,"line":11},"type":"literal"},"index":0}}}}}}],"last_modified":"2024-10-28T13:24:32.891241Z","uuid":"cd151682-0f27-58a0-a7b3-281620f3513d","languages":[{"id":"248f684f-005e-49e8-a567-072ea71d3a8a","label":"English","variant":null,"iso_639_3":"eng","bcp_47":null}],"first_block_id":"bf5bcec3-e178-5b01-b978-15752029ab5a","interaction_timeout":300,"vendor_metadata":{},"supported_modes":["RICH_MESSAGING"],"exit_block_id":""}],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file diff --git a/Push messaging/QA/tests/send_next_message_test.exs b/Push messaging/QA/tests/send_next_message_test.exs index 0420409..3fc8ed2 100644 --- a/Push messaging/QA/tests/send_next_message_test.exs +++ b/Push messaging/QA/tests/send_next_message_test.exs @@ -43,6 +43,99 @@ defmodule SendNextMessageTest do ] } + leaf_page3 = %ContentPage{ + parent: "topic-1", + slug: "leaf-page-3", + title: "Leaf Page 3", + whatsapp_template_name: "test_name3", + wa_messages: [ + %WAMsg{ + message: "Test leaf content page 3", + buttons: [%Btn.Next{title: "Next"}] + }, + %WAMsg{ + message: "Last message" + } + ] + } + + leaf_page4 = %ContentPage{ + parent: "topic-1", + slug: "leaf-page-4", + title: "Leaf Page 4", + wa_messages: [ + %WAMsg{ + message: "Test leaf content page 4", + buttons: [%Btn.Next{title: "Next"}] + }, + %WAMsg{ + message: "Last message" + } + ] + } + + leaf_page5 = %ContentPage{ + parent: "topic-1", + slug: "leaf-page-5", + title: "Leaf Page 5", + whatsapp_template_name: "test_name5", + wa_messages: [ + %WAMsg{ + message: "Test leaf content page 5", + buttons: [%Btn.Next{title: "Next"}] + }, + %WAMsg{ + message: "Last message" + } + ] + } + + leaf_page6 = %ContentPage{ + parent: "topic-1", + slug: "leaf-page-6", + title: "Leaf Page 6", + wa_messages: [ + %WAMsg{ + message: "Test leaf content page 6", + buttons: [%Btn.Next{title: "Next"}] + }, + %WAMsg{ + message: "Last message" + } + ] + } + + leaf_page7 = %ContentPage{ + parent: "topic-1", + slug: "leaf-page-7", + title: "Leaf Page 7", + whatsapp_template_name: "test_name7", + wa_messages: [ + %WAMsg{ + message: "Test leaf content page 7", + buttons: [%Btn.Next{title: "Next"}] + }, + %WAMsg{ + message: "Last message" + } + ] + } + + leaf_page8 = %ContentPage{ + parent: "topic-1", + slug: "leaf-page-8", + title: "Leaf Page 8", + wa_messages: [ + %WAMsg{ + message: "Test leaf content page 8", + buttons: [%Btn.Next{title: "Next"}] + }, + %WAMsg{ + message: "Last message" + } + ] + } + ocs1 = %OrderedContentSet{ id: 1, name: "Test Ordered Content Set", @@ -65,16 +158,91 @@ defmodule SendNextMessageTest do ] } + ocs2 = %OrderedContentSet{ + id: 2, + name: "Test Ordered Content Set 2", + profile_fields: [%ProfileField{name: "age", value: "15 - 18"}], + pages: [ + %OrderedContentSetPage{ + slug: "leaf-page-3", + time: 1, + unit: "day", + before_or_after: "before", + contact_field: "edd" + }, + %OrderedContentSetPage{ + slug: "leaf-page-4", + time: 5, + unit: "minutes", + before_or_after: "after", + contact_field: "edd" + } + ] + } + + ocs3 = %OrderedContentSet{ + id: 3, + name: "Test Ordered Content Set3", + profile_fields: [%ProfileField{name: "relationship", value: "in a relationship"}], + pages: [ + %OrderedContentSetPage{ + slug: "leaf-page-5", + time: 1, + unit: "day", + before_or_after: "before", + contact_field: "edd" + }, + %OrderedContentSetPage{ + slug: "leaf-page-6", + time: 5, + unit: "minutes", + before_or_after: "after", + contact_field: "edd" + } + ] + } + + ocs4 = %OrderedContentSet{ + id: 4, + name: "Test Ordered Content Set4", + profile_fields: [%ProfileField{name: "gender", value: "male"}], + pages: [ + %OrderedContentSetPage{ + slug: "leaf-page-7", + time: 1, + unit: "day", + before_or_after: "before", + contact_field: "edd" + }, + %OrderedContentSetPage{ + slug: "leaf-page-8", + time: 5, + unit: "minutes", + before_or_after: "after", + contact_field: "edd" + } + ] + } + assert :ok = FakeCMS.add_pages(wh_pid, [ topic1_index, leaf_page, - leaf_page2 + leaf_page2, + leaf_page3, + leaf_page4, + leaf_page5, + leaf_page6, + leaf_page7, + leaf_page8, ]) assert :ok = FakeCMS.add_ordered_content_sets(wh_pid, [ - ocs1 + ocs1, + ocs2, + ocs3, + ocs4, ]) # Return the adapter. @@ -86,7 +254,7 @@ defmodule SendNextMessageTest do defp setup_contact_fields(context) do context - |> FlowTester.set_contact_properties(%{"gender" => "", "age" => "", "relationship" => ""}) + |> FlowTester.set_contact_properties(%{"gender" => "", "year_of_birth" => "1988", "relationship_status" => ""}) end defp setup_flow() do @@ -128,5 +296,53 @@ defmodule SendNextMessageTest do }) |> result_matches(%{name: "message_sent", value: "3"}) end + + test "filter by relationship status" do + fake_time = ~U[2023-02-28 00:00:00Z] + # 3 minutes later + future_fake_time = DateTime.add(fake_time, 180, :second) + string_fake_time = DateTime.to_iso8601(fake_time) + + setup_flow() + |> FlowTester.set_fake_time(future_fake_time) + |> FlowTester.set_contact_properties(%{"push_messaging_signup" => string_fake_time, "relationship_status" => "in a relationship"}) + |> FlowTester.start() + |> receive_message(%{ + text: "Leaf Page 6\n\nTest leaf content page 6\n" + }) + |> result_matches(%{name: "message_sent", value: "7"}) + end + + test "filter by age range" do + fake_time = ~U[2023-02-28 00:00:00Z] + # 3 minutes later + future_fake_time = DateTime.add(fake_time, 180, :second) + string_fake_time = DateTime.to_iso8601(fake_time) + + setup_flow() + |> FlowTester.set_fake_time(future_fake_time) + |> FlowTester.set_contact_properties(%{"year_of_birth" => "2010", "push_messaging_signup" => string_fake_time}) + |> FlowTester.start() + |> receive_message(%{ + text: "Leaf Page 2\n\nTest leaf content page 2\n" + }) + |> result_matches(%{name: "message_sent", value: "3"}) + end + + test "filter by gender" do + fake_time = ~U[2023-02-28 00:00:00Z] + # 3 minutes later + future_fake_time = DateTime.add(fake_time, 180, :second) + string_fake_time = DateTime.to_iso8601(fake_time) + + setup_flow() + |> FlowTester.set_fake_time(future_fake_time) + |> FlowTester.set_contact_properties(%{"gender" => "male", "push_messaging_signup" => string_fake_time}) + |> FlowTester.start() + |> receive_message(%{ + text: "Leaf Page 8\n\nTest leaf content page 8\n" + }) + |> result_matches(%{name: "message_sent", value: "9"}) + end end end diff --git a/Push messaging/README.md b/Push messaging/README.md new file mode 100644 index 0000000..0e01d2a --- /dev/null +++ b/Push messaging/README.md @@ -0,0 +1,8 @@ +# Push Messaging +Push messaging uses the additional features of ContentRepo's ordered content sets, where you can set a contact field, and a relative time, for each content page in the set. + +These flows will then take that ordered content set, and send those pages to the user using the schedule provided. + +This works using Turn's triggers with a time relative to the contact field `push_messaging_signup`. Instead of explicitly keeping track of which message index we have / should send to the user, we calculate which message should be sent using `push_messaging_signup` as well. This means that when a message is added to or removed from CMS the recipient doesn't miss any messages, but it does mean that the journey has to be changed in lockstep by +1. Adding the trigger for the new message +1. Adding the relavent `DetermineMessage` card with correct conditions \ No newline at end of file diff --git a/Stage based messaging/QA/flows_json/schedule_next_push_message.json b/Stage based messaging/QA/flows_json/schedule_next_push_message.json deleted file mode 100644 index 8f1cae6..0000000 --- a/Stage based messaging/QA/flows_json/schedule_next_push_message.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"odc-schedule-next-push-message","description":"Default description","uuid":"f291b782-72d3-49eb-8434-e47e388c2ea1","resources":[{"values":[{"value":"Content set complete, no more messages","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"e83350e8-d186-4813-8655-b0bd4e61b0f3"}],"uuid":"5cb737f4-a474-45ea-bdfb-9832e0093c0e"}],"flows":[{"label":null,"name":"stack","blocks":[{"label":null,"name":"schedule_next_message_case","type":"Core.Case","config":{},"tags":[],"uuid":"9e4d88f3-c69c-559d-a9fb-c92bccadd905","ui_metadata":{},"exits":[{"default":false,"name":"Exit for schedule_next_message_case_condition_0","config":{},"test":"count(contentset.body.pages) == contact.push_messaging_content_set_position","uuid":"73dceb01-8355-4a8d-87aa-b01fbda1779f","destination_block":"e8dcfb9c-3c9b-5c24-9a70-5e10d845d434","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"Exit for schedule_next_message_case_condition_1","config":{},"test":null,"uuid":"2911399a-bee7-4fa2-816b-28cae623154c","destination_block":"3b542704-3580-507b-9558-f2d5683a8bbb","semantic_label":null,"vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{}},{"label":null,"name":"page","type":"Core.Case","config":{},"tags":[],"uuid":"3b542704-3580-507b-9558-f2d5683a8bbb","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentset.body.pages[contact.push_messaging_content_set_position]","config":{},"test":"","uuid":"ce6477fe-4d9f-4684-aedf-3badb11861de","destination_block":"71e53c09-ff55-566b-b5d6-84297b45fbe9","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"expression":{},"meta":{"column":3,"line":17},"type":"expression"},"index":1}}}}}},{"label":null,"name":"contact_field","type":"Core.Case","config":{},"tags":[],"uuid":"71e53c09-ff55-566b-b5d6-84297b45fbe9","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"page.contact_field","config":{},"test":"","uuid":"d812eae4-1595-455e-b5d0-aac86ae6999d","destination_block":"eeaef0cf-3fb3-564e-8b04-c3a525512ff4","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"expression":{},"meta":{"column":3,"line":18},"type":"expression"},"index":0}}}}}},{"label":null,"name":"unit","type":"Core.Case","config":{},"tags":[],"uuid":"eeaef0cf-3fb3-564e-8b04-c3a525512ff4","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"find([[\"minutes\", \"m\"], [\"hours\", \"h\"], [\"days\", \"D\"], [\"months\", \"M\"]],\n&(&1[0] == page.unit))[1]","config":{},"test":"","uuid":"0e9550f6-c84a-4850-b09f-51fe2f6e83e4","destination_block":"ef95e080-1070-5291-aeed-ee5b54983e2d","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"expression":{},"meta":{"column":3,"line":20},"type":"expression"},"index":0}}}}}},{"label":null,"name":"offset","type":"Core.Case","config":{},"tags":[],"uuid":"ef95e080-1070-5291-aeed-ee5b54983e2d","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"if(page.before_or_after == \"before\", page.time * -1, page.time * 1)","config":{},"test":"","uuid":"2b85ef0f-2297-48bc-a722-a1e4c7a4e565","destination_block":"b97e80e8-0672-582f-8912-cfa06f396c38","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"expression":{},"meta":{"column":3,"line":26},"type":"expression"},"index":0}}}}}},{"label":null,"name":"timestamp","type":"Core.Case","config":{},"tags":[],"uuid":"b97e80e8-0672-582f-8912-cfa06f396c38","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"datetime_add(contact[contact_field], offset, unit)","config":{},"test":"","uuid":"0e77a179-9319-4f10-b5b4-edac58e77574","destination_block":"17555509-92df-5668-8359-34cc78221e7d","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"expression":{},"meta":{"column":3,"line":28},"type":"expression"},"index":0}}}}}},{"label":null,"name":"schedule_next_message_case_condition_1_schedule_stack","type":"Io.Turn.ScheduleFlow","config":{"flow_id":"8eb4490c-dc45-4c1f-bf10-1a95158ef45f","schedule_at":"timestamp"},"tags":[],"uuid":"17555509-92df-5668-8359-34cc78221e7d","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"schedule_next_message_case_condition_1_schedule_stack","config":{},"test":"","uuid":"d50c2b03-2987-435e-a097-2def1ed39454","destination_block":"9d2c50d9-b32e-502a-bb72-77055a88a4f9","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"meta":{"column":3,"line":30},"schedule_stack":{},"type":"schedule_stack"},"index":0}}}}}},{"label":null,"name":"message_scheduled_at","type":"Core.Output","config":{"value":"\"@timestamp\""},"tags":[],"uuid":"9d2c50d9-b32e-502a-bb72-77055a88a4f9","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"message_scheduled_at","config":{},"test":"","uuid":"cabe596a-7256-4ad4-964c-79f6ec5424b3","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":16},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"meta":{"column":3,"line":31},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"schedule_next_message_case_condition_0_text","type":"MobilePrimitives.Message","config":{"prompt":"5cb737f4-a474-45ea-bdfb-9832e0093c0e"},"tags":[],"uuid":"e8dcfb9c-3c9b-5c24-9a70-5e10d845d434","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"schedule_next_message_case_condition_0_text","config":{},"test":"","uuid":"d9bce2fe-942b-4264-b634-e984187c57c6","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"count(contentset.body.pages) == contact.push_messaging_content_set_position","meta":{"column":1,"line":11},"name":"ScheduleNextMessage","uuid":"9e4d88f3-c69c-559d-a9fb-c92bccadd905"},"card_item":{"meta":{"column":3,"line":13},"text":{},"type":"text"},"index":0}}}}}},{"label":null,"name":"contentset","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/@contact.push_messaging_content_set/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"13f70cd6-081d-57f6-903c-8562b00f3fb6","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"Default exit to \"ScheduleNextMessage\"","config":{},"test":"","uuid":"eac1f717-448c-4620-bf4e-57b2143ad036","destination_block":"9e4d88f3-c69c-559d-a9fb-c92bccadd905","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":1},"name":"GetContentSet","uuid":"26e7e17c-08a7-5f24-971c-0a542996de11"},"card_item":{"meta":{"column":3,"line":2},"type":"webhook","webhook":{}},"index":0}}}}}}],"last_modified":"2024-10-09T14:43:45.911316Z","uuid":"cce3cb8a-105b-5804-a279-dc3bc15e90bc","languages":[{"id":"e83350e8-d186-4813-8655-b0bd4e61b0f3","label":"English","variant":null,"iso_639_3":"eng","bcp_47":null}],"first_block_id":"13f70cd6-081d-57f6-903c-8562b00f3fb6","interaction_timeout":300,"vendor_metadata":{},"supported_modes":["RICH_MESSAGING"],"exit_block_id":""}],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file diff --git a/Stage based messaging/QA/flows_json/send_next_message_callback.json b/Stage based messaging/QA/flows_json/send_next_message_callback.json deleted file mode 100644 index 699fed5..0000000 --- a/Stage based messaging/QA/flows_json/send_next_message_callback.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"odc-send-next-message-callback","description":"Default description","uuid":"8eb4490c-dc45-4c1f-bf10-1a95158ef45f","resources":[{"values":[{"value":"@page.body.title\n\n@page.body.body.text.value.message\n","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"35b5e073-c595-4a10-92cc-3a797b138ee8"}],"uuid":"b67bf6c2-b62e-4d2f-8697-25052ecd1a2e"}],"flows":[{"label":null,"name":"stack","blocks":[{"label":null,"name":"contentset","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/@contact.push_messaging_content_set/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"13f70cd6-081d-57f6-903c-8562b00f3fb6","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentset","config":{},"test":"","uuid":"44d7a13a-cbb6-4ea8-8fe2-bd0f4700b849","destination_block":"952eb2a3-039f-539d-ab01-f0836b320e0c","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":1},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"meta":{"column":3,"line":2},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"contentset_item","type":"Core.Case","config":{},"tags":[],"uuid":"952eb2a3-039f-539d-ab01-f0836b320e0c","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentset.body.pages[contact.push_messaging_content_set_position]","config":{},"test":"","uuid":"68b5ef83-cb31-43c2-a7ee-75ef2ac0fbaf","destination_block":"088cd6c4-92f9-58c1-9a8b-bd069be737d9","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":1},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"expression":{},"meta":{"column":3,"line":10},"type":"expression"},"index":0}}}}}},{"label":null,"name":"page","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[["whatsapp","true"]],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/pages/@contentset_item.id/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"088cd6c4-92f9-58c1-9a8b-bd069be737d9","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"Default exit to \"SendMessage\"","config":{},"test":"","uuid":"fe72315d-ea89-4188-96b8-4f7a1ac7f1a8","destination_block":"4a33bb3c-ce05-5ffc-a22a-aedae889d235","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":1},"name":"GetMessage","uuid":"6f4f7f0b-c111-5248-8be2-104e696b4eeb"},"card_item":{"meta":{"column":3,"line":12},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"schedule_next_message_contact_update_push_messaging_content_set_position","type":"Core.SetContactProperty","config":{"set_contact_property":{"property_key":"push_messaging_content_set_position","property_value":"@(contact.push_messaging_content_set_position + 1)"}},"tags":[],"uuid":"f8b48d63-17e7-5be1-aeb4-ae59452ea22a","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"schedule_next_message_contact_update_push_messaging_content_set_position","config":{},"test":"","uuid":"a128b7cd-d60a-4d94-b10d-8d20a6999e7c","destination_block":"9f360c2c-2e98-543a-8515-1463951bc4e8","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":41},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"meta":{"column":3,"line":42},"type":"update_contact","update_contact":{}},"index":0}}}}}},{"label":null,"name":"schedule_next_message_run_stack","type":"Core.RunFlow","config":{"flow_id":"f291b782-72d3-49eb-8434-e47e388c2ea1"},"tags":[],"uuid":"9f360c2c-2e98-543a-8515-1463951bc4e8","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"schedule_next_message_run_stack","config":{},"test":"","uuid":"9ec4b824-b640-4801-bfc9-28b0b321dffc","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":41},"name":"ScheduleNextMessage","uuid":"7f247ac5-8884-504a-9f4b-74fdf1c28840"},"card_item":{"meta":{"column":3,"line":47},"run_stack":{},"type":"run_stack"},"index":0}}}}}},{"label":null,"name":"send_message_case","type":"Core.Case","config":{},"tags":[],"uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235","ui_metadata":{},"exits":[{"default":false,"name":"Exit for send_message_case_condition_0","config":{},"test":"page.body.body.is_whatsapp_template","uuid":"2048ac05-f1b2-4428-b778-412cd113b815","destination_block":"7c4e852a-5293-5fa3-a02e-5f5b6f37d76b","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"Exit for send_message_case_condition_1","config":{},"test":null,"uuid":"12226865-2081-4634-91fa-9bf305183297","destination_block":"373475d1-7f73-5db4-be43-481760e2ce92","semantic_label":null,"vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{}},{"label":null,"name":"message_sent","type":"Core.Output","config":{"value":"\"@page.body.id\""},"tags":[],"uuid":"373475d1-7f73-5db4-be43-481760e2ce92","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"message_sent","config":{},"test":"","uuid":"a276837a-0c31-42b9-8e1e-cff637c5381e","destination_block":"1474d567-3b5b-5b43-a26a-b0da3a20563e","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":31},"name":"SendMessage","uuid":"b2c3e2ca-ba63-5954-bcc6-346d54f6e74e"},"card_item":{"meta":{"column":3,"line":32},"type":"write_result","write_result":{}},"index":1}}}}}},{"label":null,"name":"send_message_case_condition_1_text","type":"MobilePrimitives.Message","config":{"prompt":"b67bf6c2-b62e-4d2f-8697-25052ecd1a2e"},"tags":[],"uuid":"1474d567-3b5b-5b43-a26a-b0da3a20563e","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"Default exit to \"ScheduleNextMessage\"","config":{},"test":"","uuid":"11a6dd5c-595f-4141-a97a-ea3883ccd83a","destination_block":"f8b48d63-17e7-5be1-aeb4-ae59452ea22a","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":31},"name":"SendMessage","uuid":"b2c3e2ca-ba63-5954-bcc6-346d54f6e74e"},"card_item":{"meta":{"column":3,"line":34},"text":{},"type":"text"},"index":0}}}}}},{"label":null,"name":"template_sent","type":"Core.Output","config":{"value":"\"@page.body.body.whatsapp_template_name\""},"tags":[],"uuid":"7c4e852a-5293-5fa3-a02e-5f5b6f37d76b","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"template_sent","config":{},"test":"","uuid":"cd43926c-7b01-4e67-84cc-8665b7d76165","destination_block":"e2a3909b-e829-55a0-b52d-20aaca46f855","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"page.body.body.is_whatsapp_template","meta":{"column":1,"line":22},"name":"SendMessage","uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235"},"card_item":{"meta":{"column":3,"line":23},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"send_message_case_condition_0_whatsapp_template_message","type":"Io.Turn.WhatsAppTemplateMessage","config":{"template":{"name":"\"@page.body.body.whatsapp_template_name\"","components":[{"index":null,"type":"body","parameters":[{"type":"text","text":"\"@contact.whatsapp_profile_name\""},{"type":"text","text":"\"Second\""}],"sub_type":null}],"language":{"code":"\"en_US\""},"tracking":null}},"tags":[],"uuid":"e2a3909b-e829-55a0-b52d-20aaca46f855","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"Default exit to \"ScheduleNextMessage\"","config":{},"test":"","uuid":"de9d7472-b854-4a53-9a83-ca182559cc0a","destination_block":"f8b48d63-17e7-5be1-aeb4-ae59452ea22a","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":"page.body.body.is_whatsapp_template","meta":{"column":1,"line":22},"name":"SendMessage","uuid":"4a33bb3c-ce05-5ffc-a22a-aedae889d235"},"card_item":{"meta":{"column":3,"line":25},"type":"whatsapp_template_message","whatsapp_template_message":{}},"index":0}}}}}}],"last_modified":"2024-10-09T14:34:21.036895Z","uuid":"cd151682-0f27-58a0-a7b3-281620f3513d","languages":[{"id":"35b5e073-c595-4a10-92cc-3a797b138ee8","label":"English","variant":null,"iso_639_3":"eng","bcp_47":null}],"first_block_id":"13f70cd6-081d-57f6-903c-8562b00f3fb6","interaction_timeout":300,"vendor_metadata":{},"supported_modes":["RICH_MESSAGING"],"exit_block_id":""}],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file diff --git a/Stage based messaging/QA/flows_json/signup.json b/Stage based messaging/QA/flows_json/signup.json deleted file mode 100644 index d2286df..0000000 --- a/Stage based messaging/QA/flows_json/signup.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"odc-signup","description":"Default description","uuid":"ce9d3d33-8760-47fe-a6c2-298991cb5764","resources":[{"values":[{"value":"Thank you for signing up! You will receive your first message shortly","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8dcaf30-67b1-4edf-9f62-409e4666e7d4"}],"uuid":"1576086c-40f3-47e5-91a2-ac71edbf1048"},{"values":[{"value":"Hi!\n\nWould you like to sign up to our testing messaging set?\n\nYou will receive 5 messages, one every 5 minutes.\n","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8dcaf30-67b1-4edf-9f62-409e4666e7d4"}],"uuid":"2d587c85-e8c1-485b-9b6a-36d7944b0031"},{"values":[{"value":"Yes, please","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8dcaf30-67b1-4edf-9f62-409e4666e7d4"}],"uuid":"40521dd8-a865-4efa-a4f7-02c2dba0156c"},{"values":[{"value":"No, thank you","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8dcaf30-67b1-4edf-9f62-409e4666e7d4"}],"uuid":"a5196014-ef27-4f79-88a0-8c3a9e2d0534"},{"values":[{"value":"Thank you! You will not be sent any messages","modes":["RICH_MESSAGING"],"content_type":"TEXT","mime_type":"text/plain","language_id":"a8dcaf30-67b1-4edf-9f62-409e4666e7d4"}],"uuid":"71ac4b3f-2a9c-4e70-b24e-9dc095d6ef60"}],"flows":[{"label":null,"name":"stack","blocks":[{"label":null,"name":"sbm_signup","type":"Core.Output","config":{"value":"\"@contentset.id\""},"tags":[],"uuid":"59c38606-7bd9-5030-869b-e41e3394814b","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"sbm_signup","config":{},"test":"","uuid":"fdda0206-ab68-4be2-8e54-e4cf03c0b17a","destination_block":"e3cf31d2-4870-50d8-b01a-d26d42a0e55f","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":25},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":26},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"complete_signup_contact_update_push_messaging_signup","type":"Core.SetContactProperty","config":{"set_contact_property":{"property_key":"push_messaging_signup","property_value":"@now()"}},"tags":[],"uuid":"e3cf31d2-4870-50d8-b01a-d26d42a0e55f","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_contact_update_push_messaging_signup","config":{},"test":"","uuid":"8693b4cd-b36b-4365-9ac1-7fdb0ecbaa9a","destination_block":"8b3ebbb1-b672-526a-82d5-07a4c4ec5d91","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":25},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":27},"type":"update_contact","update_contact":{}},"index":0}}}}}},{"label":null,"name":"complete_signup_contact_update_push_messaging_content_set","type":"Core.SetContactProperty","config":{"set_contact_property":{"property_key":"push_messaging_content_set","property_value":"@contentset.id"}},"tags":[],"uuid":"8b3ebbb1-b672-526a-82d5-07a4c4ec5d91","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_contact_update_push_messaging_content_set","config":{},"test":"","uuid":"a5c98b42-eb5f-4977-a2c5-dab5e22480cd","destination_block":"f00341ec-ee66-586c-952c-4535b6ce1b4b","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":25},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":28},"type":"update_contact","update_contact":{}},"index":0}}}}}},{"label":null,"name":"complete_signup_contact_update_push_messaging_content_set_position","type":"Core.SetContactProperty","config":{"set_contact_property":{"property_key":"push_messaging_content_set_position","property_value":0}},"tags":[],"uuid":"f00341ec-ee66-586c-952c-4535b6ce1b4b","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_contact_update_push_messaging_content_set_position","config":{},"test":"","uuid":"6ebb7580-71c2-4dba-bfca-3c2f05c462fd","destination_block":"6738d34e-e262-5bcf-a1e2-cd6a2014d89f","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":25},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":29},"type":"update_contact","update_contact":{}},"index":0}}}}}},{"label":null,"name":"complete_signup_text","type":"MobilePrimitives.Message","config":{"prompt":"1576086c-40f3-47e5-91a2-ac71edbf1048"},"tags":[],"uuid":"6738d34e-e262-5bcf-a1e2-cd6a2014d89f","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_text","config":{},"test":"","uuid":"48a2e846-685e-4964-acfb-f9c7313581fd","destination_block":"13395c42-8d9a-5c78-bd2a-594d96281210","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":25},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":30},"text":{},"type":"text"},"index":0}}}}}},{"label":null,"name":"complete_signup_run_stack","type":"Core.RunFlow","config":{"flow_id":"f291b782-72d3-49eb-8434-e47e388c2ea1"},"tags":[],"uuid":"13395c42-8d9a-5c78-bd2a-594d96281210","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"complete_signup_run_stack","config":{},"test":"","uuid":"edc2613d-a512-4d38-976e-87b54b2261dc","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":25},"name":"CompleteSignup","uuid":"452f5493-dd3d-5952-adfb-8b87e90abfe1"},"card_item":{"meta":{"column":3,"line":32},"run_stack":{},"type":"run_stack"},"index":0}}}}}},{"label":null,"name":"contentsets","type":"Io.Turn.Webhook","config":{"timeout":5000,"mode":"sync","body":null,"query":[],"url":"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/orderedcontent/","headers":[["Authorization","Token @global.config.contentrepo_token"]],"method":"GET","cache_ttl":60000},"tags":[],"uuid":"8a9d592c-78fe-51c6-b606-6cfe0ae61532","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"contentsets","config":{},"test":"","uuid":"2a0fc4cb-2201-4560-82f7-fdb2f1629839","destination_block":"39a6a669-d465-5cbf-9486-a7ad9903ade3","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":13},"name":"FetchContentSet","uuid":"92819633-e996-5604-98ba-cba44404a436"},"card_item":{"meta":{"column":3,"line":14},"type":"webhook","webhook":{}},"index":0}}}}}},{"label":null,"name":"contentset","type":"Core.Case","config":{},"tags":[],"uuid":"39a6a669-d465-5cbf-9486-a7ad9903ade3","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"find(contentsets.body.results, &(&1.name == \"demo\"))","config":{},"test":"","uuid":"5404687e-7750-4aee-b290-3494f1fc8752","destination_block":"59c38606-7bd9-5030-869b-e41e3394814b","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":13},"name":"FetchContentSet","uuid":"92819633-e996-5604-98ba-cba44404a436"},"card_item":{"expression":{},"meta":{"column":3,"line":22},"type":"expression"},"index":0}}}}}},{"label":null,"name":"ask_signup","type":"MobilePrimitives.SelectOneResponse","config":{"prompt":"2d587c85-e8c1-485b-9b6a-36d7944b0031","choices":[{"name":"fetch_content_set","prompt":"40521dd8-a865-4efa-a4f7-02c2dba0156c","test":"block.response = \"Yes, please\""},{"name":"exit","prompt":"a5196014-ef27-4f79-88a0-8c3a9e2d0534","test":"block.response = \"No, thank you\""}]},"tags":[],"uuid":"a66f9ab6-6df0-5346-8a85-ab464aa255ae","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":null,"name":"fetch_content_set","config":{},"test":"block.value = \"fetch_content_set\"","uuid":"d55a3d08-9038-4f78-a26b-313010183a2a","destination_block":"8a9d592c-78fe-51c6-b606-6cfe0ae61532","semantic_label":null,"vendor_metadata":{}},{"default":null,"name":"exit","config":{},"test":"block.value = \"exit\"","uuid":"3a84ec34-db5c-48bc-856d-4fcf7722d75a","destination_block":"9b1a8746-f34d-5e14-981d-8ebb7c4b0cd9","semantic_label":null,"vendor_metadata":{}},{"default":true,"name":"ask_signup","config":{},"test":"","uuid":"81acf5fa-5dc3-46d3-bfc3-e706d4919731","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"buttons_metadata":{},"card":{"condition":null,"meta":{"column":1,"line":1},"name":"AskSignup","uuid":"cfb4f4a6-6310-525f-a473-bc5b6eda1dc2"},"card_item":{"button_block":{},"meta":{"column":3,"line":2},"type":"button_block"},"index":0}}}}}},{"label":null,"name":"sbm_signup","type":"Core.Output","config":{"value":"\"no\""},"tags":[],"uuid":"9b1a8746-f34d-5e14-981d-8ebb7c4b0cd9","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"sbm_signup","config":{},"test":"","uuid":"197e656c-245d-4496-848a-3f705391607a","destination_block":"8826940e-f002-5b02-a070-76edf4d06773","semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":35},"name":"Exit","uuid":"eddf05c3-f6d4-5ba8-ab1a-e317ec59b710"},"card_item":{"meta":{"column":3,"line":36},"type":"write_result","write_result":{}},"index":0}}}}}},{"label":null,"name":"exit_text","type":"MobilePrimitives.Message","config":{"prompt":"71ac4b3f-2a9c-4e70-b24e-9dc095d6ef60"},"tags":[],"uuid":"8826940e-f002-5b02-a070-76edf4d06773","ui_metadata":{"canvas_coordinates":{"x":0,"y":0}},"exits":[{"default":true,"name":"exit_text","config":{},"test":"","uuid":"37e79d02-d069-4530-88f5-8a85daee98bf","destination_block":null,"semantic_label":"","vendor_metadata":{}}],"semantic_label":null,"vendor_metadata":{"io":{"turn":{"stacks_dsl":{"0.1.0":{"card":{"condition":null,"meta":{"column":1,"line":35},"name":"Exit","uuid":"eddf05c3-f6d4-5ba8-ab1a-e317ec59b710"},"card_item":{"meta":{"column":3,"line":37},"text":{},"type":"text"},"index":0}}}}}}],"last_modified":"2024-10-09T14:35:54.649919Z","uuid":"4803777a-bf6a-53e4-acae-4d5cdb5f47b7","languages":[{"id":"a8dcaf30-67b1-4edf-9f62-409e4666e7d4","label":"English","variant":null,"iso_639_3":"eng","bcp_47":null}],"first_block_id":"a66f9ab6-6df0-5346-8a85-ab464aa255ae","interaction_timeout":300,"vendor_metadata":{},"supported_modes":["RICH_MESSAGING"],"exit_block_id":""}],"vendor_metadata":{},"specification_version":"1.0.0-rc3"} \ No newline at end of file From f45515f93c8e7f3a476ca93b587e9b46243a13c0 Mon Sep 17 00:00:00 2001 From: Gerrit Vermeulen Date: Mon, 28 Oct 2024 15:31:58 +0200 Subject: [PATCH 7/7] Format code --- .../QA/tests/send_next_message_test.exs | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Push messaging/QA/tests/send_next_message_test.exs b/Push messaging/QA/tests/send_next_message_test.exs index 3fc8ed2..af11e3b 100644 --- a/Push messaging/QA/tests/send_next_message_test.exs +++ b/Push messaging/QA/tests/send_next_message_test.exs @@ -234,7 +234,7 @@ defmodule SendNextMessageTest do leaf_page5, leaf_page6, leaf_page7, - leaf_page8, + leaf_page8 ]) assert :ok = @@ -242,7 +242,7 @@ defmodule SendNextMessageTest do ocs1, ocs2, ocs3, - ocs4, + ocs4 ]) # Return the adapter. @@ -254,7 +254,11 @@ defmodule SendNextMessageTest do defp setup_contact_fields(context) do context - |> FlowTester.set_contact_properties(%{"gender" => "", "year_of_birth" => "1988", "relationship_status" => ""}) + |> FlowTester.set_contact_properties(%{ + "gender" => "", + "year_of_birth" => "1988", + "relationship_status" => "" + }) end defp setup_flow() do @@ -305,7 +309,10 @@ defmodule SendNextMessageTest do setup_flow() |> FlowTester.set_fake_time(future_fake_time) - |> FlowTester.set_contact_properties(%{"push_messaging_signup" => string_fake_time, "relationship_status" => "in a relationship"}) + |> FlowTester.set_contact_properties(%{ + "push_messaging_signup" => string_fake_time, + "relationship_status" => "in a relationship" + }) |> FlowTester.start() |> receive_message(%{ text: "Leaf Page 6\n\nTest leaf content page 6\n" @@ -321,7 +328,10 @@ defmodule SendNextMessageTest do setup_flow() |> FlowTester.set_fake_time(future_fake_time) - |> FlowTester.set_contact_properties(%{"year_of_birth" => "2010", "push_messaging_signup" => string_fake_time}) + |> FlowTester.set_contact_properties(%{ + "year_of_birth" => "2010", + "push_messaging_signup" => string_fake_time + }) |> FlowTester.start() |> receive_message(%{ text: "Leaf Page 2\n\nTest leaf content page 2\n" @@ -337,7 +347,10 @@ defmodule SendNextMessageTest do setup_flow() |> FlowTester.set_fake_time(future_fake_time) - |> FlowTester.set_contact_properties(%{"gender" => "male", "push_messaging_signup" => string_fake_time}) + |> FlowTester.set_contact_properties(%{ + "gender" => "male", + "push_messaging_signup" => string_fake_time + }) |> FlowTester.start() |> receive_message(%{ text: "Leaf Page 8\n\nTest leaf content page 8\n"