Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zain-ul-din/whatsapp-ping
A bot to ping me directly on whatsapp using a web hook
https://github.com/zain-ul-din/whatsapp-ping
contribute messaging notifications open-source web web-hook whatsapp whatsapp-ping
Last synced: 12 days ago
JSON representation
A bot to ping me directly on whatsapp using a web hook
- Host: GitHub
- URL: https://github.com/zain-ul-din/whatsapp-ping
- Owner: Zain-ul-din
- License: mit
- Created: 2024-08-27T11:18:45.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-11-22T19:13:45.000Z (about 1 month ago)
- Last Synced: 2024-12-03T15:49:14.080Z (19 days ago)
- Topics: contribute, messaging, notifications, open-source, web, web-hook, whatsapp, whatsapp-ping
- Language: CSS
- Homepage:
- Size: 7.99 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
WhatsApp Ping 🔔Catching messages on Gmail from clients always has me running late, and checking it over and over can be a real drag. That's why I created `whatsapp ping`! It lets me ping myself on WhatsApp using a webhook.
https://github.com/user-attachments/assets/5735be0c-a388-40de-bcab-38ed4bd28281
### Use Cases
few use cases of this project generated by gpt.
- 🔔 Instant Notifications: Get WhatsApp alerts for important client emails.
- 📬 Stay Connected: Easily send quick messages to your team or clients.
- 📅 Task Reminders: Schedule pings to remind yourself of upcoming tasks.
- 🎉 Timely Notification: Wish your friend a happy birthday right on time.
- 👨💻 Programmatic Use: Thanks to webhooks, integrate notifications into any app or service.### Usage
clone or fork the repo and install all dependencies using your favorite package manager. In my case, i'm using `pnpm`.
```bash
pnpm i
```**Prepare environment variables:**
you need two env variables to make this work
```env
API_KEY=YOUR_API_KEY
MONGO_URL=your_url# optional
SELF_HOSTED=boolean -> set to true if running in self-hosted environment
LOCAL=boolean -> for development purposes
NEXT_MSG_DELAY=number > delays between next message```
We use `api-key` for authentication you can use any key you like to use but we recommend using strong key that is not vulnerable to `brute-force` attack.
```bash
openssl rand -base64 256
```To run this bot in a serverless environment, we use MongoDB to manage the authentication state.
You can Get the MongoDB URL for free from their [website](https://www.mongodb.com/).
```js
mongodb+srv://:@cluster0.usggwa4.mongodb.net/?retryWrites=true&w=majority
```**start the server using the following command:**
```bash
pnpm dev # start development server
OR
pnpm start # start server in production
```After starting the server, it will print QR code in the terminal scan it using your phone to connect whatsapp.
### ⚓ Web Hook Usage
Next use web hook as following to send a message,
```c
curl -X POST localhost:8080/ping \
-H "Authorization: Bearer $YOUR_API_KEY"
-d '{
"message": "hello world",
"numbers": ["123456789012"]
}'
```using js,
```js
fetch("http://localhost:8080/ping", {
headers: {
Authorization: "Bearer YOUR_KEY",
"Content-Type": "application/json"
},
method: "POST",
body: JSON.stringify({
message: "hey",
numbers: ["<...number>"]
})
})
.then((res) => res.text())
.then((res) => console.log(res));
```### Caveats
```diff
- If you plan to deploy this project, it currently works only on VPS and not in a serverless environment. This means you will not be able to deploy it to the Vercel or other serverless providers.
+ We just added support for serverless deployment https://github.com/Zain-ul-din/whatsapp-ping/issues/2
```
## 😻 Sponsors
A big thank you to these people for supporting this project.
#### Thanks to These Awesome Projects:
- [@whiskeysockets/baileys](https://www.npmjs.com/package/@whiskeysockets/baileys)
- [mongo-baileys](https://www.npmjs.com/package/mongo-baileys)---