Webhook get submission with nodejs

You can get the submission data using webhook with javascript.

const express = require("express");
const app = express();
app.use(express.json());

async function sendFonnte(data) {
  const url = "https://api.fonnte.com/send";

  const customHeaders = {
    "Content-Type": "application/json",
    Authorization: TOKEN ,
  };

  const response = await fetch(url, {
    method: "POST",
    headers: customHeaders,
    body: JSON.stringify(data),
  });
  console.log(await response.json());
}

app.post("/submission", function (req, res) {
  console.log(req.body);
  const data = {
      target: "082227097005",
      message: "webhook submission working great!",
    sendFonnte(data);
  } 
  res.end();
});

app.listen(3000, function (err) {
  if (err) console.log(err);
  console.log("Server listening on PORT", 3000);
});

Available parameter

  • Submission- The submission name
  • Sender - Sender's whatsapp number
  • Name - The sender's name
  • List - The submission data

Related knowledge

See more
Made with in Indonesia