From c4a1ffa078efa380dcaa3539663f8c80afbcfff1 Mon Sep 17 00:00:00 2001 From: annalise090 Date: Mon, 20 Apr 2026 15:45:42 -0400 Subject: [PATCH] Add new Aselo webchat for ZW Stg --- .../configSrc/zw/common.json | 0 .../configSrc/zw/staging.json | 6 + .../configSrc/zw/translations/en-US.json | 12 ++ .../zw/v1/webchat/PreEngagementForm.json | 4 +- twilio-iac/helplines/zw/staging.hcl | 11 +- ...ssaging-greeting-message-blocking-v2.tftpl | 167 ++++++++++++++++++ 6 files changed, 197 insertions(+), 3 deletions(-) create mode 100644 aselo-webchat-react-app/configSrc/zw/common.json create mode 100644 aselo-webchat-react-app/configSrc/zw/staging.json create mode 100644 aselo-webchat-react-app/configSrc/zw/translations/en-US.json create mode 100644 twilio-iac/helplines/zw/templates/studio-flows/messaging-greeting-message-blocking-v2.tftpl diff --git a/aselo-webchat-react-app/configSrc/zw/common.json b/aselo-webchat-react-app/configSrc/zw/common.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/aselo-webchat-react-app/configSrc/zw/staging.json b/aselo-webchat-react-app/configSrc/zw/staging.json new file mode 100644 index 0000000000..28391219ce --- /dev/null +++ b/aselo-webchat-react-app/configSrc/zw/staging.json @@ -0,0 +1,6 @@ +{ + "deploymentKey": "REPLACE_WITH_ZW_STAGING_CONVERSATIONS_SERVICE_SID", + "environment": "staging", + "aseloBackendUrl": "https://hrm-staging.tl.techmatters.org", + "definitionVersion": "zw-v1" +} \ No newline at end of file diff --git a/aselo-webchat-react-app/configSrc/zw/translations/en-US.json b/aselo-webchat-react-app/configSrc/zw/translations/en-US.json new file mode 100644 index 0000000000..75f20ae88c --- /dev/null +++ b/aselo-webchat-react-app/configSrc/zw/translations/en-US.json @@ -0,0 +1,12 @@ +{ + "WelcomeMessage": "Childline Zimbabwe", + "MessageCanvasTrayContent": "", + "MessageInputDisabledReasonHold": + "Thank you very much for this information. We'll transfer you now. Please hold for a counsellor.", + "AutoFirstMessage": "Incoming webchat contact from", + "PreEngagementDescription": + "Thank you for contacting Childline Zimbabwe. To chat with a counsellor, please type your name and select the Start Chat button.", + "WhatIsYourName": "What is your name?", + "StartChat": "Start Chat!", + "MessagePhase-MessageBubble-OtherParticipantMessageSenderName": "Childline Zimbabwe Counsellor" +} \ No newline at end of file diff --git a/lambdas/packages/hrm-form-definitions/form-definitions/zw/v1/webchat/PreEngagementForm.json b/lambdas/packages/hrm-form-definitions/form-definitions/zw/v1/webchat/PreEngagementForm.json index 8bb3646437..0226a85f07 100644 --- a/lambdas/packages/hrm-form-definitions/form-definitions/zw/v1/webchat/PreEngagementForm.json +++ b/lambdas/packages/hrm-form-definitions/form-definitions/zw/v1/webchat/PreEngagementForm.json @@ -3,11 +3,11 @@ "submitLabel": "StartChat", "fields": [ { - "type": "input", + "type": "input-text", "name": "friendlyName", "label": "WhatIsYourName", "placeholder": "Guest", "required": true } ] -} +} \ No newline at end of file diff --git a/twilio-iac/helplines/zw/staging.hcl b/twilio-iac/helplines/zw/staging.hcl index f7e4dc6d6a..ca6af7cb58 100644 --- a/twilio-iac/helplines/zw/staging.hcl +++ b/twilio-iac/helplines/zw/staging.hcl @@ -15,13 +15,22 @@ locals { } channels = { + chat : { + messaging_mode = "conversations" + channel_type = "chat" + contact_identity = "" + templatefile = "/app/twilio-iac/helplines/zw/templates/studio-flows/messaging-greeting-message-blocking-v2.tftpl" + channel_flow_vars = { + chat_greeting_message = "Thank you for contacting Childline Zimbabwe, a counsellor will be with you shortly. If this is an emergency or you wait longer than 30 min, we recommend you call us for free at 116. You can also contact us on WhatsApp at +263 732 116 116." + } + chatbot_unique_names = [] + }, webchat : { channel_type = "web" contact_identity = "" templatefile = "/app/twilio-iac/helplines/zw/templates/studio-flows/messaging-greeting-message-blocking.tftpl" channel_flow_vars = { chat_greeting_message = "Thank you for contacting Childline Zimbabwe, a counsellor will be with you shortly. If this is an emergency or you wait longer than 30 min, we recommend you call us for free at 116. You can also contact us on WhatsApp at +263 732 116 116." - } chatbot_unique_names = [] }, diff --git a/twilio-iac/helplines/zw/templates/studio-flows/messaging-greeting-message-blocking-v2.tftpl b/twilio-iac/helplines/zw/templates/studio-flows/messaging-greeting-message-blocking-v2.tftpl new file mode 100644 index 0000000000..8dc6b9d7fc --- /dev/null +++ b/twilio-iac/helplines/zw/templates/studio-flows/messaging-greeting-message-blocking-v2.tftpl @@ -0,0 +1,167 @@ +${ + jsonencode( + { + "description": flow_description, + "states": [ + { + "name": "Trigger", + "type": "trigger", + "transitions": [ + { + "event": "incomingMessage" + }, + { + "event": "incomingCall" + }, + { + "next": "getProfileFlagsForIdentifiers", + "event": "incomingConversationMessage" + }, + { + "event": "incomingRequest" + }, + { + "event": "incomingParent" + } + ], + "properties": { + "offset": { + "x": -90, + "y": -90 + } + } + }, + { + "name": "attributes", + "type": "send-to-flex", + "transitions": [ + { + "event": "callComplete" + }, + { + "event": "failedToEnqueue" + }, + { + "event": "callFailure" + } + ], + "properties": { + "offset": { + "x": -50, + "y": 860 + }, + "workflow": workflow_sids["master"], + "channel": task_channel_sids["chat"], + "attributes":channel_attributes["default"] + } + }, + { + "name": "send_welcome_message", + "type": "send-message", + "transitions": [ + { + "next": "attributes", + "event": "sent" + }, + { + "event": "failed" + } + ], + "properties": { + "offset": { + "x": -50, + "y": 610 + }, + "service": "{{trigger.conversation.InstanceSid}}", + "channel": "{{trigger.conversation.ChannelSid}}", + "from": flow_vars["widget_from"], + "to": "{{contact.channel.address}}", + "body": channel_flow_vars["chat_greeting_message"] + } + }, + { + "name": "getProfileFlagsForIdentifiers", + "type": "make-http-request", + "transitions": [ + { + "next": "contact_routing", + "event": "success" + }, + { + "event": "failed" + } + ], + "properties": { + "offset": { + "x": 90, + "y": 80 + }, + "method": "POST", + "content_type": "application/json;charset=utf-8", + "body": "{\"trigger\": {{trigger | to_json}}}", + "url": "${get_profile_flags_for_identifier_base_url}/getProfileFlagsForIdentifier" + } + }, + { + "name": "contact_routing", + "type": "split-based-on", + "transitions": [ + { + "next": "send_welcome_message", + "event": "noMatch" + }, + { + "next": "blocked", + "event": "match", + "conditions": [ + { + "friendly_name": "If value equal_to blocked", + "arguments": [ + "{{widgets.getProfileFlagsForIdentifiers.parsed}}" + ], + "type": "contains", + "value": "blocked" + } + ] + } + ], + "properties": { + "input": "{{widgets.getProfileFlagsForIdentifiers.parsed}}", + "offset": { + "x": 190, + "y": 320 + } + } + }, + { + "name": "blocked", + "type": "send-message", + "transitions": [ + { + "event": "sent" + }, + { + "event": "failed" + } + ], + "properties": { + "offset": { + "x": 550, + "y": 600 + }, + "service": "{{trigger.conversation.InstanceSid}}", + "channel": "{{trigger.conversation.ChannelSid}}", + "from": flow_vars["widget_from"], + "to": "{{contact.channel.address}}", + "body": flow_vars["chat_blocked_message"] + } + } + ], + "initial_state": "Trigger", + "flags": { + "allow_concurrent_calls": true + } +} + + ) +} \ No newline at end of file