<?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 parsedif ($data===null) {
http_response_code(400); // Bad Requestdie("Invalid JSON data");
}
// Handle the webhook dataecho"Webhook Data Received:\n";
print_r($data);
// You can now process the data as needed
constexpress=require('express');
constapp=express();
constport=3000; // You can choose any available port// Middleware to parse JSONapp.use(express.json());
// Webhook endpointapp.post('/webhook', (req, res) => {
// Webhook dataconstwebhookData=req.body;
// Handle the webhook dataconsole.log('Webhook Data Received:');
console.log(webhookData);
// You can now process the data as neededres.status(200).send('Webhook received successfully');
});
app.listen(port, () => {
console.log(`Webhook server is running on port ${port}`);
});
fromflaskimportFlask, request, abort, jsonifyapp=Flask(__name__)
# Webhook endpoint@app.route('/webhook', methods=['POST'])
defwebhook():
# Get and parse the JSON datatry:
webhook_data=request.get_json()
exceptValueError:
abort(400) # Bad Request# Handle the webhook dataprint('Webhook Data Received:')
print(webhook_data)
# You can now process the data as neededreturn'Webhook received successfully', 200if__name__=='__main__':
app.run(debug=True)