fffssss
This commit is contained in:
parent
36a473fa14
commit
e8e10a876e
2
index.js
2
index.js
@ -60,6 +60,7 @@ app.post('/sendText', async (req, res) => {
|
|||||||
const { phone, message } = req.body;
|
const { phone, message } = req.body;
|
||||||
if (!sock || !isConnected) return res.status(400).json({ error: 'Non connecté' });
|
if (!sock || !isConnected) return res.status(400).json({ error: 'Non connecté' });
|
||||||
try {
|
try {
|
||||||
|
|
||||||
await sock.sendMessage(`${phone}@s.whatsapp.net`, { text: message });
|
await sock.sendMessage(`${phone}@s.whatsapp.net`, { text: message });
|
||||||
res.json({ success: true });
|
res.json({ success: true });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -76,6 +77,7 @@ app.post('/sendButtons', async (req, res) => {
|
|||||||
buttons: buttons.map((b, i) => ({ buttonId: `btn_${i}`, buttonText: { displayText: b }, type: 1 })),
|
buttons: buttons.map((b, i) => ({ buttonId: `btn_${i}`, buttonText: { displayText: b }, type: 1 })),
|
||||||
headerType: 1
|
headerType: 1
|
||||||
};
|
};
|
||||||
|
console.log(btnMsg);
|
||||||
await sock.sendMessage(`${phone}@s.whatsapp.net`, btnMsg);
|
await sock.sendMessage(`${phone}@s.whatsapp.net`, btnMsg);
|
||||||
res.json({ success: true });
|
res.json({ success: true });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user