For receiving webhooks without messing with firewalls etc use a public webserver to receive the request then poll that server for the data? My example is PHP - maybe be better in Go or Node.js, depending on how realtime you needed the thing to feel?
<?php
const PRIVATE_KEY = "my_private_key";
// Authenticate
if(!@$_REQUEST["key"] || $_REQUEST["key"] !== PRIVATE_KEY) {
header('HTTP/1.0 401 Unauthorized');
echo 'HTTP/1.0 401 Unauthorized';
die();
}
// Handle request
if($_POST) {
// Update data and write to a file - validation maybe - but it should be data you expect
file_put_contents('data.espruino', json_encode($_POST));
} else {
// Get data from file, set headers and display
header('Content-Type: application/json');
echo file_get_contents('data.espruino');
}
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
For receiving webhooks without messing with firewalls etc use a public webserver to receive the request then poll that server for the data? My example is PHP - maybe be better in Go or Node.js, depending on how realtime you needed the thing to feel?