diff --git a/aselo-webchat-react-app/configSrc/tz/common.json b/aselo-webchat-react-app/configSrc/tz/common.json new file mode 100644 index 0000000000..462c44a4ef --- /dev/null +++ b/aselo-webchat-react-app/configSrc/tz/common.json @@ -0,0 +1,15 @@ +{ + "fileAttachment": { + "enabled": true, + "maxFileSize": 16777216, + "acceptedExtensions": ["jpg", "jpeg", "png", "amr", "mp3", "mp4", "pdf", "txt"] + }, + "emojiPicker": { + "enabled": true, + "blockedEmojis": [] + }, + "alwaysOpen": false, + "helplineCode": "tz", + "captureIp": true, + "definitionVersion": "tz-v1" +} \ No newline at end of file diff --git a/aselo-webchat-react-app/configSrc/tz/staging.json b/aselo-webchat-react-app/configSrc/tz/staging.json new file mode 100644 index 0000000000..a0e9ff34e7 --- /dev/null +++ b/aselo-webchat-react-app/configSrc/tz/staging.json @@ -0,0 +1,4 @@ +{ + "environment": "staging", + "aseloBackendUrl": "https://hrm-staging.tl.techmatters.org" +} diff --git a/aselo-webchat-react-app/configSrc/tz/translations/en-US.json b/aselo-webchat-react-app/configSrc/tz/translations/en-US.json new file mode 100644 index 0000000000..f9ab48b071 --- /dev/null +++ b/aselo-webchat-react-app/configSrc/tz/translations/en-US.json @@ -0,0 +1,11 @@ +{ + "WelcomeMessage": "National Child Helpline (116)", + "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 National Child Helpline (116). To chat with a counsellor, please type your name and select the Start Chat button.", + "WhatIsYourName": "What is your name?", + "StartChat": "Start Chat!", + "SelectLanguage": "Select your language", + "MessagePhase-MessageBubble-OtherParticipantMessageSenderName": "Counsellor" +} \ No newline at end of file diff --git a/aselo-webchat-react-app/configSrc/tz/translations/sw_TZ.json b/aselo-webchat-react-app/configSrc/tz/translations/sw_TZ.json new file mode 100644 index 0000000000..bfb0357431 --- /dev/null +++ b/aselo-webchat-react-app/configSrc/tz/translations/sw_TZ.json @@ -0,0 +1,11 @@ +{ + "WelcomeMessage": "National Child Helpline (116)", + "MessageCanvasTrayContent": "", + "MessageInputDisabledReasonHold": "Asante sana kwa maelezo haya. Tutakuunganisha sasa. Tafadhali subiri ili kuzungumza na mshauri.", + "AutoFirstMessage": "Mawasiliano ya gumzo la wavuti yanayoingia kutoka", + "PreEngagementDescription": "Asante kwa kuwasiliana na National Child Helpline (116). Ili kuzungumza na mshauri, tafadhali andika jina lako na bonyeza kitufe cha Anza Gumzo.", + "WhatIsYourName": "Jina lako ni nani?", + "StartChat": "Anza Gumzo!", + "SelectLanguage": "Chagua lugha yako", + "MessagePhase-MessageBubble-OtherParticipantMessageSenderName": "Counsellor" +} \ No newline at end of file diff --git a/aselo-webchat-react-app/configSrc/zm/common.json b/aselo-webchat-react-app/configSrc/zm/common.json new file mode 100644 index 0000000000..8ae75bc76e --- /dev/null +++ b/aselo-webchat-react-app/configSrc/zm/common.json @@ -0,0 +1,15 @@ +{ + "fileAttachment": { + "enabled": true, + "maxFileSize": 16777216, + "acceptedExtensions": ["jpg", "jpeg", "png", "amr", "mp3", "mp4", "pdf", "txt"] + }, + "emojiPicker": { + "enabled": true, + "blockedEmojis": [] + }, + "alwaysOpen": false, + "helplineCode": "zm", + "captureIp": true, + "definitionVersion": "zm-v1" +} \ No newline at end of file diff --git a/aselo-webchat-react-app/configSrc/zm/staging.json b/aselo-webchat-react-app/configSrc/zm/staging.json new file mode 100644 index 0000000000..a0e9ff34e7 --- /dev/null +++ b/aselo-webchat-react-app/configSrc/zm/staging.json @@ -0,0 +1,4 @@ +{ + "environment": "staging", + "aseloBackendUrl": "https://hrm-staging.tl.techmatters.org" +} diff --git a/aselo-webchat-react-app/configSrc/zm/translations/Bemba.json b/aselo-webchat-react-app/configSrc/zm/translations/Bemba.json new file mode 100644 index 0000000000..812a5de644 --- /dev/null +++ b/aselo-webchat-react-app/configSrc/zm/translations/Bemba.json @@ -0,0 +1,16 @@ +{ + "MessageInputDisabledReasonHold": "Twalamutuma nomba kuli Chimbusa, pembeleni ichimpusa nomba.", + "EntryPointTagLine": "Landeni naifwe", + "PreEngagementDescription": "tiyeni twambeko ilyashi", + "Today": "Lelo", + "InputPlaceHolder": "Taipeni ilyashi", + "WelcomeMessage": "Mwaiseni kuli ChildLine Zambia!", + "Yesterday": "Mailo", + "TypingIndicator": "Ichimbusa chile taipa ilyashi", + "MessageCanvasTrayButton": "Yambeni kutaipa ilyashi imbi", + "MessageCanvasTrayContent": "", + "AutoFirstMessage": "", + "StartChat": "Yambeni ukulanda mukwai!", + "SelectLanguage": "Select your language", + "MessagePhase-MessageBubble-OtherParticipantMessageSenderName": "Counsellor" +} \ No newline at end of file diff --git a/aselo-webchat-react-app/configSrc/zm/translations/Kaonde.json b/aselo-webchat-react-app/configSrc/zm/translations/Kaonde.json new file mode 100644 index 0000000000..15389f4f5a --- /dev/null +++ b/aselo-webchat-react-app/configSrc/zm/translations/Kaonde.json @@ -0,0 +1,16 @@ +{ + "MessageInputDisabledReasonHold": "Tusakwimi tuma pembelelai, pacheche ba nkwasho.", + "EntryPointTagLine": "Isambai natweba", + "PreEngagementDescription": "Twayayi tutatule", + "Today": "Lelo", + "InputPlaceHolder": "Lembayi mulubwe", + "WelcomeMessage": "Mwaiyayi mwani ku ChildLine Zambia!", + "Yesterday": "Kesha", + "TypingIndicator": "Nkwasho wena kunemba", + "MessageCanvasTrayButton": "Tatulayi kwisamba kipya kipya", + "MessageCanvasTrayContent": "", + "AutoFirstMessage": "", + "StartChat": "Twayayi twisambe!", + "SelectLanguage": "Select your language", + "MessagePhase-MessageBubble-OtherParticipantMessageSenderName": "Counsellor" +} \ No newline at end of file diff --git a/aselo-webchat-react-app/configSrc/zm/translations/Lozi.json b/aselo-webchat-react-app/configSrc/zm/translations/Lozi.json new file mode 100644 index 0000000000..ce9c838ea3 --- /dev/null +++ b/aselo-webchat-react-app/configSrc/zm/translations/Lozi.json @@ -0,0 +1,16 @@ +{ + "MessageInputDisabledReasonHold": "Luka kuisa ku mwelezi, u libelele hanyani.", + "EntryPointTagLine": "Alukalise kwa mbola", + "PreEngagementDescription": "A lukaliseni kwa mbola", + "Today": "Lelo", + "InputPlaceHolder": "Nola linusa", + "WelcomeMessage": "Wamuhezwi ku ba ChildLine Zambia!", + "Yesterday": "Mabani", + "TypingIndicator": "Mwelezi wa nola", + "MessageCanvasTrayButton": "Alukalise kwa mbola", + "MessageCanvasTrayContent": "", + "AutoFirstMessage": "Incoming webchat contact from", + "StartChat": "Alukalise kwa mbola!", + "SelectLanguage": "Select your language", + "MessagePhase-MessageBubble-OtherParticipantMessageSenderName": "Counsellor" +} \ No newline at end of file diff --git a/aselo-webchat-react-app/configSrc/zm/translations/Lunda.json b/aselo-webchat-react-app/configSrc/zm/translations/Lunda.json new file mode 100644 index 0000000000..d0cfae52cb --- /dev/null +++ b/aselo-webchat-react-app/configSrc/zm/translations/Lunda.json @@ -0,0 +1,16 @@ +{ + "MessageInputDisabledReasonHold": "Chuna kuitemesha ahembeleliku chanti kundi ankhong'u.", + "EntryPointTagLine": "Tuhanjiki mwani", + "PreEngagementDescription": "Tutachikiku", + "Today": "Lelu", + "InputPlaceHolder": "Sonekenu Muzhimbu", + "WelcomeMessage": "Shikenu mwani kuchota cha ChildLine Zambia!", + "Yesterday": "Haloshi", + "TypingIndicator": "Nkhong'u nakusoneka Muzhimbu", + "MessageCanvasTrayButton": "Tachikenu kuhanjika", + "MessageCanvasTrayContent": "", + "AutoFirstMessage": "", + "StartChat": "Tachikenu kuhanjeka!", + "SelectLanguage": "Select your language", + "MessagePhase-MessageBubble-OtherParticipantMessageSenderName": "Counsellor" +} \ No newline at end of file diff --git a/aselo-webchat-react-app/configSrc/zm/translations/Nyanja.json b/aselo-webchat-react-app/configSrc/zm/translations/Nyanja.json new file mode 100644 index 0000000000..82b71c6919 --- /dev/null +++ b/aselo-webchat-react-app/configSrc/zm/translations/Nyanja.json @@ -0,0 +1,16 @@ +{ + "MessageInputDisabledReasonHold": "Chonde tipeleka lamya lanu ku wa uphungu telo dikilani.", + "EntryPointTagLine": "Lankhulisanani nafe!", + "PreEngagementDescription": "Tiyeni tiyembe kulankhulisana", + "Today": "Lelo", + "InputPlaceHolder": "Lembani zimene mufuna kulemba", + "WelcomeMessage": "Mwalandilidwa kuno ku ChildLine Zambia!", + "Yesterday": "Dzulo!", + "TypingIndicator": "Wauphungu alikulemba!", + "MessageCanvasTrayButton": "Yambani nkhani ina!", + "MessageCanvasTrayContent": "", + "AutoFirstMessage": "", + "StartChat": "Yambani kulankhula!", + "SelectLanguage": "Select your language", + "MessagePhase-MessageBubble-OtherParticipantMessageSenderName": "Counsellor" +} \ No newline at end of file diff --git a/aselo-webchat-react-app/configSrc/zm/translations/Tonga.json b/aselo-webchat-react-app/configSrc/zm/translations/Tonga.json new file mode 100644 index 0000000000..cb26d99895 --- /dev/null +++ b/aselo-webchat-react-app/configSrc/zm/translations/Tonga.json @@ -0,0 +1,16 @@ +{ + "MessageInputDisabledReasonHold": "Tulamuswaanganya lino asikuyumya-yumya/sikulaya. Amujatilile notucimuswaanganya.", + "EntryPointTagLine": "Amubandike andiswe", + "PreEngagementDescription": "Atukanke/atutalike", + "Today": "Sunu", + "InputPlaceHolder": "Lemba", + "WelcomeMessage": "Mwatambulwa ku ChildLine Zambia!", + "Yesterday": "Jilo", + "TypingIndicator": "Sikuyumyayumya watalika kulemba", + "MessageCanvasTrayButton": "Talika mubandi mupya", + "MessageCanvasTrayContent": "", + "AutoFirstMessage": "", + "StartChat": "Atubandike!", + "SelectLanguage": "Select your language", + "MessagePhase-MessageBubble-OtherParticipantMessageSenderName": "Counsellor" +} \ No newline at end of file diff --git a/aselo-webchat-react-app/configSrc/zm/translations/en-US.json b/aselo-webchat-react-app/configSrc/zm/translations/en-US.json new file mode 100644 index 0000000000..98b943b996 --- /dev/null +++ b/aselo-webchat-react-app/configSrc/zm/translations/en-US.json @@ -0,0 +1,16 @@ +{ + "MessageInputDisabledReasonHold": "We'll transfer you now. Please hold for a counsellor.", + "EntryPointTagLine": "Chat with us", + "PreEngagementDescription": "Let's get started", + "Today": "Today", + "InputPlaceHolder": "Type Message", + "WelcomeMessage": "Welcome to ChildLine Zambia!", + "Yesterday": "Yesterday", + "TypingIndicator": "Counselor is typing", + "MessageCanvasTrayButton": "Start New Chat", + "MessageCanvasTrayContent": "", + "AutoFirstMessage": "Incoming webchat contact from", + "StartChat": "Start Chat!", + "SelectLanguage": "Select your language", + "MessagePhase-MessageBubble-OtherParticipantMessageSenderName": "Counsellor" +} \ No newline at end of file diff --git a/twilio-iac/helplines/defaults.hcl b/twilio-iac/helplines/defaults.hcl index f5eb6ffb53..394725e541 100644 --- a/twilio-iac/helplines/defaults.hcl +++ b/twilio-iac/helplines/defaults.hcl @@ -15,6 +15,7 @@ locals { enable_external_recordings = false channel_attributes = { + chat : "/app/twilio-iac/helplines/templates/channel-attributes/chat-conversations.tftpl" webchat : "/app/twilio-iac/helplines/templates/channel-attributes/webchat.tftpl" voice : "/app/twilio-iac/helplines/templates/channel-attributes/voice.tftpl" default : "/app/twilio-iac/helplines/templates/channel-attributes/default.tftpl" diff --git a/twilio-iac/helplines/templates/channel-attributes/chat-conversations.tftpl b/twilio-iac/helplines/templates/channel-attributes/chat-conversations.tftpl new file mode 100644 index 0000000000..d95a426b9f --- /dev/null +++ b/twilio-iac/helplines/templates/channel-attributes/chat-conversations.tftpl @@ -0,0 +1,13 @@ +{ + "e2eTestMode": "{{trigger.conversations.ChannelAttributes.pre_engagement_data.e2eTestMode}}", + "ip": "{{trigger.conversations.ChannelAttributes.pre_engagement_data.ip}}", + "firstName": "{{trigger.conversations.ChannelAttributes.from}}", + "channelType": "{{trigger.conversations.ChannelAttributes.channel_type}}", + "channelSid": "{{trigger.conversations.ChannelSid}}", + "helpline": "{{trigger.conversations.ChannelAttributes.pre_engagement_data.helpline}}", + "language":"${task_language}", + "ignoreAgent": "", + "transferTargetType": "", + "preEngagementData": {{trigger.conversations.ChannelAttributes.pre_engagement_data | to_json}}, + "memory": {{trigger.conversations.ChannelAttributes.memory | to_json}} +} diff --git a/twilio-iac/helplines/tz/staging.hcl b/twilio-iac/helplines/tz/staging.hcl index 0a0aa7232d..86985d1f88 100644 --- a/twilio-iac/helplines/tz/staging.hcl +++ b/twilio-iac/helplines/tz/staging.hcl @@ -29,11 +29,19 @@ locals { channel_flow_vars = {} chatbot_unique_names = [] }, + chat : { + messaging_mode = "conversations" + channel_type = "chat" + contact_identity = "" + templatefile = "/app/twilio-iac/helplines/tz/templates/studio-flows/messaging-blocking-conv.tftpl" + channel_flow_vars = {} + chatbot_unique_names = [] + }, facebook_mainland : { messaging_mode = "conversations" channel_type = "messenger" contact_identity = "messenger:565233119996327" - templatefile = "/app/twilio-iac/helplines/tz/templates/studio-flows/messaging-blocking-conv-lambda.tftpl" + templatefile = "/app/twilio-iac/helplines/tz/templates/studio-flows/messaging-blocking-conv.tftpl" channel_flow_vars = {} chatbot_unique_names = [] }, @@ -41,7 +49,7 @@ locals { messaging_mode = "conversations" channel_type = "messenger" contact_identity = "messenger:709371978917654" - templatefile = "/app/twilio-iac/helplines/tz/templates/studio-flows/messaging-blocking-conv-lambda.tftpl" + templatefile = "/app/twilio-iac/helplines/tz/templates/studio-flows/messaging-blocking-conv.tftpl" channel_flow_vars = {} chatbot_unique_names = [] }, @@ -49,7 +57,7 @@ locals { messaging_mode = "conversations" channel_type = "whatsapp" contact_identity = "whatsapp:+18454704393" - templatefile = "/app/twilio-iac/helplines/templates/studio-flows/messaging-lex-v3-blocking.tftpl" + templatefile = "/app/twilio-iac/helplines/templates/studio-flows/messaging-lex-v3-blocking-lambda.tftpl" channel_flow_vars = {} chatbot_unique_names = [] }, diff --git a/twilio-iac/helplines/tz/templates/studio-flows/messaging-blocking.tftpl b/twilio-iac/helplines/tz/templates/studio-flows/messaging-blocking.tftpl new file mode 100644 index 0000000000..f77136bf54 --- /dev/null +++ b/twilio-iac/helplines/tz/templates/studio-flows/messaging-blocking.tftpl @@ -0,0 +1,194 @@ +${ + jsonencode( + { + "states": [ + { + "name": "Trigger", + "type": "trigger", + "transitions": [ + { + "next": "getProfileFlagsForIdentifier", + "event": "incomingMessage" + }, + { + "event": "incomingCall" + }, + { + "event": "incomingConversationMessage" + }, + { + "event": "incomingRequest" + }, + { + "event": "incomingParent" + } + ], + "properties": { + "offset": { + "x": -160, + "y": -460 + } + } + }, + { + "name": "getProfileFlagsForIdentifier", + "type": "make-http-request", + "transitions": [ + { + "next": "contact_routing", + "event": "success" + }, + { + "next": "send_message", + "event": "failed" + } + ], + "properties": { + "offset": { + "x": -350, + "y": -280 + }, + "method": "POST", + "content_type": "application/json;charset=utf-8", + "body": "{ \"trigger\": {{trigger | to_json}}, \"channelType\": \"{% if trigger.message.ChannelAttributes.channel_type %}{{trigger.message.ChannelAttributes.channel_type}}{% else %}{{trigger.message.Source | downcase}}{% endif %}\"}", + "url": "${get_profile_flags_for_identifier_base_url}/getProfileFlagsForIdentifier" + } + }, + { + "name": "send_blocked_message", + "type": "send-message", + "transitions": [ + { + "event": "sent" + }, + { + "event": "failed" + } + ], + "properties": { + "offset": { + "x": -640, + "y": 210 + }, + "service": "{{trigger.message.InstanceSid}}", + "channel": "{{trigger.message.ChannelSid}}", + "from": flow_vars["widget_from"], + "to": "{{contact.channel.address}}", + "body": flow_vars["chat_blocked_message"] + } + }, + { + "name": "contact_routing", + "type": "split-based-on", + "transitions": [ + { + "next": "send_message", + "event": "noMatch" + }, + { + "next": "send_blocked_message", + "event": "match", + "conditions": [ + { + "friendly_name": "If value contains blocked", + "arguments": [ + "{{widgets.getProfileFlagsForIdentifier.parsed.flags}}" + ], + "type": "contains", + "value": "blocked" + } + ] + } + ], + "properties": { + "input": "{{widgets.getProfileFlagsForIdentifier.parsed.flags}}", + "offset": { + "x": -690, + "y": -60 + } + } + }, + { + "name": "attributes", + "type": "send-to-flex", + "transitions": [ + { + "event": "callComplete" + }, + { + "next": "webhook_notify_failed_to_enqueue", + "event": "failedToEnqueue" + }, + { + "event": "callFailure" + } + ], + "type": "send-to-flex", + "name": "attributes", + "properties": { + "attributes": channel_attributes["default"], + "workflow": workflow_sids["master"], + "channel": task_channel_sids["chat"], + "offset": { + "y": 250, + "x": 80 + } + } + }, + { + "name": "webhook_notify_failed_to_enqueue", + "type": "make-http-request", + "transitions": [ + { + "event": "success" + }, + { + "event": "failed" + } + ], + "properties": { + "offset": { + "x": 540, + "y": 1250 + }, + "method": "POST", + "content_type": "application/json;charset=utf-8", + "body": "{ \"text\": \"Issue detected [Failed to Enqueue] on ${short_helpline} ${short_environment} Flow SID: {{flow.flow_sid}} Execution SID: {{flow.sid}} \" }", + "add_twilio_auth": false, + "url": webhook_url_studio_errors + } + }, + { + "name": "send_message", + "type": "send-message", + "transitions": [ + { + "next": "attributes", + "event": "sent" + }, + { + "next": "webhook_notify_failed_to_enqueue", + "event": "failed" + } + ], + "properties": { + "offset": { + "x": 160, + "y": 0 + }, + "service": "{{trigger.message.InstanceSid}}", + "channel": "{{trigger.message.ChannelSid}}", + "from": flow_vars["widget_from"], + "to": "{{contact.channel.address}}", + "body":flow_vars["chat_greeting_message"] + } + } + ], + "initial_state": "Trigger", + "flags": { + "allow_concurrent_calls": true + }, + "description": flow_description + } + ) + } \ No newline at end of file diff --git a/twilio-iac/helplines/zm/staging.hcl b/twilio-iac/helplines/zm/staging.hcl index 6ddc11e67f..49dbed8e7a 100644 --- a/twilio-iac/helplines/zm/staging.hcl +++ b/twilio-iac/helplines/zm/staging.hcl @@ -13,6 +13,14 @@ locals { channel_flow_vars = {} chatbot_unique_names = [] }, + chat : { + channel_type = "chat" + messaging_mode = "conversations" + contact_identity = "" + templatefile = "/app/twilio-iac/helplines/zm/templates/studio-flows/messaging-webchat-conv-lambda-sd.tftpl" + channel_flow_vars = {} + chatbot_unique_names = [] + }, facebook : { messaging_mode = "conversations" channel_type = "messenger" diff --git a/twilio-iac/helplines/zm/templates/studio-flows/messaging-webchat-conv-lambda-sd.tftpl b/twilio-iac/helplines/zm/templates/studio-flows/messaging-webchat-conv-lambda-sd.tftpl new file mode 100644 index 0000000000..1004c642cb --- /dev/null +++ b/twilio-iac/helplines/zm/templates/studio-flows/messaging-webchat-conv-lambda-sd.tftpl @@ -0,0 +1,494 @@ +${ + jsonencode({ + "description": "${flow_description}", + "states": [ + { + "name": "Trigger", + "type": "trigger", + "transitions": [ + { + "event": "incomingMessage" + }, + { + "event": "incomingCall" + }, + { + "next": "run_subflow_system_down", + "event": "incomingConversationMessage" + }, + { + "event": "incomingRequest" + }, + { + "event": "incomingParent" + } + ], + "properties": { + "offset": { + "x": -170, + "y": -1100 + } + } + }, + { + "name": "split_language", + "type": "split-based-on", + "transitions": [ + { + "next": "set_en_US", + "event": "noMatch" + }, + { + "next": "set_en_US", + "event": "match", + "conditions": [ + { + "friendly_name": "If value equal_to English", + "arguments": [ + "{{trigger.conversations.ChannelAttributes.pre_engagement_data.language}}" + ], + "type": "equal_to", + "value": "English" + } + ] + }, + { + "next": "set_bem", + "event": "match", + "conditions": [ + { + "friendly_name": "If value equal_to Bemba", + "arguments": [ + "{{trigger.conversations.ChannelAttributes.pre_engagement_data.language}}" + ], + "type": "equal_to", + "value": "Bemba" + } + ] + }, + { + "next": "set_toi", + "event": "match", + "conditions": [ + { + "friendly_name": "If value equal_to Tonga", + "arguments": [ + "{{trigger.conversations.ChannelAttributes.pre_engagement_data.language}}" + ], + "type": "equal_to", + "value": "Tonga" + } + ] + }, + { + "next": "set_lun", + "event": "match", + "conditions": [ + { + "friendly_name": "If value equal_to Lunda", + "arguments": [ + "{{trigger.conversations.ChannelAttributes.pre_engagement_data.language}}" + ], + "type": "equal_to", + "value": "Lunda" + } + ] + }, + { + "next": "set_nyz", + "event": "match", + "conditions": [ + { + "friendly_name": "If value equal_to Nyanja", + "arguments": [ + "{{trigger.conversations.ChannelAttributes.pre_engagement_data.language}}" + ], + "type": "equal_to", + "value": "Nyanja" + } + ] + }, + { + "next": "set_kqn", + "event": "match", + "conditions": [ + { + "friendly_name": "If value equal_to Kaonde", + "arguments": [ + "{{trigger.conversations.ChannelAttributes.pre_engagement_data.language}}" + ], + "type": "equal_to", + "value": "Kaonde" + } + ] + }, + { + "next": "set_loz", + "event": "match", + "conditions": [ + { + "friendly_name": "If value equal_to Lozi", + "arguments": [ + "{{trigger.conversations.ChannelAttributes.pre_engagement_data.language}}" + ], + "type": "equal_to", + "value": "Lozi" + } + ] + } + ], + "properties": { + "input": "{{trigger.conversations.ChannelAttributes.pre_engagement_data.language}}", + "offset": { + "x": -670, + "y": -90 + } + } + }, + { + "name": "attributes", + "type": "send-to-flex", + "transitions": [ + { + "event": "callComplete" + }, + { + "event": "failedToEnqueue" + }, + { + "event": "callFailure" + } + ], + "properties": { + "offset": { + "x": 570, + "y": -120 + }, + "workflow": "${workflow_sids.master}", + "channel": "${task_channel_sids.chat}", + "attributes": "{\n \"ip\": \"{{trigger.conversations.ChannelAttributes.pre_engagement_data.ip}}\",\n \"name\": \"{{trigger.conversations.ChannelAttributes.from}}\",\n \"channelType\": \"{{trigger.conversations.ChannelAttributes.channel_type}}\",\n \"channelSid\": \"{{trigger.conversations.ChannelSid}}\",\n \"helpline\": \"{{ trigger.conversations.ChannelAttributes.memory .helpline}}\",\n \"ignoreAgent\": \"\",\n \"transferTargetType\": \"\",\n \"language\": \"{{trigger.conversations.ChannelAttributes.pre_engagement_data.language | default: 'en-US' }}\",\n \"memory\": {{ trigger.conversations.ChannelAttributes.memory | to_json }},\n \"preEngagementData\": {{trigger.conversations.ChannelAttributes.pre_engagement_data | to_json}} \n}" + } + }, + { + "name": "set_en_US", + "type": "set-variables", + "transitions": [ + { + "next": "captureChannelWithBot", + "event": "next" + } + ], + "properties": { + "variables": [ + { + "value": "en-US", + "key": "language" + } + ], + "offset": { + "x": -1740, + "y": 380 + } + } + }, + { + "name": "set_bem", + "type": "set-variables", + "transitions": [ + { + "next": "captureChannelWithBot", + "event": "next" + } + ], + "properties": { + "variables": [ + { + "value": "bem", + "key": "language" + } + ], + "offset": { + "x": -1420, + "y": 380 + } + } + }, + { + "name": "set_toi", + "type": "set-variables", + "transitions": [ + { + "next": "captureChannelWithBot", + "event": "next" + } + ], + "properties": { + "variables": [ + { + "value": "toi", + "key": "language" + } + ], + "offset": { + "x": -1100, + "y": 380 + } + } + }, + { + "name": "set_lun", + "type": "set-variables", + "transitions": [ + { + "next": "captureChannelWithBot", + "event": "next" + } + ], + "properties": { + "variables": [ + { + "value": "lun", + "key": "language" + } + ], + "offset": { + "x": -770, + "y": 380 + } + } + }, + { + "name": "set_nyz", + "type": "set-variables", + "transitions": [ + { + "next": "captureChannelWithBot", + "event": "next" + } + ], + "properties": { + "variables": [ + { + "value": "nyz", + "key": "language" + } + ], + "offset": { + "x": -440, + "y": 380 + } + } + }, + { + "name": "set_kqn", + "type": "set-variables", + "transitions": [ + { + "next": "captureChannelWithBot", + "event": "next" + } + ], + "properties": { + "variables": [ + { + "value": "kqn", + "key": "language" + } + ], + "offset": { + "x": -110, + "y": 380 + } + } + }, + { + "name": "set_loz", + "type": "set-variables", + "transitions": [ + { + "next": "captureChannelWithBot", + "event": "next" + } + ], + "properties": { + "variables": [ + { + "value": "loz", + "key": "language" + } + ], + "offset": { + "x": 230, + "y": 380 + } + } + }, + { + "name": "captureChannelWithBot", + "type": "make-http-request", + "transitions": [ + { + "event": "success" + }, + { + "event": "failed" + } + ], + "properties": { + "offset": { + "x": -780, + "y": 650 + }, + "method": "POST", + "content_type": "application/json;charset=utf-8", + "add_twilio_auth": false, + "body": "{\"channelSid\": \"{{flow.channel.address}}\", \"message\": \"trigger_pre_survey\", \"studioFlowSid\": \"{{flow.flow_sid}}\", \"language\": \"{{flow.variables.language}}\", \"botSuffix\": \"pre_survey\", \"triggerType\": \"withUserMessage\", \"releaseType\": \"triggerStudioFlow\", \"releaseFlag\": \"preSurveyComplete\", \"channelType\": \"{{trigger.conversations.ChannelAttributes.channel_type | downcase}}\", \"isConversation\": \"false\"}", + "url": "${lambda_twilio_account_scoped_url}/channelCapture/captureChannelWithBot" + } + }, + { + "name": "pre_survey_complete", + "type": "split-based-on", + "transitions": [ + { + "next": "split_language", + "event": "noMatch" + }, + { + "next": "attributes", + "event": "match", + "conditions": [ + { + "friendly_name": "If value equal_to true", + "arguments": [ + "{{trigger.conversations.ChannelAttributes.preSurveyComplete}}" + ], + "type": "equal_to", + "value": "true" + } + ] + } + ], + "properties": { + "input": "{{trigger.conversations.ChannelAttributes.preSurveyComplete}}", + "offset": { + "x": 20, + "y": -380 + } + } + }, + { + "name": "getProfileFlagsForIdentifier", + "type": "make-http-request", + "transitions": [ + { + "next": "contact_routing", + "event": "success" + }, + { + "next": "pre_survey_complete", + "event": "failed" + } + ], + "properties": { + "offset": { + "x": -140, + "y": -930 + }, + "method": "POST", + "content_type": "application/json;charset=utf-8", + "add_twilio_auth": false, + "body": "{ \"trigger\": {{trigger | to_json}}}", + "url": "${get_profile_flags_for_identifier_base_url}/getProfileFlagsForIdentifier" + } + }, + { + "name": "contact_routing", + "type": "split-based-on", + "transitions": [ + { + "next": "pre_survey_complete", + "event": "noMatch" + }, + { + "next": "blocked", + "event": "match", + "conditions": [ + { + "friendly_name": "If value contains Blocked", + "arguments": [ + "{{widgets.getProfileFlagsForIdentifier.parsed}}" + ], + "type": "contains", + "value": "Blocked" + } + ] + } + ], + "properties": { + "input": "{{widgets.getProfileFlagsForIdentifier.parsed}}", + "offset": { + "x": 270, + "y": -710 + } + } + }, + { + "name": "blocked", + "type": "send-message", + "transitions": [ + { + "event": "sent" + }, + { + "event": "failed" + } + ], + "properties": { + "offset": { + "x": 620, + "y": -470 + }, + "service": "{{trigger.conversations.InstanceSid}}", + "channel": "{{trigger.conversations.ChannelSid}}", + "from": "${flow_vars.widget_from}", + "to": "{{contact.channel.address}}", + "body": "${flow_vars.chat_blocked_message}" + } + }, + { + "name": "run_subflow_system_down", + "type": "run-subflow", + "transitions": [ + { + "next": "getProfileFlagsForIdentifier", + "event": "completed" + }, + { + "next": "getProfileFlagsForIdentifier", + "event": "failed" + } + ], + "properties": { + "flow_sid": "${system_down_studio_subflow_sid}", + "flow_revision": "LatestPublished", + "offset": { + "x": 110, + "y": -270 + }, + "parameters": [ + { + "type": "string", + "value": "true", + "key": "system_down" + } + ] + } + } + ], + "initial_state": "Trigger", + "flags": { + "allow_concurrent_calls": true + } +}) +} \ No newline at end of file