mirror of
https://github.com/cheveguerra/whatsapp-api-tutorial.git
synced 2026-04-17 19:36:59 +00:00
56 lines
2.1 KiB
Markdown
56 lines
2.1 KiB
Markdown
# Whatsapp API Tutorial
|
|
|
|
Hi, this is the implementation example of <a href="https://github.com/pedroslopez/whatsapp-web.js">whatsapp-web.js</a>
|
|
|
|
Watch the tutorials:
|
|
|
|
- <a href="https://youtu.be/IRRiN2ZQDc8">Whatsapp API Tutorial: Part 1</a>
|
|
- <a href="https://youtu.be/hYpRQ_FE1JI">Whatsapp API Tutorial: Part 2</a>
|
|
- <a href="https://youtu.be/uBu7Zfba1zA">Whatsapp API Tutorial: Tips & Tricks</a>
|
|
- <a href="https://youtu.be/ksVBXF-6Jtc">Whatsapp API Tutorial: Sending Media File</a>
|
|
- <a href="https://youtu.be/uSzjbuaHexk">Whatsapp API Tutorial: Deploy to Heroku</a>
|
|
- <a href="https://youtu.be/5VfM9PvrYcE">Whatsapp API Tutorial: Multiple Device</a>
|
|
- <a href="https://youtu.be/Cq8ru8iKAVk">Whatsapp API Tutorial: Multiple Device | Part 2</a>
|
|
- <a href="https://youtu.be/bgxxUWqW6WU">Whatsapp API Tutorial: Fix Heroku Session</a>
|
|
- <a href="https://youtu.be/iode8kstDYQ">Whatsapp API Tutorial: Dynamic Message Reply</a>
|
|
|
|
### How to use?
|
|
|
|
- Clone or download this repo
|
|
- Enter to the project directory
|
|
- Run `npm install`
|
|
- Run `npm run start:dev`
|
|
- Open browser and go to address `http://localhost:8000`
|
|
- Scan the QR Code
|
|
- Enjoy!
|
|
|
|
### Send message to group
|
|
|
|
You can send the message to any group by using `chatID` or group `name`, chatID will used if you specify the `id` field in the form, so if you want to send by `name`, only use name.
|
|
|
|
**Paramaters:**
|
|
|
|
- `id` (optional if name given): the chat ID
|
|
- `name` (optional): group name
|
|
- `message`: the message
|
|
|
|
Here the endpoint: `/send-group-message`
|
|
|
|
Here the way to get the groups info (including ID & name):
|
|
|
|
- Send a message to the API number `!groups`
|
|
- The API will replying with the groups info
|
|
- Use the ID to send a message
|
|
|
|
### Downloading media
|
|
|
|
I add an example to downloading the message media if exists. Please check it in `on message` event!
|
|
|
|
We use `mime-types` package to get the file extension by it's mimetype, so we can download all of the type of media message.
|
|
|
|
And we decided (for this example) to use time as the filename, because the media filename is not certain exists.
|
|
|
|
## Support Me
|
|
|
|
You can make a support for this work by <a href="https://karyakarsa.com/ngekoding/">Karya Karsa</a>. Thanks
|