Feature Suggestion: Outgoing Webhook

I am having a special use case here. Relatives and friends love to follow my plane online and being an IT guy myself I would like to suggest the following:

Have a special item which triggers a webhook somewhere when checked.

My use case:
Last check item in the run-up check would trigger a webhook which then will post in a “follow the plane” telegram group: Like: The machine is about to start, follow us on flight aware under this link…

You can pull that off relatively easily using Value Triggers which we already have in place. It allows you to script JavaScript when it is moving to the next item. So in your case you would attach a Value Trigger to the last item in the Run-up check.

You can create functions in the Functions panel if you select the top-level node in your outline. Here is an example function showing how to do a fetch. You could also do a POST if you want to send a payload.

This function is getting weather values from an api, but of course you can simulate a webhook.

async function fetchKIndices() {
  const response = await fetch('https://services.swpc.noaa.gov/products/noaa-planetary-k-index.json');

  if (!response.ok) {
    const message = `An error has occured: ${response.status}`;
    mcAlert.alert(message);
  }

  const kIndices = await response.json();
  
  mcAlert.alert(JSON.stringify(kIndices));
}

You can then call the function in the Value Trigger panel on any item…

fetchKIndices();

More info on Value Triggers…

Let me know how it goes with what you are trying to do.

Thanks for the help.
Works great at my desk, let’s hope we have VFR conditions tomorrow so see it in real life!

Awesome! Also hope for good internet connectivity wherever do run-up :slight_smile:

Let us know how it goes.

Curious if you can share the Value Trigger snippet you created with the community.

Sure thing, very simple: I use IFTTT as the central service.
Architecure is like this:

Pre-flight check triggers Webhook at IFTTT
IFTTT then triggers a Webhook at Telegram

Value added trigger is like the function you posted (call me lazy):

async function triggerI() {

const response = await fetch(‘https://maker.ifttt.com/trigger/ebul/with/key/asdfasdf12345’);

if (!response.ok) {
const message = An error has occured: ${response.status};
mcAlert.alert(message);
}
const triggerI = await response.json();
}
triggerI();

URL:
https://api.telegram.org/bot1923492661:asdfasdfasdfasdfasdfEOg1lRQ/sendMessage
METHOD:
post
CONTENT-TYPE:
application/json
BODY:
{“chat_id”:“-123456789”,“text”:“Hier ist die EBUL, die Run-Up Checks sind abgeschlossen und wir starten gleich. In spätestens 5 Minuten sollten wir auf D-EBUL Flight Tracking and History - FlightAware zu sehen sein.”}

The only “difficult” thing is to set up a telegram bot, add it to the group and find the group ID (in this example: -123456789).

Excellent how-to can be found here:
Write a Telegram bot using IFTTT recipies - Rainbowbreeze

Overall, this is great fun. All friends and family LOVE the function!

Great stuff. Thanks for sharing!