diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..38a6379 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +watson-assistant-skill/.DS_Store +doc/.DS_Store +doc/source/.DS_Store +doc/source/images/.DS_Store \ No newline at end of file diff --git a/README.md b/README.md index ced8f2a..67827d0 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ When you have completed this code pattern, you will understand how to: * [goal 4] -![architecture](doc/source/images/architecture.png) +![architecture](doc/source/images/Architecture.png) ## Flow @@ -49,13 +49,77 @@ Clone the `/voicebot-on-whatsapp-using-watson-services` repo locally. In a termi ```bash git clone https://github.com/IBM//voicebot-on-whatsapp-using-watson-services.git ``` +We will be using the following directory: + +- `python-application/` - To build and deploy the application. ### 2. Create Watson Services Create the following Watson Services: #### 2.1: Watson Speech to Text service +##### 2.1.1: Create service +
IBM Cloud Pak for Data + +- On Cloud Pak for Data, go to the **Service catalog** and deploy Watson Speech To Text Service, by clicking on the `Deploy` and following the instructions. +![Speech-to-text-service-cp4d](doc/source/images/stt-service-cp4d.png) +
+ +
IBM Cloud + +- On IBM Cloud, create a [Watson Speech To Text Service](https://cloud.ibm.com/catalog/services/speech-to-text), under `Select a pricing plan` select `Lite` and click on `create` as shown. +![Speech-to-text-service](doc/source/images/stt-service.png) +
+ +##### 2.1.2: Copy service credentials +- In Speech To Text Dashboard, Click on `Services Credentials` +![](doc/source/images/service-credentials.png) + +- Click on `New credential` and add a service credential as shown. +![](doc/source/images/create-stt-credentials.gif) + +**NOTE:** Once the credential is created, copy and save the credentials in a text file for using it in later steps in this code pattern. #### 2.2: Watson Assistant service +##### 2.2.1: Create service +
IBM Cloud Pak for Data + +- On Cloud Pak for Data, go to the **Service catalog** and deploy Watson Assistant Service by clicking on the `Deploy` and following the instructions. +![assistant-service-cp4d](doc/source/images/wa-service-cp4d.png) + +
+ +
IBM Cloud + +- On IBM Cloud, create a [Watson Assistant Service](https://cloud.ibm.com/catalog/services/speech-to-text), under `Select a pricing plan` select `Lite` and click on `create` as shown. +![assistant-service](doc/source/images/wa-service.png) +
+ +##### 2.2.2: Copy credentials + +- In Watson Assistant Dashboard, Click on `Services Credentials` and delete all the existing credentials. Create a new credential by clicking on `New credential`. +![](doc/source/images/wa-service-creds.png) + +>Note: Deleting of existing credentials and creating a new service credentials is required because the `https://gateway-lon.watsonplatform.net` url is deprecated, on creating a new credential you should see an url like `https://api.eu-gb.assistant.watson.cloud.ibm.com`. + +- In Watson Assistant Dashboard, Click on `Manage` and **Launch** the Watson Assistant. +![](doc/source/images/wa-assistant.png) + +- Click on **Create assistant** and give your assistant a name and create it. +![](doc/source/images/create-assistant.png) + +- In Assistant dashboard, under **Dialog** click on **add dilog skill**. +![](doc/source/images/create-dilog.png) + +- Select **Upload skill** and upload the `skill-Portugues-Assistant-Skill.json` skill present in [`/watson-assistant-skill/`](watson-assistant-skill/) directory. +![](doc/source/images/upload-skill.png) + +- In Assistant dashboard, click on the three dots and select **Assistant settings**. +![](doc/source/images/three-dots.png) + +- Copy the `Assistant ID`, `Assistant URL` and `API key` as shown. +![](doc/source/images/wa-creds.png) + +**NOTE:** Copy `Assistant ID`, `Assistant URL` and `API key` and save the credentials in a text file for using it in later steps in this code pattern. ### 3. Build and Deploy the Python Application diff --git a/doc/source/images/Architecture.png b/doc/source/images/Architecture.png new file mode 100644 index 0000000..c9e7796 Binary files /dev/null and b/doc/source/images/Architecture.png differ diff --git a/doc/source/images/create-assistant.png b/doc/source/images/create-assistant.png new file mode 100644 index 0000000..621b6ae Binary files /dev/null and b/doc/source/images/create-assistant.png differ diff --git a/doc/source/images/create-dilog.png b/doc/source/images/create-dilog.png new file mode 100644 index 0000000..5b76286 Binary files /dev/null and b/doc/source/images/create-dilog.png differ diff --git a/doc/source/images/create-stt-credentials.gif b/doc/source/images/create-stt-credentials.gif new file mode 100644 index 0000000..28f0ea9 Binary files /dev/null and b/doc/source/images/create-stt-credentials.gif differ diff --git a/doc/source/images/service-credentials.png b/doc/source/images/service-credentials.png new file mode 100644 index 0000000..a10b8d9 Binary files /dev/null and b/doc/source/images/service-credentials.png differ diff --git a/doc/source/images/stt-service-cp4d.png b/doc/source/images/stt-service-cp4d.png new file mode 100644 index 0000000..de6f263 Binary files /dev/null and b/doc/source/images/stt-service-cp4d.png differ diff --git a/doc/source/images/stt-service.png b/doc/source/images/stt-service.png new file mode 100644 index 0000000..e7cedbb Binary files /dev/null and b/doc/source/images/stt-service.png differ diff --git a/doc/source/images/three-dots.png b/doc/source/images/three-dots.png new file mode 100644 index 0000000..7cb5f39 Binary files /dev/null and b/doc/source/images/three-dots.png differ diff --git a/doc/source/images/upload-skill.png b/doc/source/images/upload-skill.png new file mode 100644 index 0000000..6461935 Binary files /dev/null and b/doc/source/images/upload-skill.png differ diff --git a/doc/source/images/wa-assistant.png b/doc/source/images/wa-assistant.png new file mode 100644 index 0000000..0a01e44 Binary files /dev/null and b/doc/source/images/wa-assistant.png differ diff --git a/doc/source/images/wa-creds.png b/doc/source/images/wa-creds.png new file mode 100644 index 0000000..cbc077a Binary files /dev/null and b/doc/source/images/wa-creds.png differ diff --git a/doc/source/images/wa-service-cp4d.png b/doc/source/images/wa-service-cp4d.png new file mode 100644 index 0000000..291e5a8 Binary files /dev/null and b/doc/source/images/wa-service-cp4d.png differ diff --git a/doc/source/images/wa-service-creds.png b/doc/source/images/wa-service-creds.png new file mode 100644 index 0000000..2e82810 Binary files /dev/null and b/doc/source/images/wa-service-creds.png differ diff --git a/doc/source/images/wa-service.png b/doc/source/images/wa-service.png new file mode 100644 index 0000000..eaf4d79 Binary files /dev/null and b/doc/source/images/wa-service.png differ diff --git a/watson-assistant-skill/skill-Portugues-Assistant-Skill.json b/watson-assistant-skill/skill-Portugues-Assistant-Skill.json new file mode 100644 index 0000000..d9763b1 --- /dev/null +++ b/watson-assistant-skill/skill-Portugues-Assistant-Skill.json @@ -0,0 +1,319 @@ +{ + "intents": [ + { + "intent": "duplicateofaccount", + "examples": [ + { + "text": "Envia boleto deste mês." + }, + { + "text": "Enviam boletos desse mês." + }, + { + "text": "Envia o boleto deste mês." + }, + { + "text": "Envie o boleto desse mesmo favor." + }, + { + "text": "Pode me enviar a segunda via da conta" + } + ], + "description": "You can send me the duplicate of the account" + }, + { + "intent": "duplicateofticket", + "examples": [ + { + "text": "Era a segunda via do boleto." + }, + { + "text": "Quero a segunda via do boleto" + }, + { + "text": "Quero a segunda via do boleto." + } + ], + "description": "I want the duplicate of the ticket" + }, + { + "intent": "paybill", + "examples": [ + { + "text": "Eu quero pagar a conta." + }, + { + "text": "Quero pagar a conta" + }, + { + "text": "Quero pagar a conta." + }, + { + "text": "Quero pagar a conto" + } + ], + "description": "I want to pay the bill" + }, + { + "intent": "paymentnumber", + "examples": [ + { + "text": "Quero o número do pis para pagamento." + }, + { + "text": "Quero o número para pagamenta" + }, + { + "text": "Quero o número para pagamento" + }, + { + "text": "Quero o número para pagamento." + } + ], + "description": "I want the payment number" + }, + { + "intent": "sendcodeforpayment", + "examples": [ + { + "text": "Poderei enviar o código para pagamento." + }, + { + "text": "Poderia enviar o código para pagamento" + }, + { + "text": "Poderia enviar o código para pagamento." + }, + { + "text": "Poderia enviar um código para pagamento." + } + ], + "description": "You could send the code for payment via the bank slip for that month" + }, + { + "intent": "thismonthsticket", + "examples": [ + { + "text": "Envia boleto deste mês." + }, + { + "text": "Envia o boleto desse mês" + }, + { + "text": "Envia o boleto deste mês." + }, + { + "text": "Envie o boleto desse mesmo favor." + } + ], + "description": "Send this month’s ticket" + } + ], + "entities": [], + "metadata": { + "api_version": { + "major_version": "v2", + "minor_version": "2018-11-08" + } + }, + "dialog_nodes": [ + { + "type": "standard", + "title": "Bem-vindo", + "output": { + "generic": [ + { + "values": [ + { + "text": "Olá. Eu sou o Watson Assistant. Como posso ajudá-lo?" + } + ], + "response_type": "text", + "selection_policy": "sequential" + } + ] + }, + "conditions": "welcome", + "dialog_node": "Bem-vindo" + }, + { + "type": "standard", + "title": "Em outros casos", + "output": { + "generic": [ + { + "values": [ + { + "text": "Eu não entendi. Você pode tentar reformular a frase." + }, + { + "text": "Você pode reformular sua afirmação? Eu não estou entendendo." + }, + { + "text": "Eu não entendi o sentido." + } + ], + "response_type": "text", + "selection_policy": "sequential" + } + ] + }, + "conditions": "anything_else", + "dialog_node": "Em outros casos", + "previous_sibling": "node_10_1620889947588", + "disambiguation_opt_out": true + }, + { + "type": "folder", + "title": "Content", + "dialog_node": "node_10_1620889947588", + "previous_sibling": "Bem-vindo" + }, + { + "type": "standard", + "title": "Send this months Ticket", + "output": { + "generic": [ + { + "values": [ + { + "text": "Tudo bem, estou enviando o boleto deste mês" + } + ], + "response_type": "text", + "selection_policy": "sequential" + } + ] + }, + "parent": "node_10_1620889947588", + "conditions": "#thismonthsticket", + "dialog_node": "node_10_1620889960520" + }, + { + "type": "standard", + "title": "I want the payment number", + "output": { + "generic": [ + { + "values": [ + { + "text": "Ok, segue o código do boleto para pagamento." + } + ], + "response_type": "text", + "selection_policy": "sequential" + } + ] + }, + "parent": "node_10_1620889947588", + "conditions": "#paymentnumber", + "dialog_node": "node_2_1620890473460", + "previous_sibling": "node_2_1621417485167" + }, + { + "type": "standard", + "title": "I want the duplicate of the ticket", + "output": { + "generic": [ + { + "values": [ + { + "text": "Tudo bem, estou enviando a segunda via da sua conta." + } + ], + "response_type": "text", + "selection_policy": "sequential" + } + ] + }, + "parent": "node_10_1620889947588", + "conditions": "#duplicateofticket", + "dialog_node": "node_2_1621417485167", + "previous_sibling": "node_9_1620890410154" + }, + { + "type": "standard", + "title": "You can send me the duplicate of the account", + "output": { + "generic": [ + { + "values": [ + { + "text": "Tudo bem, estou enviando a segunda via da sua conta." + } + ], + "response_type": "text", + "selection_policy": "sequential" + } + ] + }, + "parent": "node_10_1620889947588", + "conditions": "#duplicateofaccount", + "dialog_node": "node_3_1620890333645", + "previous_sibling": "node_10_1620889960520" + }, + { + "type": "standard", + "title": "I want to pay the bill", + "output": { + "generic": [ + { + "values": [ + { + "text": "Você gostaria de receber o boleto ou somente o código para pagamento?" + } + ], + "response_type": "text", + "selection_policy": "sequential" + } + ] + }, + "parent": "node_10_1620889947588", + "conditions": "#paybill", + "dialog_node": "node_3_1620890546950", + "previous_sibling": "node_2_1620890473460" + }, + { + "type": "standard", + "title": "You could send the code for payment via the bank slip for that month", + "output": { + "generic": [ + { + "values": [ + { + "text": "Ok, segue o código do boleto para pagamento." + } + ], + "response_type": "text", + "selection_policy": "sequential" + } + ] + }, + "parent": "node_10_1620889947588", + "conditions": "#sendcodeforpayment", + "dialog_node": "node_9_1620890410154", + "previous_sibling": "node_3_1620890333645" + } + ], + "counterexamples": [], + "system_settings": { + "disambiguation": { + "prompt": "Você quis dizer:", + "enabled": true, + "randomize": true, + "max_suggestions": 5, + "suggestion_text_policy": "title", + "none_of_the_above_prompt": "Nenhuma das anteriores" + }, + "system_entities": { + "enabled": true + }, + "human_agent_assist": { + "prompt": "Você quis dizer:" + } + }, + "learning_opt_out": false, + "name": "Portugues Assistant Skill", + "language": "pt-br", + "description": "" +} \ No newline at end of file