julianschiavo / whatsapp-chatgpt

MIT License
1 stars 0 forks source link

Hello there, did you know how to fix this? #1

Open xBabylonia opened 1 year ago

xBabylonia commented 1 year ago

Error: username is required at new Twilio (C:\Users\xxx\Videos\wa\node_modules\twilio\lib\rest\Twilio.js:142:11) at initializer (C:\Users\xxx\Videos\wa\node_modules\twilio\lib\index.js:10:10) at file:///C:/Users/xxx/Videos/wa/index.js:19:16 at ModuleJob.run (node:internal/modules/esm/module_job:193:25) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:533:24) at async loadESM (node:internal/process/esm_loader:91:5) at async handleMainPromise (node:internal/modules/run_main:65:12)

julianschiavo commented 1 year ago

You need to add a .env file to the root of the project, as such. Note that this project is not ready for public use, it's very much still in development.

Create a Twilio account and set up the Sandbox WhatsApp account, as you are directed to do

Then:

.env

CHATGPT_SESSION_TOKEN=
TWILIO_SID=
TWILIO_TOKEN=
TWILIO_NUMBER=+00000000000
ALLOWED_NUMBERS=whatsapp:+0000000000,+00000000000

You also need to (as I said, this project is very experimental):

npm i
cd node_modules
rm -rf chatgpt
cd ..
cp chatgpt-imp node_modules/chatgpt
cd node_modules/chatgpt
npm i
cd ../..

Then run node index.js

xBabylonia commented 1 year ago

C:\Users\xxx\Videos\wa>node index.js ChatGPTAPI: Authentication successful

now its stuck in theres,

i though this already for public 😅 sorry T_T

julianschiavo commented 1 year ago

It's not stuck.

You need to make sure your Twilio account is configured to call (your domain.com)/receive as the 'web hook' for incoming messages.

You can test this out locally, e.g. using the Postman app to send test HTTP requests. POST to localhost:1337/receive with a body (encoding x-www-form-urlencoded) with fields "From" (e.g. "+0000000000"), "To" (same, just a number), and "Body" (your question).