Skip to content

Commit

Permalink
Merge pull request #119 from flickmatch/addPost
Browse files Browse the repository at this point in the history
Add post handler and create const chatids
  • Loading branch information
hvs-flick authored Dec 31, 2023
2 parents 1fa6571 + 1dfdd06 commit dc98886
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 dc98886

Please sign in to comment.