This repository includes the first iteration of a product recommendation chatbot.
Stack:
- Whatsapp for the user facing functionality.
- Azure functions for the backend components
- OpenAI for the chatbot functionalities.
The code is written in TypeScript.
-
Install the Azure CLI and Azure functions core tools:
brew update && brew upgrade && brew cleanup || true brew install az brew tap azure/functions brew install azure-functions-core-tools@4
-
Install Node 20 and the project dependencies:
brew install nvm nvm install 20 && nvm use 20 npm install
-
Create a file called
local.settings.json
in the root folder of the repository, and add the env variables and secrets - you need to request these from another developer. -
Make sure to use Node 20 (not 21+)! For example, use NVM and do the following:
brew install nvm nvm install 20 nvm use 20
Note- you can make v20 the default with
nvm alias default 20
, so you will not need to repeat this. -
Start the local development server:
npm run watch
Optionally if for some reason you do not want to run in watch mode, do:
npm run build npm run start
-
Send requests to the function, for example:
curl -i -X POST http://localhost:7071/api/basemind-whatsapp-webhook -H 'Content-Type: application/json' -d '["please find me a new iphone mini"]'
Deployment occurs through GitHub actions on push to the main branch. You can still deploy locally though, by doing the following:
-
Login to Azure
az login
-
Deploy the function to Azure
func azure functionapp publish basemind-whatsapp-webhook
Note: you will need to have the correct permissions to deploy to the Azure subscription.
You can also deploy AND sync your local settings to the cloud at the same time by doing the following:
func azure functionapp publish basemind-whatsapp-webhook --publish-local-settings
To set the environment variables in the cloud to match those used locally, simply do the following:
func azure functionapp publish basemind-whatsapp-webhook --publish-settings-only