【问题标题】:Receive WhatsApp messages using Node.js使用 Node.js 接收 WhatsApp 消息
【发布时间】:2022-02-17 05:11:33
【问题描述】:

我正在尝试使用 ultramsg 通过 WhatsApp api 读取用户的消息

并使用NGROK

const express = require('express')
const bodyParser = require('body-parser')
const app = express()
const PORT = 4000
app.use(bodyParser.json())
app.listen(PORT, () => console.log(`Server running ${PORT}`))

ngrok 显示显示 404 错误

【问题讨论】:

    标签: node.js whatsapp ngrok


    【解决方案1】:

    你需要设置一个 webhook 路由

    app.use(bodyParser.json())
    app.post('/test_webhook', (req, res) => {
      console.log(req.body)
      res.status(200).end()
    })
    

    现在 Webhook URL 是:http://your_ngrok_url/test_webhook

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-14
      • 2015-12-31
      • 2019-09-26
      • 2019-09-19
      • 2020-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多