Flint makes Khoj, your personal AI, accessible over Whatsapp.
So you can converse with it easily, on your phone or computer.
If you want to start chatting with our hosted Khoj right away, you have two options:
- 🪧 Use the QR code
- 📞 Directly use the phone number
- Add the number +1 (848) 800-4242 to your contacts and send a message to it on WhatsApp.
You can get setup with your own instance of Khoj via WhatsApp in a few simple steps.
- Fill in the relevant environment variables in the
docker-compose.yml
file under theapp
service. - Start the service.
$ docker-compose up
In order to setup the database, you need to run the migrations. This needs to be done before you can start using the service, and anytime a new migration is added.
- SSH into the docker container. You can get the name of the container by running
docker container ls
.
$ docker exec -it khoj_app_1 bash
- Run the migrations.
$ python3 src/flint/manage.py migrate
- Go to
localhost:8488/docs
in your browser. You should see the Swagger UI. - Click on the
/dev/chat
endpoint. - Click on the "Try it out" button.
- Enter any prompt in the
Body
field and click on the "Execute" button. You should get a response from the flint service.
If this didn't work, you might need to debug what's wrong.
- Install ngrok.
- Run ngrok on port 8488.
$ ngrok http 8488
- This will output a url, like
https://abcd-ef-ghi-123-456.ngrok-free.app
. Copy this url and use it in the next step.
- Create a Twilio account.
- In the Twilio console, setup a Sanbox for Whatsapp.
- Send a message to the Twilio Whatsapp number with the secret code. You should get a response first from Twilio
- In the Sandbox Setings tab, set the webhook to the ngrok url at the
/api/chat
endpoint. From the previous example, that would behttps://abcd-ef-ghi-123-456.ngrok-free.app/api/chat
under the "WHEN A MESSAGE COMES IN" section. - Send a message to the Twilio Whatsapp number. You should get a response from the flint service.
And you're done! You can now chat with your bot over Whatsapp. When you're done finalizing your bot, make sure to flip the DEBUG
flag in the docker-compose.yml
file to False
or remove it altogether.
Khoj can handle multiturn conversations and can continue the conversation from where you left off. It works well as a companion for though and reasoning, and can be used to keep track of your thoughts and ideas. You can think of it as a journal that you can talk to.
This service works by provisioning a Postgres database on your machine that stores your conversation history. Every additional number that chats with your bot will have a separate conversation history. This is done by using the Twilio From
number as the key in the database.