Callback not triggered on alert


#1

Hi
I have a little problem with the alert system. When a new alert is pushed, I receive correctly an iOS Push Notification, but the Endpoint URL isn’t called.

To register my endpoint I use this JS code via Node JS of course :
fa is an instance of https://www.npmjs.com/package/flightaware.js



fa.RegisterAlertEndpoint({
    address: "http://XXXX.ap-southeast-1.amazonaws.com/dev",
    format_type: "json/post"
}, (err, res) => {
    console.log(err, res)
})


Execution of this code return 1 so it’s should be good.
I have tested my endpoint via **PostMan** with the following parameters :

  • Method : POST

  • Header : Content-Type: application/json

  • Body : ‘{“test”: “test”}’

I saved correctly the json input into a dated file…
I have also tried to define HTTPS endpoint but it’s same problem.

In first time i define my alerts via the FlightAware interface, but no options about the callback are displayed
Then i have tried to create my alert directly via the Api, with this JS Code :



fa.SetAlert({
    alert_id: 0,
    ident: 'XXXXX',
    enabled: true,
    channels: '{16 e_filed e_departure e_arrival e_diverted e_cancelled}'
}, (err, res) => {
    console.log(err, res)
})


Execution of this code return the id for my new alert.

Does this procedure seem correct to you ?
Why is the channel ID = 16 when I create the alert, but when i retrieve via **getAlerts** the channel ID is changed to 15 ?

Thanks


#2

Disclaimer: not a FlightAware team member, but, might have useful info for you…

In my experience, you’ll only get push notifications to your endpoint for notifications that are setup via the API - push alerts setup through the web interface show up in the same list, but, aren’t handled the same way - I suspect that’s what the channel 15 vs 16 stuff is.

You can push an alert manually to your API endpoint here: flightaware.com/commercial/flightxml/send.rvt

The actual answer might be more nuanced, but, hopefully that’s enough to get you started until staff can answer.


#3

Hi ottergoose

Thanks for your quick reply. The test/logs tool https://flightaware.com/commercial/flightxml/send.rvt it’s very interesting for check the callback.

Finally i’ve found why my callback wasn’t dispatched.
When i created my alert via API request, the Chanel ID was well 16, but after editing this same alert via the FlightAware Interface (In my case : To enable iOS Notifications).
This edit action has transformed the Channel ID from 16 to 15 so the callback was’t dispatched.

Do you know if it’s possible to have a callback when flight is planned (onSchedule) into the airport ? Example : When terminal/gates are set or changed.


#4

At the moment the only supported event types are e_filed e_departure e_arrival e_diverted e_cancelled. If we expand that though we’ll post an update.