Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
manojjahgirdar committed Jun 4, 2021
1 parent d702cca commit b52ccff
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 4 deletions.
53 changes: 49 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ When you have completed this code pattern, you will understand how to:
5. The text message is sent to Watson Assistant
6. Watson Assistant chatbot detects the intent and replies with response accordingly
7. The python application triggers the Twilio Programmable messaging service with the response message
8. The response is redirected to Twilio Programmable messaging service
9. Twilio Programmable messaging service redirects the response message to WhatsApp
8. Twilio Programmable messaging service redirects the response message to WhatsApp
10. User will be able to view the response message on Whatsapp

<!--Optionally, update this section when the video is created-->
Expand Down Expand Up @@ -135,10 +134,56 @@ Watson Assistant service can be created on IBM Cloud Pak for Data as well as on

### 3. Build and Deploy the Python Application

#### 3.1: Build
#### 3.2: Deploy
#### 3.1: Build and Deploy on OpenShift
#### 3.2: Build and Deploy on IBM Cloud Foundry

### 4. Create Twilio service
Twlio is a SaaS offering that provides APIs to make and receive calls or text messages. As there are no APIs from WhatsApp directly availabe to send and receive WhatsApp messages programmatically, you will learn how to use Twilio's messaging service APIs that provides gateway to communicate with WhatsApp programmatically. Get started by creating a free Twilio service.

- Create a free Twilio service here: <https://www.twilio.com/try-twilio>.

>NOTE: - Once you create a Twilio service, you will have to verify your email id as well as your phone number.
>- You will receive verification link in the email provided during Twilio sign up. Go ahead and verify your email id.
![](doc/source/images/verifyTwilio.png)

- Once email id is verified you will be prompted to enter your phone number, submit that and you will get an OTP on your registered number, enter that back to verify.

![](doc/source/images/verifyMobileTwilio.png)

- On successful verification you should see a welcome greeting message, additionally you will see some questions, select as described below.

![](doc/source/images/twilio-details.png)

Questions|Answers
--|--
Which Twilio product are you here to use?| WhatsApp
What do you plan to build with Twilio?| IVR & Bots
How do you want to build with Twilio?| With code
What is your preferred coding language?| Python
Would you like Twilio to host your code?| No, I want to use my own hosting service

- Visit the Whatsapp section in Twilio <https://www.twilio.com/console/sms/whatsapp/sandbox>

- You will see a popup box reqsuesting you to **Activate Your Sandbox**, click on **I agree** checkbox and click **Confirm**.
![](doc/source/images/allowSandbox.png)

- The sandbox for WhatsApp will appear, make a note of the `Sandbox Name` which will be prefixed with **join**, click on **Settings** on the left panel and select **WhatsApp Sandbox Settings**.
![](doc/source/images/twilioSettings.png)

- In **WhatsApp Sandbox Settings** page, under **Sandbox Configuration**, there will be a field called **WHEN A MESSAGE COMES IN**, replace the existing URL in that field with the `URL` obtained by deploying the Python Application from [Step 3](#3-build-and-deploy-the-python-application), finally click on **Save** to save the configuration.
![](doc/source/images/whatsappSandbox.png)

>NOTE: Sometimes the changes are not saved in Twilio WhatsApp Sandbox Settings even after clicking on save, reload the page to enusre the `URL` that you have entered in **WHEN A MESSAGE COMES IN** field is reflecting over there. If you still see the old URL over there then enter the `URL` from [Step 3](#3-build-and-deploy-the-python-application) again and save it.
- Now the Python Application is configured in Twilio, any message that you send from WhatsApp from this point will go to the Python Application via Twilio WhatsApp Sandbox. However to reply back to you from WhatsApp the Python Application needs to establish connection with Twilio.

- To establish connection between the Python Application and Twilio we need to get the `account_sid` and `auth_token` from Twilio.

- Visit <https://www.twilio.com/console> and expand the **Project Info** tab. You will see the `ACCOUNT ID` and `AUTH TOKEN`, copy it in some notepad as it will be used in [Step 5](#5-configure-credentials).
![](doc/source/images/twilio-credentials-from-twilio-console.png)

- At this point, you should have the `Sandbox Name`, `account_sid` and `auth_token` from Twilio service.ss

### 5. Try out voicebot on WhatsApp

Expand Down
Binary file added doc/source/images/allowSandbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/images/twilio-details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/images/twilioSettings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/images/verifyMobileTwilio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/images/verifyTwilio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/images/whatsappSandbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b52ccff

Please sign in to comment.