Push based workflow is more efficient than repeated pulls (polling). Thankfully, there is currently a free service for the same which is easy to use : https://streambin.pbedat.de/. There is also emitter.io and free, public MQTT brokers such as broker.hivemq.com (list).
-
Create a unique channel-key - it may be the hash of your email id or the hash of your MAC address, or may even be the fingerprint of freshly generated private-public keypair.
-
url="https://streambin.pbedat.de/streams/${channel_key}"
-
Create the channel
curl -N "${url}" &>/dev/null &
-
Subscribe to it and filter the stream
curl -N -sf "${url}/out" | grep --line-buffered ^data: | stdbuf -oL cut -d ' ' -f 2- | grep --line-buffered -v ^hello$
-
Publish:
curl --header "Content-Type: application/json" --request POST \ --data '{ "type": "my-event", "data": "your_message"}' "${url}/in"
Or, use a file to store the payload:
message=<your_message>
file=<path_to_payload_file>
echo "{\"data\":\"${message}\"}" > ${file}
Then POST:
curl --header "Content-Type: application/json" --request POST \
--data @"${file}" "${url}/in"