Skip to content

Commit

Permalink
Merge pull request #48 from praekeltfoundation/helpcentre
Browse files Browse the repository at this point in the history
Helpcentre flows
  • Loading branch information
fritzbrand authored Sep 4, 2024
2 parents d094971 + 08e8979 commit 44e0e9f
Show file tree
Hide file tree
Showing 26 changed files with 4,096 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ jobs:

- name: Test flows
run: |
./flow_tester/run_flow_tests.exs Onboarding/QA/tests/
./flow_tester/run_flow_tests.exs HelpCentre/QA/tests/ Onboarding/QA/tests/
87 changes: 87 additions & 0 deletions HelpCentre/QA/flows/agent-greeting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# HelpCentre - Agent Greeting

This is a very basic flow, that sends a greeting message to the user, including the name of the help centre agent that is assigned to their query

## Contact fields

## Flow results

## Connections to other stacks

* This stack is manually run by the operator right before they take over the chat. At this point the chat should be assigned to them already.

## Global variables

The following variable(s) are set in the `settings` global dictionary

* `turn_qa_token` used to authenticate calls to the Turn API. In this case, to query and label a specific message
* `contentrepo_qa_token` used to auth calls to CMS API

## Content dependencies

* `plat_help_agent_greeting`

<!-- { section: "94da26e4-fe2e-42e6-b986-bdc0536cd585", x: 500, y: 48} -->

```stack
trigger(on: "MESSAGE RECEIVED") when has_only_phrase(event.message.text.body, "tsts")
```

<!-- { section: "df9a9d5b-c57d-4a9e-8020-1756b7fdec73", x: 0, y: 0} -->

```stack
card GetLatestMessage, then: GetPageContent do
get_latest_msg =
get(
"https://whatsapp-praekelt-cloud.turn.io/v1/contacts/@contact.whatsapp_id/messages",
headers: [
[
"Authorization",
"Bearer @global.settings.turn_qa_token"
],
["Accept", "application/vnd.v1+json"],
["Content-Type", "application/json"]
]
)
chat = get_latest_msg.body.chat
end
card GetPageContent, then: SendGreeting do
search =
get(
"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/pages/",
query: [
["slug", "plat_help_agent_greeting"]
],
headers: [["Authorization", "Token @global.settings.contentrepo_qa_token"]]
)
page_id = search.body.results[0].id
page =
get(
"https://content-repo-api-qa.prk-k8s.prd-p6t.org/api/v2/pages/@page_id/",
query: [
["whatsapp", "true"]
],
headers: [["Authorization", "Token @global.settings.contentrepo_qa_token"]]
)
greeting_msg = page.body.body.text.value.message
end
card SendGreeting when is_nil_or_empty(chat.assigned_to) do
substituted_msg = substitute(greeting_msg, "{operator_name}", "a MomConnect operator")
text("@substituted_msg")
end
card SendGreeting do
log("Agent assigned to this chat = @chat.assigned_to.name")
substituted_msg = substitute(greeting_msg, "{operator_name}", "@chat.assigned_to.name")
text("@substituted_msg")
end
```
Loading

0 comments on commit 44e0e9f

Please sign in to comment.