title: how can i send custom sms message with twilio api via express
body: <p>so im trying to make a simple function in a web that has input and button , and when i click the button twilio api send message with the body of input value life if input is hello the message sent is hello, this is the index.js file which is include the simple function that gonna send the message and i don't know if i should use POST method or get just look</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let input = document.querySelector("input").value;
  document.querySelector("button").addEventListener("click", whatTheHell);
  let whatTheHell = () =&gt; {
    fetch("/sendSms")
      .then((res) =&gt; res.json())
      .then((res) =&gt; console.log(res))
      .catch((err) =&gt; console.log(err));
  };</code></pre>
  </div>
  </div>
  </p>
  <p>and this the express.js file that contain the twilio api that gonna send the sms</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const express = require("express");
  if (process.env.NODE_ENV !== "production") {
    require("dotenv").config();
  }
  const accountSid = process.env.accountSid;
  const authToken = process.env.authToken ; 
  const app = express();
  const client = require("twilio")(accountSid, authToken);
  app.use(express.json());
  app.use(express.static("public"));
  
  app.get("/sendSms", (req, res) =&gt; {
    client.messages
      .create({
        body: "message from me",
        messagingServiceSid: "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        to: "NUMBER",
      })
      .then((message) =&gt; {
        res.json({ message: message }).done();
      });
  });
  
  app.listen(3000, () =&gt; {
    console.log("Server Started");
  });</code></pre>
  </div>
  </div>
  </p>
  <p>so what i want here in  body: &quot;message from me&quot; is to be something like this body : user.input or something like that , i tried using post method and did req.body.msg and msg is input.value but it dont accept post method .</p>