Skip to content

Commit

Permalink
CL: Client profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
janorivera committed May 9, 2024
1 parent 30fd886 commit d19d9dc
Show file tree
Hide file tree
Showing 6 changed files with 621 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"flag": "blocked",
"label": "Bloqueo Temporal (24 Horas)",
"durationInHours": "24"
},
{
"flag": "blocked",
"label": "Bloqueo Largo Plazo (1 Año)",
"durationInHours": "8760"
}
]
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[
{
"name": "summary",
"label": "Summary",
"editLabel": "Edit Summary",
"label": "Resumen",
"editLabel": "Editar Resumen",
"type": "textarea",
"rows": 20,
"width": 500,
Expand Down
10 changes: 6 additions & 4 deletions twilio-iac/helplines/cl/common.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ locals {
task_language = "es-CL"
voice_ivr_language = "es-MX"
enable_post_survey = true
enable_external_recordings = true
enable_external_recordings = true

workflows = {
master : {
friendly_name : "Master Workflow"
Expand Down Expand Up @@ -61,19 +61,21 @@ locals {
webchat : {
channel_type = "web"
contact_identity = ""
templatefile = "/app/twilio-iac/helplines/templates/studio-flows/messaging-no-chatbot-operating-hours.tftpl"
templatefile = "/app/twilio-iac/helplines/templates/studio-flows/messaging-no-chatbot-operating-hours-blocking.tftpl"
channel_flow_vars = {
chat_greeting_message = "Te damos la bienvenida a Línea Libre, tu mensaje fue recibido exitosamente, la conversación será asignada a uno/a de nuestros psicólogos/as en los próximos instantes."
chat_blocked_message = "Hola, estás comunicándote con Línea Libre. Lamentablemente tu usuario está bloqueado."
widget_from = "Linea Libre"
}
chatbot_unique_names = []
},
voice : {
channel_type = "voice"
contact_identity = ""
templatefile = "/app/twilio-iac/helplines/templates/studio-flows/voice-no-chatbot-operating-hours.tftpl"
templatefile = "/app/twilio-iac/helplines/templates/studio-flows/voice-no-chatbot-operating-hours-blocking.tftpl"
channel_flow_vars = {
voice_ivr_greeting_message = "Hola, estás comunicándote con Línea Libre, un canal que ofrece una primera atención psicológica, y que busca apoyarte y orientarte en lo que sea que estés pasando. Antes de conversar, nos gustaría contarte que trabajamos bajo el principio de protección. Si percibimos que tu integridad o la de un tercero puede estar en riesgo, haremos lo necesario para asegurar tu protección y bienestar. Por tu seguridad, esta llamada podría ser grabada."
voice_ivr_blocked_message = "Hola, estás comunicándote con Línea Libre. Lamentablemente el número del cual nos llamas ha sido bloqueado."
voice_ivr_language = "es-MX"
}
chatbot_unique_names = []
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
${
jsonencode(
{
"description": "Webchat Studio Flow",
"states": [
{
"name": "Trigger",
"type": "trigger",
"transitions": [
{
"next": "getProfileFlagsForIdentifier",
"event": "incomingMessage"
},
{
"event": "incomingCall"
},
{
"event": "incomingConversationMessage"
},
{
"event": "incomingRequest"
},
{
"event": "incomingParent"
}
],
"properties": {
"offset": {
"x": 0,
"y": -10
}
}
},
{
"name": "check_operating_hours",
"type": "run-function",
"transitions": [
{
"next": "split_status",
"event": "success"
},
{
"next": "webhook_notify_error",
"event": "fail"
}
],
"properties": {
"service_sid": serverless_service_sid,
"environment_sid": serverless_environment_sid,
"offset": {
"x": 0,
"y": 600
},
"function_sid": flow_vars["operating_hours_function_sid"]
"parameters": [
{
"value": "webchat",
"key": "channel"
},
{
"value": "true",
"key": "includeMessageTextInResponse"
},
{
"value": task_language,
"key": "language"
}
],
"url": "${serverless_url}/operatingHours"
}
},
{
"name": "split_status",
"type": "split-based-on",
"transitions": [
{
"next": "webhook_notify_error",
"event": "noMatch"
},
{
"next": "send_welcome_message",
"event": "match",
"conditions": [
{
"friendly_name": "If value equal_to open",
"arguments": [
"{{widgets.check_operating_hours.parsed.status}}"
],
"type": "equal_to",
"value": "open"
}
]
},
{
"next": "send_closed",
"event": "match",
"conditions": [
{
"friendly_name": "If value equal_to closed",
"arguments": [
"{{widgets.check_operating_hours.parsed.status}}"
],
"type": "equal_to",
"value": "closed"
}
]
}
],
"properties": {
"input": "{{widgets.check_operating_hours.parsed.status}}",
"offset": {
"x": 210,
"y": 860
}
}
},
{
"name": "webhook_notify_error",
"type": "make-http-request",
"transitions": [
{
"event": "success"
},
{
"event": "failed"
}
],
"properties": {
"offset": {
"x": 80,
"y": 1410
},
"method": "POST",
"content_type": "application/json;charset=utf-8",
"body": "{ \"text\": \"Issue detected on ${short_helpline} ${short_environment} Flow SID: {{flow.flow_sid}} Execution SID: {{flow.sid}} \" }",
"url": webhook_url_studio_errors
}
},
{
"name": "send_welcome_message",
"type": "send-message",
"transitions": [
{
"next": "attributes",
"event": "sent"
},
{
"next": "webhook_notify_error",
"event": "failed"
}
],
"properties": {
"offset": {
"x": 420,
"y": 1110
},
"service": "{{trigger.message.InstanceSid}}",
"channel": "{{trigger.message.ChannelSid}}",
"from": channel_flow_vars["widget_from"],
"to": "{{contact.channel.address}}",
"body": channel_flow_vars["chat_greeting_message"]
}
},
{
"name": "send_closed",
"type": "send-message",
"transitions": [
{
"event": "sent"
},
{
"next": "webhook_notify_error",
"event": "failed"
}
],
"properties": {
"offset": {
"x": 990,
"y": 1150
},
"service": "{{trigger.message.InstanceSid}}",
"channel": "{{trigger.message.ChannelSid}}",
"from": "Linea Libre",
"to": "{{contact.channel.address}}",
"body": "{{widgets.check_operating_hours.parsed.message}}"
}
},
{
"name": "attributes",
"type": "send-to-flex",
"transitions": [
{
"event": "callComplete"
},
{
"event": "failedToEnqueue"
},
{
"event": "callFailure"
}
],
"properties": {
"offset": {
"x": 580,
"y": 1400
},
"workflow": workflow_sids["master"],
"channel": task_channel_sids["chat"],
"attributes": channel_attributes["default"]
}
},
{
"name": "getProfileFlagsForIdentifier",
"type": "make-http-request",
"transitions": [
{
"next": "contact_routing",
"event": "success"
},
{
"next": "check_operating_hours",
"event": "failed"
}
],
"properties": {
"offset": {
"x": -300,
"y": 150
},
"method": "POST",
"content_type": "application/json;charset=utf-8",
"body": "{ \"trigger\": {{trigger | to_json}}}",
"url": "${serverless_url}/getProfileFlagsForIdentifier"
}
},
{
"name": "send_blocked_message",
"type": "send-message",
"transitions": [
{
"event": "sent"
},
{
"event": "failed"
}
],
"properties": {
"offset": {
"x": -420,
"y": 770
},
"service": "{{trigger.message.InstanceSid}}",
"channel": "{{trigger.message.ChannelSid}}",
"from": "Linea Libre",
"to": "{{contact.channel.address}}",
"body": channel_flow_vars["chat_blocked_message"]
}
},
{
"name": "contact_routing",
"type": "split-based-on",
"transitions": [
{
"next": "check_operating_hours",
"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": -590,
"y": 470
}
}
}
],
"initial_state": "Trigger",
"flags": {
"allow_concurrent_calls": true
}
}
)
}
Loading

0 comments on commit d19d9dc

Please sign in to comment.