Publishing an event to a Blynk endpoint

I am publishing to a Blynk endpoint that consumes batched data Upload a Set of Timestamped Data

The requirement of the endpoint:

Content-Type header should be set to application/json
Example Post body:
[[1648054765458,1.0],[1648054825459,2.0],[1648054885460,3.0]]

Here is my current custom webhook template:

{
"name": "BlynkBatchWrite",
"event": "BlynkBatchWrite",
"responseTopic": "{{PARTICLE_DEVICE_ID}}/hook-response/{{PARTICLE_EVENT_NAME}}",
"url": "https://lon1.blynk.cloud/external/api/batch/update?token=xxxxxx&pin=V1",
"requestType": "POST",
"noDefaults": true,
"rejectUnauthorized": true,
"headers": {
"Content-Type": "application/json"
},
"body": ?????,
"todayCounters": {
"date": "20230908",
"success": 160,
"error": 80,
"sleep": 131
}
}

I am struggling to work out the data argument payload format: for the publish call and what I should put in the body property ???? above.
It needs to be a custom string as shown in the example above, not json formatted (despite the content-type).

What do I put as the "body" property?
How do I format the data payload argument?

Thanks

PS I can get this to work using the Particle Webhook test button and using Postman.

I have found the solution:
The body property is set as:
"body": "{{{PARTICLE_EVENT_VALUE}}}"

as regards the data, I just publish as is for example set the data string to "[[1648054765458,1.0],[1648054825459,2.0],[1648054885460,3.0]]"

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