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

129 Views Asked by At

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.

2

There are 2 best solutions below

0
On

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. to apply.

0
On

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