diff --git a/aselo-webchat-react-app/configSrc/nz/common.json b/aselo-webchat-react-app/configSrc/nz/common.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/aselo-webchat-react-app/configSrc/nz/staging.json b/aselo-webchat-react-app/configSrc/nz/staging.json new file mode 100644 index 0000000000..4139ae6832 --- /dev/null +++ b/aselo-webchat-react-app/configSrc/nz/staging.json @@ -0,0 +1,6 @@ +{ + "deploymentKey": "REPLACE_WITH_NZ_STAGING_CONVERSATIONS_SERVICE_SID", + "environment": "staging", + "aseloBackendUrl": "https://hrm-staging.tl.techmatters.org", + "definitionVersion": "nz-v1" +} \ No newline at end of file diff --git a/aselo-webchat-react-app/configSrc/nz/translations/en-NZ.json b/aselo-webchat-react-app/configSrc/nz/translations/en-NZ.json new file mode 100644 index 0000000000..2c070282b7 --- /dev/null +++ b/aselo-webchat-react-app/configSrc/nz/translations/en-NZ.json @@ -0,0 +1,16 @@ +{ + "WelcomeMessage": "Welcome to the Youthline Helpline", + "MessageCanvasTrayContent": "", + "MessageInputDisabledReasonHold": + "Thank you very much for this information. We'll transfer you now. Please hold for a practitioner.", + "AutoFirstMessage": "Incoming webchat contact from", + "TypingIndicator": "Youthline is typing", + "StartChat": "Start Chat!", + "MessageCanvasTrayButton": "Start New Chat", + "Email": "Email", + "Age": "What is your age?", + "Gender": "What is your gender?", + "Region": "Select your region", + "Ethnicity": "Select your ethnicity", + "MessagePhase-MessageBubble-OtherParticipantMessageSenderName": "Youthline" + } \ No newline at end of file diff --git a/lambdas/packages/hrm-form-definitions/form-definitions/nz/v1/webchat/PreEngagementForm.json b/lambdas/packages/hrm-form-definitions/form-definitions/nz/v1/webchat/PreEngagementForm.json index a237d547fe..cbb4b65736 100644 --- a/lambdas/packages/hrm-form-definitions/form-definitions/nz/v1/webchat/PreEngagementForm.json +++ b/lambdas/packages/hrm-form-definitions/form-definitions/nz/v1/webchat/PreEngagementForm.json @@ -3,7 +3,7 @@ "submitLabel": "StartChat", "fields": [ { - "type": "input", + "type": "input-text", "name": "friendlyName", "label": "Preferred Name", "placeholder": "Name", diff --git a/twilio-iac/helplines/nz/staging.hcl b/twilio-iac/helplines/nz/staging.hcl index 46941b415d..a847f168a9 100644 --- a/twilio-iac/helplines/nz/staging.hcl +++ b/twilio-iac/helplines/nz/staging.hcl @@ -27,6 +27,18 @@ locals { #Channels channels = { + chat : { + messaging_mode = "conversations" + channel_type = "chat" + contact_identity = "" + templatefile = INSERT APPROPRIATE STUDIO TF FILE HERE + channel_flow_vars = { + chat_greeting_message = "Kia ora, we'll connect you with someone soon. Your conversation is confidential, but if we feel that you or someone else is at serious risk of harm, we may have to link in with other services. We'll let you know if that becomes necessary." + widget_from = "Youthline" + allowed_shortcode_locations = "NZ,US,CL,ZA,IE,AR" + } + chatbot_unique_names = [] + }, webchat : { channel_type = "web" contact_identity = "" diff --git a/twilio-iac/helplines/nz/templates/studio-flows/messaging-no-lex-op-hours-flags-routing-v2-lambda-sd-v2.tftpl b/twilio-iac/helplines/nz/templates/studio-flows/messaging-no-lex-op-hours-flags-routing-v2-lambda-sd-v2.tftpl new file mode 100644 index 0000000000..7e1e2f0dfc --- /dev/null +++ b/twilio-iac/helplines/nz/templates/studio-flows/messaging-no-lex-op-hours-flags-routing-v2-lambda-sd-v2.tftpl @@ -0,0 +1,443 @@ +${ + 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": -670, + "y": -470 + } + } + }, + { + "name": "f_operatingHours", + "type": "make-http-request", + "transitions": [ + { + "next": "split_status", + "event": "success" + }, + { + "next": "send_message_welcome", + "event": "failed" + } + ], + "properties": { + "offset": { + "x": -240, + "y": 860 + }, + "method": "POST", + "content_type": "application/json;charset=utf-8", + "add_twilio_auth": false, + "body": "{\"channel\": \"webchat\", \"includeMessageTextInResponse\": \"true\", \"language\": \"en-NZ\"}", + "url": "${get_profile_flags_for_identifier_base_url}/operatingHours" + } + }, + { + "name": "split_status", + "type": "split-based-on", + "transitions": [ + { + "next": "send_message_welcome", + "event": "noMatch" + }, + { + "next": "send_message_welcome", + "event": "match", + "conditions": [ + { + "friendly_name": "If value equal_to open", + "arguments": [ + "{{widgets.f_operatingHours.parsed.status}}" + ], + "type": "equal_to", + "value": "open" + } + ] + }, + { + "next": "send_message_closed", + "event": "match", + "conditions": [ + { + "friendly_name": "If matches_any_of closed,holiday", + "arguments": [ + "{{widgets.f_operatingHours.parsed.status}}" + ], + "type": "matches_any_of", + "value": "closed,holiday" + } + ] + } + ], + "properties": { + "input": "{{widgets.f_operatingHours.parsed.status}}", + "offset": { + "x": -10, + "y": 1060 + } + } + }, + { + "name": "http_post_webhook_notify_error", + "type": "make-http-request", + "transitions": [ + { + "event": "success" + }, + { + "event": "failed" + } + ], + "properties": { + "offset": { + "x": -290, + "y": 1630 + }, + "method": "POST", + "add_twilio_auth": false, + "content_type": "application/json;charset=utf-8", + "body": "{ \"text\": \"Issue detected on NZ STG Flow SID: {{flow.flow_sid}} Execution SID: {{flow.sid}} \" }", + "url": "${webhook_url_studio_errors}" + } + }, + { + "name": "send_message_welcome", + "type": "send-message", + "transitions": [ + { + "next": "send_to_queue", + "event": "sent" + }, + { + "next": "http_post_webhook_notify_error", + "event": "failed" + } + ], + "properties": { + "offset": { + "x": 190, + "y": 1300 + }, + "service": "{{trigger.conversation.InstanceSid}}", + "channel": "{{trigger.conversation.ChannelSid}}", + "from": "${channel_flow_vars.widget_from}", + "to": "{{contact.channel.address}}", + "body": "${channel_flow_vars.chat_greeting_message}" + } + }, + { + "name": "send_message_closed", + "type": "send-message", + "transitions": [ + { + "event": "sent" + }, + { + "next": "http_post_webhook_notify_error", + "event": "failed" + } + ], + "properties": { + "offset": { + "x": 590, + "y": 1290 + }, + "service": "{{trigger.conversation.InstanceSid}}", + "channel": "{{trigger.conversation.ChannelSid}}", + "from": "Youthline", + "to": "{{contact.channel.address}}", + "body": "{{widgets.f_operatingHours.parsed.message}}" + } + }, + { + "name": "send_to_queue", + "type": "send-to-flex", + "transitions": [ + { + "event": "callComplete" + }, + { + "next": "http_post_webhook_notify_error", + "event": "failedToEnqueue" + }, + { + "event": "callFailure" + } + ], + "properties": { + "offset": { + "x": 300, + "y": 1580 + }, + "workflow": "${workflow_sids.master}", + "channel": "${task_channel_sids.chat}", + "attributes": "${channel_attributes.default}" + } + }, + { + "name": "split_contact_routing", + "type": "split-based-on", + "transitions": [ + { + "next": "f_operatingHours", + "event": "noMatch" + }, + { + "next": "send_message_blocked", + "event": "match", + "conditions": [ + { + "friendly_name": "If value contains blocked", + "arguments": [ + "{{widgets.f_getProfileFlagsForIdentifier.parsed.flags}}" + ], + "type": "contains", + "value": "blocked" + } + ] + }, + { + "next": "set_var_clinical", + "event": "match", + "conditions": [ + { + "friendly_name": "If value contains case management", + "arguments": [ + "{{widgets.f_getProfileFlagsForIdentifier.parsed.flags}}" + ], + "type": "contains", + "value": "case management" + } + ] + } + ], + "properties": { + "input": "{{widgets.f_getProfileFlagsForIdentifier.parsed.flags}}", + "offset": { + "x": -220, + "y": 390 + } + } + }, + { + "name": "f_getProfileFlagsForIdentifier", + "type": "make-http-request", + "transitions": [ + { + "next": "split_contact_routing", + "event": "success" + }, + { + "next": "split_contact_routing", + "event": "failed" + } + ], + "properties": { + "offset": { + "x": -210, + "y": 170 + }, + "method": "POST", + "add_twilio_auth": false, + "content_type": "application/json;charset=utf-8", + "body": "{ \"trigger\": {{trigger | to_json}}, \"channelType\": \"{% if trigger.conversation.ChannelAttributes.channel_type %}{{trigger.conversation.ChannelAttributes.channel_type}}{% else %}{{trigger.conversation.Source | downcase}}{% endif %}\" }", + "url": "${get_profile_flags_for_identifier_base_url}/getProfileFlagsForIdentifier" + } + }, + { + "name": "send_message_blocked", + "type": "send-message", + "transitions": [ + { + "event": "sent" + }, + { + "event": "failed" + } + ], + "properties": { + "offset": { + "x": 400, + "y": 660 + }, + "service": "{{trigger.conversation.InstanceSid}}", + "channel": "{{trigger.conversation.ChannelSid}}", + "from": "${channel_flow_vars.widget_from}", + "to": "{{contact.channel.address}}", + "body": "${flow_vars.blocked_message}" + } + }, + { + "name": "set_var_clinical", + "type": "set-variables", + "transitions": [ + { + "next": "f_operatingHours", + "event": "next" + } + ], + "properties": { + "variables": [ + { + "value": "true", + "key": "clinical", + "type": "string" + } + ], + "offset": { + "x": 40, + "y": 660 + } + } + }, + { + "name": "http_post_ip_location_finder", + "type": "make-http-request", + "transitions": [ + { + "next": "split_block_non_nz_contacts", + "event": "success" + }, + { + "next": "f_getProfileFlagsForIdentifier", + "event": "failed" + } + ], + "properties": { + "offset": { + "x": -320, + "y": -220 + }, + "method": "POST", + "content_type": "application/json;charset=utf-8", + "add_twilio_auth": false, + "body": "{ \"trigger\": {{trigger | to_json}}}", + "url": "${flow_vars.ip_location_finder_url}" + } + }, + { + "name": "split_block_non_nz_contacts", + "type": "split-based-on", + "transitions": [ + { + "next": "f_sendMessageAndRunJanitor_blocked_location", + "event": "noMatch" + }, + { + "next": "f_getProfileFlagsForIdentifier", + "event": "match", + "conditions": [ + { + "friendly_name": "If value matches_any_of ${channel_flow_vars.allowed_shortcode_locations}", + "arguments": [ + "{{widgets.http_post_ip_location_finder.parsed.country_code}}" + ], + "type": "matches_any_of", + "value": "${channel_flow_vars.allowed_shortcode_locations}" + } + ] + } + ], + "properties": { + "input": "{{widgets.http_post_ip_location_finder.parsed.country_code}}", + "offset": { + "x": -760, + "y": -20 + } + } + }, + { + "name": "f_sendMessageAndRunJanitor_blocked_location", + "type": "run-function", + "transitions": [ + { + "event": "success" + }, + { + "event": "fail" + } + ], + "properties": { + "service_sid": "${serverless_service_sid}", + "environment_sid": "${serverless_environment_sid}", + "offset": { + "x": -1010, + "y": 230 + }, + "function_sid": "${flow_vars.send_message_run_janitor_sid}", + "parameters": [ + { + "value": "{{flow.channel.address}}", + "key": "channelSid" + }, + { + "value": "${flow_vars.outside_country_message}", + "key": "message" + }, + { + "value": "Youthline", + "key": "from" + } + ], + "url": "${serverless_url}/sendMessageAndRunJanitor" + } + }, + { + "name": "run_subflow_system_down", + "type": "run-subflow", + "transitions": [ + { + "next": "http_post_ip_location_finder", + "event": "completed" + }, + { + "next": "http_post_ip_location_finder", + "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