Mustache substitution in Webhook URL

I’m trying to use a mustache substitution in the URL of a Particle webhook. However, it appears the substitution does not take place. I merely get a null string in its place. Are mustache substitutions permitted in the URL of a webhook and, if so, do I need to do anything special?

Yes, mustache template substitutions are allowed in the URL. You don’t have to do anything special to enable it.

Make sure the JSON being sent by the device is valid JSON. If there’s a JSON syntax error, no substitutions are made.

OK. I’ve done this many times, but that might be the issue. Thanks!

Is there a limit to the length of a JSON property? I’m trying to send a jwt token and it’s quite long. It appears from a Serial.println() that the string is valid JSON. I’ve run it through a JSON validator and it says it’s valid.

You’ll be limited by the size of the publish, of course, which depends on the device and Device OS version.

With Gen 3 devices and Device OS 3.0.0 and later, it’s usually 1024, but it could be smaller.

Additionally, some older Boron and B Series SoM with a SARA-R410M-02B modem (LTE Cat M1) may have a limit of 782 bytes instead of 1024 bytes, see Particle.maxEventDataSize() for more information.

OK. That appears to be the problem. The jwt token I need to send is 1123 characters long and I also need to send the ID of the device. So…it appears I cannot use a Particle webhook to make this call…right? I guess I’ll have to figure out another option. Very disappointing that I can’t use an Argon to create this device for my customer.

It’s also the case that the token may even be longer. This is simply the token I’m getting now and it’s relatively short-lived.

Hey Tom,
You still can perhaps.

You cannot use a webhook directly but perhaps if you send the webhook to a service like Heroku, a cloud function in Azure, or a cloud function in Google Cloud(firebase) you would be able to make it work.

I do not have experience in Heroku, but I do in Azure or Google Cloud and this looks very possible.
Let me know if that sounds interesting, maybe we could collaborate in a tutorial or something similar if you want, or any other way.


Thanks @gusgonnet . I’m trying to create a simple device to allow a client to give his office tenant the ability to bump his temperature up/down 2˚ without giving him access to the thermostat or an account that has too much control. Seems like a relatively simple proposition until I wasted the whole day trying to figure out why my Particle webhook wouldn’t work. I was sure I was doing something dumb. Perhaps I was, since I didn’t read about the limitation on the publish.

I’ll do a bit of further investigation and may well reach out to you.

As always, your support is greatly appreciated!

[updated] BTW, I know I can call a custom PHP script I’d put on our server and pass it the minimal information required and let it do the bulk of the work. I was just trying to keep this as simple as possible.