[SOLVED] Webhook widget demo does not return any value

Hi i’m running the demo of webhook with wemos D1 with a little variation ( timer each 5 seconds ) but i don’t receive any result. Here is the code and the debug…in webhook widget i set only V0, iunderstand than url is in code.

Thanks for your time.

Code:

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial // Defines the object that is used for printing
#define BLYNK_DEBUG        // Optional, this enables more detailed prints
// Allow for receiving messages up to 512 bytes long
#define BLYNK_MAX_READBYTES 4096

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxx";
char pass[] = "xxxx";


BlynkTimer timer;

BLYNK_WRITE(V0)
{
  Serial.println("WebHook data:");
  Serial.println(param.asStr());
}


// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
  Serial.println("Event Timer...");
  
  Blynk.virtualWrite(V0, "https://raw.githubusercontent.com/blynkkk/blynk-library/master/extras/logo.txt");

  // You can perform HTTPS requests even if your hardware alone can't handle SSL
  // Blynk  can also fetch much bigger messages,
  // if hardware has enough RAM (set BLYNK_MAX_READBYTES to 4096)
  //Blynk.virtualWrite(V0, "https://api.sunrise-sunset.org/json?lat=50.4495484&lng=30.5253873&date=2016-10-01");
  
}


void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);

  // Setup a function to be called every second
  timer.setInterval(5000L, myTimerEvent);

  
}

void loop()
{
  Blynk.run();
  timer.run(); // Initiates BlynkTimer
}

Debug:

[11915] Connected to WiFi
[11915] IP: 192.168.0.22
[11915] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.7 on Arduino

[11921] Free RAM: 45280
[11923] Connecting to blynk-cloud.com:8442
[12096] <[02|00|01|00] 3c2c36508db044caad7bf4a36b3a7158
[12329] >[00|00|01|00|C8]
[12329] Ready (ping: 0ms).
[12329] <[11|00|01|00]Hver[00]0.4.7[00]h-beat[00]10[00]buff-in[00]4096[00]dev[00]Arduino[00]build[00]Jul  8 2017 18:56:59[00]
[12513] >[00|00|01|00|C8]
Event Timer...
[17512] <[14|00|02|00]Svw[00]0[00]https://raw.githubusercontent.com/blynkkk/blynk-library/master/extras/logo.txt
Event Timer...
[22512] <[14|00|03|00]Svw[00]0[00]https://raw.githubusercontent.com/blynkkk/blynk-library/master/extras/logo.txt
[22743] <[06|00|04|00|00]
[22948] >[00|00|04|00|C8]
Event Timer...
[27512] <[14|00|05|00]Svw[00]0[00]https://raw.githubusercontent.com/blynkkk/blynk-library/master/extras/logo.txt
Event Timer...
[32512] <[14|00|06|00]Svw[00]0[00]https://raw.githubusercontent.com/blynkkk/blynk-library/master/extras/logo.txt
[32949] <[06|00|07|00|00]
[33188] >[00|00|07|00|C8]

Not entirely, you still need /pin/ in the webhook, do you have this?

Did the Webhook work before you modified the official sketch?

Hi costas. I tried with the /pin/ and the original sketch but the same thing. because that i tried with timer to make the get every 5 second.

if you think in another thing let me know.

Thank you

Serial Monitor:

[6595] IP: 192.168.10.171
[6595] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.8 on Arduino

[6601] Connecting to blynk-cloud.com:8442
[6768] Ready (ping: 80ms).
WebHook data:

     ___  __          __
    / _ )/ /_ _____  / /__
   / _  / / // / _ \/  '_/
  /____/_/\_, /_//_/_/\_\
         /___/

Webhook triggered
WebHook data:

     ___  __          __
    / _ )/ /_ _____  / /__
   / _  / / // / _ \/  '_/
  /____/_/\_, /_//_/_/\_\
         /___/

As per the comments in the sketch the url in the widget must follow the regular format so the minimum is:
https://raw.githubusercontent.com/pin/ (where the last 5 characters of the url will be highlighted in green).

/pin/ is useful for real world projects as it allows users to change the url on the fly so for example they would enter their specific long and lat in Terminal for sunrise api

/* WebhookV10.ino https://community.blynk.cc/t/webhook-widget-demo-does-not-return-any-value/15687/2 
   V0 Webhook widget with url as https://raw.githubusercontent.com/pin/ last 5 characters will be GREEN 
   V1 Button to manually trigger Webhook but will trigger from setup() or can be set with BlynkTimer etc
*/

#define BLYNK_PRINT Serial
#define BLYNK_MAX_READBYTES 1024
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char server[] = "blynk-cloud.com";
char ssid[]    = "xxxx";
char pass[]   = "xxxx";
char auth[]   = "xxxx";

void setup()
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass, server);
  Blynk.virtualWrite(V0, "/blynkkk/blynk-library/master/extras/logo.txt"); 
}

void loop()
{
  Blynk.run();
}

BLYNK_WRITE(V0){       // Webhook: in widget as GET https://raw.githubusercontent.com/pin/ last 5 characters will be GREEN 
  Serial.println("WebHook data:");
  Serial.println(param.asStr());
}

BLYNK_WRITE(V1){      // Webhook button for "https://raw.githubusercontent.com/blynkkk/blynk-library/master/extras/logo.txt"                      
  if (param.asInt() == 1) {
    Serial.println("Webhook triggered");
    // in widget as GET https://raw.githubusercontent.com/pin/ last 5 characters will be GREEN    
    Blynk.virtualWrite(V0, "/blynkkk/blynk-library/master/extras/logo.txt");
  }
}

it works Fine whith url/pin/ in the widget. with the example…but i got this with my url, surely is something simple. isn’t it?.

Event Timer…
[49771] <[14|00|0B|00]1vw[00]0[00]https://api.bitfinex.com/v1/pubticker/btcusd
[50505] >[14|03]x[15|CF]
[50505] Packet too big: 5583
[50506] Connecting to blynk-cloud.com:8442

Thanks a lot

Working OK here:

[6624] Connected to WiFi
[6624] IP: 192.168.10.171
[6624] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.8 on Arduino

[6630] Connecting to blynk-cloud.com:8442
[6778] Ready (ping: 69ms).
WebHook data:
{"mid":"2542.75","bid":"2542.5","ask":"2543.0","last_price":"2542.5","low":"2436.1","high":"2555.7","volume":"8874.86817402","timestamp":"1499572954.711105285"}

Now works there too. I was given the url/pin/ on widget and i tried only the url and works fine.

Thanks a lot @Costas

thank you guys, and if i want to make the last part of the url dynamic, what have i to configure on the widget and how to pass the parameter in the arduino?

for example y want to iterate an array like this

#define ARRAYSIZE 10
String pares[ARRAYSIZE] = { "btcusd", "ltcusd", "ethusd", "etcusd", "zecusd", "xmrusd", "dshusd", "xrpusd", "iotusd", "eosusd" };

void myTimerEvent()
{
  Serial.println("Event Timer...");
  
  for (int i =0; i< ARRAYSIZE; i++) {
  
    Blynk.virtualWrite(V0, "https://api.bitfinex.com/v1/pubticker/"+pares[i]);
    
  }
  
}

is ok this:

Blynk.virtualWrite(V0, "https://api.bitfinex.com/v1/pubticker/"+pares[i]);

or i just have to write:

Blynk.virtualWrite(V0, pares[i]);

In any case in the widget how it is supposed i write on the url is something like:

https://api.bitfinex.com/v1/pubticker/pin/

or like this:

https://api.bitfinex.com/v1/pubticker/pin[0]/

Thanks Guys again

Try:
Blynk.virtualWrite(V0, pares[i]);

with a url of https://api.bitfinex.com/v1/pubticker/pin/

but perhaps use BlynkTimer to spread the Webhook calls over time.

Thanks Costas
I tried this. I comment the loop to try. And the url https://api.bitfinex.com/v1/pubticker/pin/ but does not work :

void myTimerEvent()
{
  Serial.println("Event Timer...");
  
  //for (int i =0; i< ARRAYSIZE; i++) {
  
    Blynk.virtualWrite(V0, pares[1]);

 
  //}
 
}

I get this:

Event Timer...
[16618] <[14|00|03|00|0B]vw[00]0[00]ltcusd
Event Timer...
[21618] Cmd skipped:20
[22887] Connecting to blynk-cloud.com:8442
[23311] <[02|00|01|00] 3c2c36508db044caad7bf4a36b3a7158
[23618] >[00|00|01|00|C8]
[23619] Ready (ping: 1ms).
[23619] <[11|00|05|00]Hver[00]0.4.7[00]h-beat[00]10[00]buff-in[00]4096[00]dev[00]Arduino[00]build[00]Jul  9 2017 16:24:24[00]
[23823] >[00|00|05|00|C8]
Event Timer...
[26618] <[14|00|06|00|0B]vw[00]0[00]ltcusd
[27612] >[14|03]x[15|CF]
[27612] Packet too big: 5583
[27612] Connecting to blynk-cloud.com:8442

Something else i could try?

Thanks again Costas

Change the Strings in the array to:
String pares[ARRAYSIZE] = { “/btcusd”, “/ltcusd”, “/ethusd”, “/etcusd”, “/zecusd”, “/xmrusd”, “/dshusd”, “/xrpusd”, “/iotusd”, “/eosusd” };

or perhaps easier to change the url https://api.bitfinex.com/v1/pubticker//pin/ (note the extra backslash before /pin/ )

You are right again. It works fine now.
I understood the logic.
Thanks again Costas

@tobiascrackz please don’t spam the forum with the same question in multiple places.

I’m closing this topic. if anyone wants to respond to @tobiascrackz question then please do so here:

Pete.