Skip to main content

Webhooks Setup

The PIOPIY platform will notify your web server POST method URL with JSON CDR (Call Detail Record) when incoming and outgoing calls are completed.

How to setup webhooks ?

To set up webhooks for receiving Live Events and CDR (Call Detail Record) from the PIOPIY platform, follow these steps:

1. Login to the Dashboard :

2. Access App Details :

  • Your app id and app name will be displayed in the panel, click the app id and enter into the dashboard.

Where to place your web server URL ?

1. Create a public URL using ngrok :

  • To expose your local server to the internet, use ngrok to create a public URL:
ngrok http 5000

ngrok

  • You will receive a public ngrok URL, for example: https://7dc6-103-163-248-90.ngrok-free.app.

2. Enter Your URLs in the Dashboard :

  • In the CDR URL section of the PIOPIY dashboard, paste your ngrok URL (e.g., https://7dc6-103-163-248-90.ngrok-free.app/cdr).

Webhooks

  • In the Event URL section, paste your event handler URL (e.g., https://7dc6-103-163-248-90.ngrok-free.app/event).

Webhooks

3. Map the URLs :

  • Once you've entered the URLs, click the MAP APP button to successfully map your webhook URLs to your app.

Webhooks

4. Run Your Local Server :

  • If you're using Node.js, run your server with the following command:
// server.js file

const express = require("express"),
bodyParser = require("body-parser"),
app = express();

app.use(bodyParser.json());

app.post("/cdr", (req, res) => {
console.log("CDR Received:", req.body);
res.send("Received");
});

app.post("/event", (req, res) => {
console.log("Event Received:", req.body);
res.send("Received");
});

app.listen(5000, () => {
console.log("Server running on port 5000");
});

Run the code :

  • Execute the code using Node.js:
node sever.js
Note
  • Your web server URL is the POST method.
  • Ensure that your web server URL (e.g., ngrok URL) is publicly accessible from the internet.

Now your webhook setup is ready to receive Live Events and CDR (Call Detail Record) from the PIOPIY platform.