0

我需要在 nodejs 中创建 2 路 SMS API。我收到了来自 twilio 的消息,但是当我回复同一条消息时没有收到消息

回复.js

const http = require("http");
const express = require("express");
const MessagingResponse = require("twilio").twiml.MessagingResponse;
const app = express();
app.post("/sms", (req, res) => {
  const twiml = new MessagingResponse();
  console.log(req.body);
  twiml.message("Thank you for calling!. We got your message, Thank You.");
  res.writeHead(200, { "content-Type": "text/xml" });
  res.end(twiml.toString());
});

http
  .createServer(app)
  .listen(3000, () => console.log("server is up and running on port 3000"));

我通过 ngrok http 3000 更新了 webhook 中 twilio 编号中的 url,以获取来自 ngrok 的消息。每当我用来回复消息时,我都无法在 ngrok 中看到任何日志。请帮助我。印度原产地号码是否有任何限制。我曾经从印度号码回复messgae。

4

2 回答 2

0

调试器是查看您的配置是否正确设置的第一个地方。所有 webhook 调用错误和警告都记录在那里

于 2020-09-17T03:31:57.583 回答
0

检查Twilio 控制台中的调试器,它很可能有错误消息。您必须将 SMS 发送到 Twilio 以供您的 TwiMLThank you for calling!. We got your message, Thank You.申请。

于 2020-09-16T11:51:27.210 回答