0

Inbound Webhook Actions
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Inbound Webhook Actions

by TheBrewery on Thu Apr 11, 2019 4:18 pm

Hello All,

Is there a way to trigger an action on the board (like I can do in Dashboard) from an inbound webhook, IE iBeaon event sends webook to IO and causes the associated case to fire?

Thanks,
Mike

TheBrewery
 
Posts: 5
Joined: Fri Apr 05, 2019 5:34 pm

Re: Inbound Webhook Actions

by brubell on Thu Apr 11, 2019 5:00 pm

You'd need to take care of this in code by listening to the feed's incoming value from the webhook, either by polling the feed or subscribing with MQTT. Then, you'd handle the action.

brubell
 
Posts: 332
Joined: Fri Jul 17, 2015 10:33 pm

Re: Inbound Webhook Actions

by TheBrewery on Thu Apr 11, 2019 5:27 pm

Sorry I am still really new to this...

is this what you mean?
Code: Select all | TOGGLE FULL SIZE
// set up the Adafruit IO feeds
AdafruitIO_Feed *lightRing = io.feed("light-ring");

If I press one of the virtual buttons in the dashboard it triggers correctly, however, I cannot get data to input from the API using Postman... Also if I manually add the data in Feeds using the "+ Add Data" button it does not trigger the light ring. So I assume I am missing something on the board side?

Thanks,
Mike

TheBrewery
 
Posts: 5
Joined: Fri Apr 05, 2019 5:34 pm

Re: Inbound Webhook Actions

by TheBrewery on Fri Apr 12, 2019 11:15 am

When trying to send the API call I keep getting this error...

Code: Select all | TOGGLE FULL SIZE
{
    "error": "request failed - failed to save data to feed trigger. undefined method `>' for nil:NilClass"
}


This is the call that I am sending...

Code: Select all | TOGGLE FULL SIZE
curl -X POST \
  https://io.adafruit.com/api/v2/webhooks/feed/***TOKEN*** \
  -H 'Content-Type: application/json' \
  -H 'X-AIO-Key: ***TOKEN**** \
  -d '{
   "value": "in-use"
}'


Help please

Thanks,
Mike

TheBrewery
 
Posts: 5
Joined: Fri Apr 05, 2019 5:34 pm

Re: Inbound Webhook Actions

by brubell on Mon Apr 15, 2019 10:32 am

This error has been fixed and should be displaying the correct error text.

brubell
 
Posts: 332
Joined: Fri Jul 17, 2015 10:33 pm

Please be positive and constructive with your questions and comments.