Webhook and the things network http integration

Hello Community,
i have a question: i want to use the webhook to send upon hitting a button in the blynk mobile app a http post request with a json in the body to “the things network” to make a downlink to my lora device.

the link works, testet it with postman:

that’s the link:

https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/mydevice/forward_gps_data?key=ttn-account-v2.mysecurityidkjshfakjshdkajhdasjk

and that is the json body:

{
“dev_id”: “mydevice”,
“payload_raw”: “something”,
“port”: 1,
“confirmed”: false,
“schedule”: “replace”
}

the server only returns 202 “status accepted”

everything is static and needs not to be changed.

webhook running on V0

BLYNK_WRITE(V0) {      
  Serial.println("WebHook data:");
  Serial.println(param.asStr()); // would return the status message from the server (202 accepted)
}
BLYNK_WRITE(V1) {     // Webhook button for V1 (styled button in app with push mode)
  if (param.asInt() == 1) {
    Serial.println("Webhook triggered");
    // in widget as PUT: what do i need to insert???
    Blynk.virtualWrite(V0, "{\"dev_id\": \"mydevice\",\"payload_raw\": \"something\",\"port\": 1,\"confirmed\": false,\"schedule\": \"replace\"}");
  }
}

so, what do i insert in “URL” and “body” in webhook settings? and what needs to be inserted in the
Blynk.virtualWrite(V0,.... part?

i tried several constallations, as suggested in various threads in this forum. please help :slight_smile:

update:

widget configuration was correct, meaning:
URL: the url
content type: application/json
Body: Json data

tests with sending post requests to requestbin showed they are pretty much correct, but the problem still persists: TTN ist not able to read and work with the incoming data.

maybe blynk is not able to read “?” in the URL ? and translates it to another character? same with json body content?

is blynk webhhok widget altering the URL in app settings? e.g. replacing the question mark after “forward_gps_data”?

https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/tobipeloratest/forward_gps_data?key=ttn-account-v2.dummy

I can’t answer your questions I’m afraid, as I’ve never used the webhook widget.

But, if you’re having issues wouldn’t it be easier to make the API call from your hardware device than from the app?

Pete.

hey @PeteKnight,

actually not, since ESP8266 doesn’t support HTTPS due to memory limitations :smiley: and ESP32 shuts down randomly after 1-20 mins of operation.

the error/fault/bug is definitely with blynk webhook and processing the URL. POST requests to another URL without the “?” works. So, who knows a work around?

Are you using the Android or iOS version of the app?

Pete.

iOS. i already learned that there is a difference in quotations marks beeing written by a computer or the iphone itself. quotation marks by iphone don’t work with json.

Maybe this is one for @Eugene then.

Do you have access to an Android device to see if you have the same issues there?

Pete.

I will ask a friend to find out if Android works and keep you updated.

Inserting this URL into the Blynk-URL-window in the APP gives proper data at RequestBin. Meaning that Blynk Webhook Widget actually processes correctly all data including the “?”:

https://en9iip5qssks.x.pipedream.net/ttn-eu/api/v2/down/tobipeloratest/forward_gps_data?key=ttn-account-v2.dummy

But changing it to https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/tobipeloratest/forward_gps_data?key=ttn-account-v2.dummy (and inserting the key for ‘dummy’ of course) gives no data at TheThingsNetwork. Seems like -opposite to my first guess - somethings not working at the recipients side.

I’m running a local Blynk Server. Maybe it has something to do with missing Let’s Encrypt?

Do I have to set it up or implement it? Sorry if this reveals my big knowledge gaps. Still happy about Help :slight_smile:

Why not try it with the cloud server?

Pete.

Cloudserver works!!! So, any recommendation for readings on how to set up Let’s Encrypt on my local Blynk server running on a Raspberry?

Pete.

Guys! It’s working!!!
Restarting the raspPi after all those updates and installations did the trick!!!
Thank your yor help and time!!!

For all the other guys with the same problem: