BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Trigger webhook problem

ESP32 - Wifi
Android version 11
Blynk server
v 0.6.1

I have trouble when calling a Webhook: sometimes it works, but often it does not get triggered (not getting in the function at all). I have it in setup() and in pushed button to trigger the webhook. See here the code for the push button (V58):

BLYNK_WRITE(V58)
{
  Blynk.virtualWrite(V57,1); 
}

The code for the webhook itself:

BLYNK_WRITE(V57)
{
  terminal.println("V57 API UTC offset started");
  terminal.flush();  //it does not even get here!
  
 const char* WebHookData= param.asStr();
   
 const char* json = WebHookData;
 StaticJsonDocument<512> doc;
  
 // Deserialize the JSON document
 DeserializationError error = deserializeJson(doc, json);
  
 // Test if parsing succeeds.
 if (error) {
      terminal.print("deserializeJson() failed for WorldTimeAPI: ");
      terminal.println(error.f_str());
      terminal.flush();
      return;
    }
  UtcOffset = doc["utc_offset"];    
  vCurrentUtcOffset= String(UtcOffset);
}

the config of the webhook (Run test: all fine):

http://worldtimeapi.org/api/timezone/Europe/Brussels

Statements like…

are very ambiguous.

Maybe you should try re-reading what you’ve posted and asking yourself if a third part would be able to follow it, and whether other information (like how the webhook widget is configured) may be of assistance.

What you’ve posted also leaves people wondering if there is something in the rest of your sketch that is causing an issue, and whether you’ve used a #define BLYNK_MAX_READBYTES statement - neither of which can be ascertained from this code snippet.

Pete.

Hi Pete,
what i meant is that the

Blynk.virtualWrite(V57,1); 

does not always triggers the code for the webhook

BLYNK_WRITE(V57)
{
  terminal.println("V57 API UTC offset started");
  terminal.flush();  //it does not even get here!
   ...

So, even the terminal.println() statements are not executed. Sure, I can give more details on the webhook:

Output:V57
URL: http://worldtimeapi.org/api/timezone/Europe/Brussels
Method: Get
Content: application/json
Body: /left empty/

Run test-> Result:OK

So, sometimes it comes in the V57 function, and sometimes it doesn’t.
The #define BLYNK_MAX_READBYTES was not set, but when i added it (set to 1024) in the beginning of my sketch it did not change/solve the issue.