Skip to content

Commit

Permalink
Add post handler and group ids
Browse files Browse the repository at this point in the history
  • Loading branch information
abhimanyu-fm committed Dec 29, 2023
1 parent 1fa6571 commit 1dfdd06
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion whatsapp-js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@ import { processGroup } from "./src/inputParser.js";
import express from 'express';
const app = express();
const port = 3000;
const ggnSouthCityChatId = '[email protected]'
const hydChatId = '[email protected]'

app.post("/", (req, res) => {
const testGroupChatId = "[email protected]";
client.sendMessage(testGroupChatId, 'Print List');
res.send("Hello World!");
});

app.get("/", (req, res) => {
const testGroupChatId = "[email protected]";
client.sendMessage(testGroupChatId, 'Call api for list');
client.sendMessage(testGroupChatId, 'Print List');
res.send("Hello World!");
});

Expand Down Expand Up @@ -46,6 +54,8 @@ client.initialize();
client.on("message", async (msg) => {
const contact = await msg.getContact();
const chat = await msg.getChat();
// Way to get the chat id used.
// console.log(chat.id._serialized);
console.log(contact.number);
let content = msg.body;
if (!content || content === "") {
Expand Down

0 comments on commit 1dfdd06

Please sign in to comment.