This repo allows testing the functions of the WppConnect library through API requests to custom endpoints using Express.js.
- Testing with the WppConnect library: Allows testing various functions of the WppConnect library.
- Integration with Typebot: Monitors messages received on WhatsApp and interacts with Typebot.
- Node.js
- npm or yarn
-
Clone the repository:
git clone https://github.com/ShinjiBruno/zap-ts.git cd zap-ts
-
Install the dependencies:
npm install
-
Create a .env file in the root of the project and add the environment variables as specified in the .env.example file:
TYPEBOT_TOKEN='YOUR_TYPEBOT_TOKEN' TYPEBOT_PUBLICID='YOUR_TYPEBOT_PUBLIC_ID' TYPEBOT_URL='YOUR_TYPEBOT_URL'
-
Start the server:
npm start
-
Access the endpoints defined in the wpp.ts file to interact with the API.
The endpoints are defined in the wppAPIs
method in the wpp.ts file. Here are some examples:
- POST /connect-session: Connects a new session.
- POST /connect-and-post: Connects a new session and posts a message.
- GET /list-chats: Lists all chats.
- GET /list-messages: Lists all messages of a specific chat.
- GET /get-session-token: Retrieves the session token.
- GET /get-file: Downloads a file from a specific message.
You can use tools like ThunderClient extension in VSCode to make the requests.
The default URL is http://localhost:3010
, where the port is defined in wpp.ts
. You can change it as needed.
To integrate with Typebot, uncomment the monitorChat
line in the index.ts
file and comment out the wppAPIs()
line. This will start monitoring messages received on WhatsApp. Before that, connect your account as per the instructions above.
- Improve integration with Typebot.
- Add more filters for Typebot API responses.