BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Simple Webhook example?

Hello,

Creating a simple example to test Webhooks with an Arduino IOT 33. I would like to post data from my device to a google sheet using a simple google API script. Tested the script multiple ways - all fine. Here is the Arduino code

#define BLYNK_TEMPLATE_ID "TMPLu34OR4Jq"
#define BLYNK_DEVICE_NAME "TestWebhook"
#define BLYNK_AUTH_TOKEN "***************"

#define BLYNK_PRINT Serial
 
#include <SPI.h>
#include <WiFiNINA.h>
#include <ArduinoOTA.h>
#include <BlynkSimpleWiFiNINA.h>

#include "arduino_secrets.h" 
char ssid[] = SECRET_SSID;      // your network SSID (name)
char pass[] = SECRET_PASS;      // your network password
int status  = WL_IDLE_STATUS;


unsigned int  counter = 0;

WidgetTerminal Terminal(V10);

void setup() {

  Serial.begin(19200);

  Blynk.begin(BLYNK_AUTH_TOKEN,ssid,pass);            // Start up Blynk
  while(true) { if(Blynk.connected()) {break;} }      // wait for Blnyk 
  Terminal.clear(); Terminal.println("Ready to go with Blynk ..."); Terminal.flush();

  ArduinoOTA.begin(WiFi.localIP(), "Arduino", "passwd", InternalStorage);  // Start the WiFi OTA library with internal (flash) based storage
}

void loop() {
  Blynk.run();  
  ArduinoOTA.poll();                        // check for WiFi OTA updates

  Blynk.virtualWrite(V5, counter);
  counter++;
  
  Terminal.println(counter);Terminal.flush();
  
  delay(3000);
}

The Webhook form

image

second half

image

I’m assuming I need to fill the content section appropriately. Shown is json content { “counter”: 565 } that does send ‘565’ to the API and google sheet as expected.

So question: how do I add the virtual pin dataV5 to this content so I can post dynamic pin V5 data (the counter variable)? Can’t find docs on the ‘Dynamic Data’ parameters and cannot figure out how to use them.

Thanks ahead of time

Have you tried the dynamic data ?
Like “device_pinValue” for example.

Look at his void loop, I’m surprised it works :thinking: