Apologies if this has been covered elsewhere, I’m struggling with setting up a response template in webhooks.
I’m polling the open weathermap API with a webhook and I’m receiving a response, the following works:
void myHandler(const char *event, const char *data)
{
if (data)
// do the thing
}
But I only want to use a small part of the JSON response so I added a response template to the webhook. The JSON specifiction for open weathermap is here:
http://openweathermap.org/current#current_JSON
And my response template in webhooks looks like this:
{{weather.main}}
The code below isn’t working.
void myHandler(const char *event, const char *data)
{
if (data == "the current value")
// do the thing
}
Obviously data being returned isn’t matching the condition in the if statement but I can’t see why.
Two questions, hoping you guys can help:
Does the response template I’ve written look right?
How can I view the value of the “data” variable?
Many thanks