Skip to content

Commit

Permalink
Merge pull request #57 from OpenNyAI/documentation
Browse files Browse the repository at this point in the history
Updated quickstart
  • Loading branch information
sameersegal authored May 27, 2024
2 parents 6192e9d + 9dda15f commit 12ce2ad
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions docs/tutorials/Quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 `<Tunnel URL>/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 `<Tunnel URL>/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="<Webhook url here>"
WA_API_HOST="<API host here>"
WABA_NUMBER="<Whatsapp business account number>"
WA_API_KEY="<API Key here>"
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"
```
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.

0 comments on commit 12ce2ad

Please sign in to comment.