简体   繁体   中英

I am not able to implement to reply message to twilio number

I need to create 2 way SMS API in nodejs. I am receiving a message from twilio but I am not receiving a message when I reply to the same message

reply.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"));

I updated the url in twilio number in webhook for message come in field from ngrok by ngrok http 3000. whenever I used to reply the message I am not able to see any log in ngrok. plase help me. Is there any restriction for india origin based number. I used to reply messgae from India number.

Check you debugger in the Twilio console, it most likely has an error message. You must send an SMS into Twilio for your TwiML, Thank you for calling!. We got your message, Thank You. Thank you for calling!. We got your message, Thank You. to apply.

The debugger is the first place to look if your configuration is set up properly. All webhook calls errors and warnings are logged there

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM