This is an example project for TalkJS's tutorial on How to integrate a chatbot into your TalkJS chat with the OpenAI API.
The project uses TalkJS webhooks to listen for new message events from the TalkJS server, calls the OpenAI API to generate a message reply, and then adds the reply to the conversation with the TalkJS API.
To run this tutorial, you will need:
- A TalkJS account
- An Open AI account and API key
- Node.js
- npm
- ngrok
- Clone or download the project.
- Replace
<APP_ID>
and<TALKJS_SECRET_KEY>
inindex.html
andserver.js
with the values found in your TalkJS dashboard. - Replace
<OPENAI_SECRET_KEY>
with your OpenAI API key - Enable the
message.sent
option in the Webhooks section of the TalkJS dashboard. - Start ngrok with
ngrok http 3000
. - Add the ngrok URL to Webhook URLs in the TalkJS dashboard.
- Run
npm install
to install dependencies. - Run
npm start
to start the webhooks server.