Changing HTTP message Body

Hello, I understand that HTTP integration make a POST request on the event URL, but how do I decide what will be contained in the message body of the HTTP request?
how can I personalize this message?

You can configure what goes into the “objectJSON” field of the data that is sent in the request. To do this you define a codec in the device profile where you write a javascript function that takes the bytes received from the device and the variables set on the device and returns a JSON object. objectJSON is encoded as a string, not an embedded JSON object, but can be parsed into JSON.

I’m not aware of any further personalisation that can be done, but I am fairly new to chirpstack as well.

thanks for your reply!
for example, if I want to make a post request like this:
POST https://api.thingspeak.com/update.json
field1=value
api_key=key1
talkback_key=key2
then in the HTTP integration I must put the endpoint like: https://api.thingspeak.com/update.json
but what must I return in the decoder function to comply with this format?
I should return something like
return {“field1”:"value,“api_key”:“key1”,“tallback_key”:“key2”}
Is this correct?

By the way I solved this problem
What I did was to create my own endpoint in the same machine that was hosting the application server (you can find a code to do this here: HTTP - ChirpStack open-source LoRaWAN<sup>®</sup> Network Server ) then I made my own HTTP request from this code, so I can interact whit external API.

1 Like