Webhook SMS notification (GET or POST)

Hello.
I config a Raspberry pie for SMS Gateway and I can send SMS with HTTP GET and POST like that.
http://website.com/index.php?app=ws&u=username&p=password&op=pv&to=number&msg=SMS
I want call this URL in blynk when my temperature going more than 35^C to send SMS.
I initialize DHT22 on NodeMCU ESP8266 like this :

#include <ESP8266.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <DHT.h>
#include <SimpleTimer.h>
#define DHTPIN 2
#define DHTTYPE DHT22   // DHT 22 Change this if you have a DHT11
DHT dht(DHTPIN, DHTTYPE);
// Set ESP8266 Serial object
#define EspSerial Serial
ESP8266 wifi(EspSerial);
SimpleTimer timer;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "Your Auth Token";
void setup()
{
 //No Serial console as the Nano only has 1 HW Serial
  EspSerial.begin(115200);  // Set ESP8266 baud rate
  delay(10);
  Blynk.begin(auth, wifi, "YourSSID", "Your Wifi PWD");
  timer.setInterval(1000, sendData);
}
void sendData()
{
//Read the Temp and Humidity from DHT
  float h = dht.readHumidity();
  float t = dht.readTemperature();
//Write values to V04 and V05
  Blynk.virtualWrite(4, h);
  Blynk.virtualWrite(5, t);
}
void loop()
{
  Blynk.run();
  timer.run();
}

How Can I do it.
thank you in advance.

Have you checked out the Webhook widget?

1 Like

Yes, But SMS send every Refresh temperature time.
in this code is 1000:
timer.setInterval(1000, sendData);
I want send SMS when temperature going more than 35^C.

in sendData() after float t = xxx you would have:

if(t > 35)
{
  Blynk.virtualWrite(Vx, someString); // where Vx is Webhook widget
}

Look ok?

1 Like

thanks.
I will test it.
I want change SMS tempreture warning interval time.
I changed the code to :

void setup()
{
 //No Serial console as the Nano only has 1 HW Serial
  EspSerial.begin(115200);  // Set ESP8266 baud rate
  delay(10);
  Blynk.begin(auth, wifi, "YourSSID", "Your Wifi PWD");
  timer.setInterval(1000, sendData);
  timer.setInterval(50000, sendSMS);
}
void sendData()
{
//Read the Temp and Humidity from DHT
  float h = dht.readHumidity();
  float t = dht.readTemperature();
 
//Write values to V04 and V05
  Blynk.virtualWrite(4, h);
  Blynk.virtualWrite(5, t);
}

void sendSMS()
{
	float ts = dht.readTemperature();
if(t > 35)
{
	Blynk.virtualWrite(6, ts);
}
{

is this OK ?

Looking much better but you are still missing some vital PSUH_DATA elements.

Provide a copy of your loop() and your definitions.