Webhook (GET) registration problem if more than 1 argument

Guys,

I’m trying to register a webhook thusly:

particle webhook GET bootevent http://someURL/ss-request.asp?action=foo&dev={{SPARK_EVENT_VALUE}}

When it registers, action=foo makes it but dev={{___}} doesn’t. In other words, nothing after action=foo is registered. Do I need to escape the & or something?

Thanks…

Tahl

You will need to use a json file instead:

https://docs.particle.io/guide/tools-and-features/webhooks/#query

The command is particle webhook create xxxxx.json

1 Like

Okay this doesn’t work. This is what my json file has:
{
“eventName”: “switchevent”,
“url”: “http://blahblah/thing.asp”,
“requestType”: “GET”,
“query”: {
“action”: “ss”,
“parm”: “{{SPARK_EVENT_VALUE}}”
},
“mydevices”: false
}

It registers the webhook and all but it doesn’t work. If I look back to the terminal session, it repeated back the json minus the “query” parm. Did it ignore it because it’s a GET instead of a POST? I need to be able to do a GET with two parms and putting all on one line doesn’t work.

Solution?

Thanks,
Tahl

You might want to share the actual json content so that we can test :slight_smile:

Actually I didn’t give the real deal for security reasons. But here’s the real deal:

{
“eventName”: “switchevent”,
“url”: “http://selfstate.io:8081/ss.request-do.asp”,
“requestType”: “GET”,
“query”: {
“action”: “ss”,
“parm”: “{{SPARK_EVENT_VALUE}}”
},
“mydevices”: false
}

Thanks,
Tahl

PS. The SPARK_EVENT_VALUE in this case is the Device ID.

@Tahl, just a note that with mydevices = false, you are using an event name that may be common in the public event stream. Also, I believe the documentation may be misleading but “eventName” should be just “event”.

@peekay123 thanks for the info. I’ll turn the mydevices to true. And eventName to event. There is still, however, the other problem and hopefully can get a resolution.

Tahl

Is this the actual or a typo?

No that’s the actual value

I tried accessing the url using a browser and it’s a 404.

Have you tried opening the url and getting it to work?

Hi @kennethlimcp … the GET should work … it’s used all day long. Try this line in a browser:

http://selfstate.io:8081/ss-request-do.asp?action=ss&parm=1234

You should get back “Status=Error” because the 1234 is not recognized as a valid string sent from the Photon to our cloud. I see no attempt in our log yesterday or today. Give it a try. Thanks.

Tahl

@kennethlimcp, found anything?

Thanks,
Tahl

Tested working. Your previous .json has an error of using a dot instead of hyphen for the url.

Here’s what i used:

{
"eventName": "switchevent",
"url": "http://selfstate.io:8081/ss-request-do.asp",
"requestType": "GET",
"query": {
"action": "ss",
"parm": "{{SPARK_EVENT_VALUE}}"
},
"mydevices": false
}

Reply:

{"name":"switchevent","data":"1234","ttl":"60","published_at":"2016-01-26T02:49:54.993Z","coreid":"001"}
{"name":"hook-sent/switchevent","data":"undefined","ttl":"60","published_at":"2016-01-26T02:49:54.996Z","coreid":"particle-internal"}
{"name":"hook-response/switchevent/0","data":"<!DOCTYPE html>\r\n<html lang='en'>\r\n\r\n<!--============================HEADER================================-->\r\n<head>\r\n\r\n\r\n\r\n\r\n\r\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n<link rel=\"shortcut icon\" href=\"images/ss-logo-bug.ico\" />\r\n<title>SelfState - Entry</title>\r\n\r\n</head>\r\n\r\n\r\n<!--==============================BODY===============================-->\r\n<body bgcolor=\"#DFFBDF\" link=\"#75A522\" vlink=\"#75A522\" alink=\"#00FF00\">\r\n\r\nStatus=E","ttl":"60","published_at":"2016-01-26T02:49:55.199Z","coreid":"particle-internal"}
{"name":"hook-response/switchevent/1","data":"rror<br>\r\n\r\n\r\n</body>\r\n</html>\r\n\r\n\r\n\r\n\r\n","ttl":"60","published_at":"2016-01-26T02:49:55.452Z","coreid":"particle-internal"}

@kennethlimcp thanks for getting back. The json that’s actually in the file is as you have above; that is, with the hyphen instead of the dot. I’ll try again and see what happens.

Thanks again.

Tahl