Unable to get specific data in webhook response

I have a webhook that generates this data
{"T": "Z73.0Z72.9Z72.8Z72.9Z72.9Z73.0Z72.9Z72.9","H": "Z60.6Z60.3Z60.6Z60.1Z59.3Z59.9Z60.3Z61.0","P3": "Z753Z1023Z741Z975Z963Z939Z897Z945","P5": "Z222Z304Z217Z267Z280Z247Z250Z249","P10": "Z40Z46Z29Z54Z22Z54Z33Z40","P25": "Z0Z0Z2Z4Z4Z2Z4Z2","C": "Z29.72883Z29.72948Z29.73015Z29.73080Z29.73126Z29.73159Z29.73190Z29.73233","key": "XXXXXXXXXXXXXXXX" }
If I use the predefined {{PARTICLE_EVENT_NAME}} in the Response Template field I get all this data when subscribing. Due to the 512 byte limit I cannot fit another needed field into a single response. Since I don't need the key and do need the published_at DT I would like to replace that with the {{{PARTICLE_PUBLISHED_AT}}}.
I've tried for about 5 hours with no luck looking at many examples / options. This is my latest attempt:


Sorry for the lousy image but thats all I can get with windows snip right now:

My response template is this:
{
"H": "{{T}}",
"T": "{{H}}",
"P3": "{{P3}}",
"P5": "{{P5}}",
"P10": "{{P10}}",
"P25": "{{P25}}",
"C": "{{C}}"
}
My raw data string in my subscription handler looks like this:
{
"H": "",
"T": "",
"P3": "",
"P5": "",
"P10": "",
"P25": "",
"C": ""
}
It looks like the placeholders are empty or undefined.
Any ideas what I am doing wrong?
Thanks
Bob

Is this the source event or what is returned by the webhook server?

{
	"T": "Z73.0Z72.9Z72.8Z72.9Z72.9Z73.0Z72.9Z72.9",
	"H": "Z60.6Z60.3Z60.6Z60.1Z59.3Z59.9Z60.3Z61.0",
	"P3": "Z753Z1023Z741Z975Z963Z939Z897Z945",
	"P5": "Z222Z304Z217Z267Z280Z247Z250Z249",
	"P10": "Z40Z46Z29Z54Z22Z54Z33Z40",
	"P25": "Z0Z0Z2Z4Z4Z2Z4Z2",
	"C": "Z29.72883Z29.72948Z29.73015Z29.73080Z29.73126Z29.73159Z29.73190Z29.73233",
	"key": "XXXXXXXXXXXXXXXX"
}

I'm guessing it's the source event, because those keys are also present in the webhook JSON payload.

If so, the reason it does not work is that the mustache variables in the response template are for the payload that the webhook server returned in its response body. The response template does not have access to the original event that generated the call to the webhook.

That data was from the publish event:


Is there any way I can make those individual fields available to the webhook response?
Thanks,
Bob

Unfortunately it's not possible to access the individual fields of the triggering event from the response (or error) template.

Hi Rick,
Thank you for clarifying that. I might have spent another five hours trying to make it happen! I must have misinterpreted some of the examples and discussions I had seen. It looks like handling multipart responses is the only way to go in my case. I hope it isn't too difficult keeping and joining them together. Seems like making those individual fields available sometime in the future might be a nice feature. On a more general scope, thank you for all the help you have given to myself and other users with your very useful discussions. I have read many of them and they saved me a lot of time and frustration!
Bob

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.