<?php
// Get the request body
$rawData = file_get_contents('php://input');
// Parse the JSON data
$data = json_decode($rawData, true);
// Check if JSON data was successfully parsed
if ($data === null) {
http_response_code(400); // Bad Request
die("Invalid JSON data");
}
// Handle the webhook data
echo "Webhook Data Received:\n";
print_r($data);
// You can now process the data as needed
const express = require('express');
const app = express();
const port = 3000; // You can choose any available port
// Middleware to parse JSON
app.use(express.json());
// Webhook endpoint
app.post('/webhook', (req, res) => {
// Webhook data
const webhookData = req.body;
// Handle the webhook data
console.log('Webhook Data Received:');
console.log(webhookData);
// You can now process the data as needed
res.status(200).send('Webhook received successfully');
});
app.listen(port, () => {
console.log(`Webhook server is running on port ${port}`);
});
from flask import Flask, request, abort, jsonify
app = Flask(__name__)
# Webhook endpoint
@app.route('/webhook', methods=['POST'])
def webhook():
# Get and parse the JSON data
try:
webhook_data = request.get_json()
except ValueError:
abort(400) # Bad Request
# Handle the webhook data
print('Webhook Data Received:')
print(webhook_data)
# You can now process the data as needed
return 'Webhook received successfully', 200
if __name__ == '__main__':
app.run(debug=True)