Webhook Not Firing

I have a webhook called “get_weather” as this JSON file:

{
"event": "get_weather",
"url": "https://raincheck-particle.herokuapp.com/api/weather/{{lat}}/{{lon}}?colors=true&format=text",
"requestType": "GET",
"mydevices": true
}

It’s created, registered with an ID, and I subscribe in my firmware here:

Particle.subscribe("hook-response/get_weather", onWeatherData, MY_DEVICES);

I publish an event with variables like this:

Serial.println("Requesting Weather!");
Particle.publish("get_weather", "{ \"lat\": 40.7127, \"lon\": -74.0059 }");

My serial monitor prints back “Requesting Weather!”, however, when I try to print output in onWeatherData, nothing comes back both in the serial monitor and in the dashboard.

void onWeatherData(const char *name, const char *data) {
    Serial.println("Weather response!");
    String str = String(data);
    Serial.println(str);
}

What could possibly be going wrong here? I don’t know how else to troubleshoot this, any tips would be greatly appreciated!

If you’re using an old version of the Particle CLI, you need eventName in the webhook JSON.

If that doesn’t fix it, try these:

Check on https://dashboard.particle.io/ to see if event is published.

Since you’re using Heroku, check if your app is getting the GET call with heroku logs --tail

Make sure you have the latest version of the Particle CLI with npm install -g particle-cli and check if your webhook listed corresponds to what you expect particle webhooks list

2 Likes

Ah it was eventName that fixed it, thanks!!

1 Like

Alright! You should still update the CLI because that’s fixed now.

1 Like