From 9dda15fb7d3c179d209b99c3ea727bbef50fa420 Mon Sep 17 00:00:00 2001 From: Shrey Pandey Date: Mon, 27 May 2024 11:16:45 +0530 Subject: [PATCH] Updated quickstart --- docs/tutorials/Quickstart.md | 56 +++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/docs/tutorials/Quickstart.md b/docs/tutorials/Quickstart.md index 140571bd..e7beee5f 100644 --- a/docs/tutorials/Quickstart.md +++ b/docs/tutorials/Quickstart.md @@ -4,9 +4,9 @@ title: Quickstart --- ## Prerequisite -1. Docker - Ensure that your system has docker engine installed and running. For installation, please refer to [docker engine installation instruction](https://docs.docker.com/engine/install/). -2. Docker Compose - Ensure docker compose is enabled along with docker engine. Please refer to [docker compose installation instruction](https://docs.docker.com/compose/install/). -3. NGROK - NGROK is required to tunnel the Whatsapp callback URL to your local system. Please refer to [NGROK Quickstart Guide](https://ngrok.com/docs/getting-started/) for installation. +1. **Docker** - Ensure that your system has docker engine installed and running. For installation, please refer to [docker engine installation instruction](https://docs.docker.com/engine/install/). +2. **Docker Compose** - Ensure docker compose is enabled along with docker engine. Please refer to [docker compose installation instruction](https://docs.docker.com/compose/install/). +3. **NGROK** - NGROK is required to tunnel the Whatsapp callback URL to your local system. Please refer to [NGROK Quickstart Guide](https://ngrok.com/docs/getting-started/) for installation. ## Running JB Manager @@ -48,37 +48,41 @@ $ bash scripts/run.sh --stage api channel language flow frontend ## Bot Installation and Go Live -1. Go to [JB Manager UI](https://localhost:4173) +1. Go to [JB Manager UI](http://localhost:4173) 2. Click on install new bot and provide the required data to create your bot. The detailed information about the fields are given below: - 1. **Name [Mandatory]** is the name of the bot. + 1. **Name [Mandatory]** is the name of the bot. It should be the name of class for your bot code mentioned below. For this example, use `CarWashDealerFSM`. 2. **Code [Mandatory]** is the fsm.py file python code. Copy the contents of [python file](car_wash.py) and paste it. - 3. **Requirements [Optional if no specialised pacakge is used in code]** is the required packages name with their versions as we put them usually in requirements.txt or pyproject.toml dependencies. For the above example, we don't have any external dependencies. - 4. **index_urls [Optional]** is for custom and private packages links to download them from (This is for the case you use a library that your team has developed and internally published). - 5. **version [Mandatory]** - version of the bot. Put `1.0.0`. - 6. **required_credentials [Mandatory]** - Credentials required by the bot to access various services. Here the FSM depends on `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_API_VERSION` and `AZURE_OPENAI_API_ENDPOINT`, so put these keys in this section. - 7. Click on `Install` button + 3. **version [Mandatory]** - version of the bot. Put `1.0.0`. + 4. **required_credentials [Mandatory]** - Credentials required by the bot to access various external services. Here the FSM depends on `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_API_VERSION` and `AZURE_OPENAI_API_ENDPOINT`, so put these keys in this section seperated by comma. + 5. Click on `Install` button. -3. * Once the bot is created, click on the **settings (⚙) icon** to enter the given credentials values and click save to save the credentials values. For this example, put the values of `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_API_VERSION` and `AZURE_OPENAI_API_ENDPOINT`. +3. Once the bot is created, click on the **settings (⚙) icon** to enter the given credentials values and click save to save the credentials values. For this example, put the values of `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_API_VERSION` and `AZURE_OPENAI_API_ENDPOINT`. 4. Then click on the **play (▶️) icon** to activate the bot by providing the whatsapp business phone number in `phone number` and whatsapp api key in the `whatsapp` field. 5. Once the above steps are completed, the bot status will be changed from **inactive** to **active**. 6. Start ngrok on your system -```bash -$ ngrok http 8000 -``` + ```bash + $ ngrok http 8000 + ``` 7. Copy the tunnel url from the ngrok shell. -8. Add this url as the callback URL for Whatsapp service provider. Your callback url will look like this `/callback`. Use the shell script to add the callback URL. +8. Add this url to register the callback URL for Whatsapp service provider. Your callback url will look like this `/callback`. -```bash -#!/bin/bash + For this tutorial, we are using the shell script to add the callback URL. Run the script with the appropriate values to register the callback URL. + + ```bash + #!/bin/bash -WEBHOOK_URL=$1 + WEBHOOK_URL="" + WA_API_HOST="" + WABA_NUMBER="" + WA_API_KEY="" -BODY='{"webhook_url": "'$WEBHOOK_URL'"}' -echo $BODY + BODY='{"webhook_url": "'$WEBHOOK_URL'"}' + echo $BODY -curl -k "$WA_API_HOST/v1/setwebhooks" \ ---header "wanumber: $WABA_NUMBER" \ ---header "apikey: $WA_API_KEY" \ ---header 'Content-Type: application/json' \ ---data-raw "$BODY" -``` \ No newline at end of file + curl -k "$WA_API_HOST/v1/setwebhooks" \ + --header "wanumber: $WABA_NUMBER" \ + --header "apikey: $WA_API_KEY" \ + --header 'Content-Type: application/json' \ + --data-raw "$BODY" + ``` +9. Your bot is running. Send a `Hi` message to whatsapp business number to start conversation with the bot. \ No newline at end of file