Giter Site home page Giter Site logo

iftttwebhook's Introduction

IFTTTWebHook ESP8266/ESP32 library

I no longer have time to maintain this library and am withdrawing it. I'll leave the repo around archived. Please don't use this library.

This is a small library that calls IFTTT web hooks from your ESP8266 or ESP32 Arduino project.

IFTTT webhooks allow you to trigger IFTTT actions from your project. You might trigger an action because a button has been pushed, a temperature threshold has been passed, or just because you feel like it. You can pass up to three values with the trigger.

An action can be any IFTTT action:

  • send an email or text message
  • turn on a light
  • add values to a Google Sheet
  • call a webhook on another service

Usage

  1. If you haven't already, add the library to your Arduino project. Either:
  1. Include the library in your project:
#include <IFTTTWebhook.h>
  1. You'll need an IFTTT account, an IFTTT API key for that an account and a webhook event name.

Once you're logged into IFTTT you can get your API key by going to https://ifttt.com/maker_webhooks and clicking the Documentation button.

Instantiate an IFTTTWebhook object using your API key and the event name:

IFTTTWeb webhook(YOUR_IFTTT_API_KEY, YOUR_IFTTT_EVENT_NAME);

When you want to trigger the webhook, call the trigger method with zero to three char* to be passed as values:

webhook.trigger();
webhook.trigger("value1");
webhook.trigger("value1", "value2");
webhook.trigger("value1", "value2", "value3"); 

You can trigger using the same webhook object as many times as you want.

iftttwebhook's People

Contributors

per1234 avatar romkey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iftttwebhook's Issues

Issues triggering IFTTT

Hi guys,

I think there might be an issue triggering IFTTT events with this library currently.

//Firing off the IFTTT event
IFTTTWebhook hook(IFTTT_API_KEY, IFTTT_EVENT_NAME);
hook.trigger();

This is my event to fire off the IFTTT event (I also note in your documentation, you call as IFTTTWeb, this doesn't work and should be IFTTTWebhook).
Obviously initiating WiFi connection prior and confirming WiFi is operational before firing off IFTTTWebhook.

How I pass integers values, without quotation marks?

Hi John, I'm a newbie with this amazing stuffs, and I was looking an easy way to record some values in my Google sheets.
Everything I found looked so complicated till I found your library. I tried with my ESP32's boards and works just fine.
The only thing I miss is the chance to pass integers values, without the quotation marks.
Is there any way to do that?

How to pass a Float value to the Trigger?

Hi, Im trying to send the temperature using the trigger via e-mail.

I tried the examples and worked ok,
I tried to send a char data[8] = "15.25"; and works ok.
I tried to convert a float using dtfrost and the serial show the char contain the data, but the trigger dont send any email.

Do you have some example on how to convert from a float data type, to a data type for sending using the trigger ?

I would thank you so much.

Kind regards.
-Alex

Readme error

Hi,
Just to let you know that in the usage instructions of readme.md is included this line:
IFTTTWeb webhook(YOUR_IFTTT_API_KEY, YOUR_IFTTT_EVENT_NAME);
that should be:
IFTTTWebhook webhook(YOUR_IFTTT_API_KEY, YOUR_IFTTT_EVENT_NAME);

Fantastic library. Best Regards.

Example Needs ESP32 support

The single example in this library has include #include <ESP8266Wifi.h>which obviously wont run for the ESP32

We can either include a IFDEF or create two separate files for ESP8266 and ESP32 which I think is a cleaner approach.

I dont know yet how pull requests work, but i think that i how i would make a copy of your code and send you an update. I dont know how that works, but Here are the code changes I did to enable the example to work..

  1. I switched the include to the one for ESP32 which is #include <WiFi.h>
  2. The second is which needs to be considered is that the code tries to connect to wifi and immediately makes a web request to IFTTT, which is probably not how it should be handled. The time to negotiate with the Wifi router is significant and no requests should be made to do anything with Wifi unless it is connected. We need to add the following section in setup function
WiFi.mode(WIFI_STA);
  if(WiFi.status() != WL_CONNECTED){
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(WIFI_SSID);
    while(WiFi.status() != WL_CONNECTED){
      WiFi.begin(WIFI_SSID, WIFI_PASSWORD); // Connect to WPA/WPA2 network. Change this line if using open or WEP network
      Serial.print(".");
      delay(5000);     
    } 
    Serial.println("\nConnected.");
  }

Here is how my complete code looks like

#include <WiFi.h>
#include "IFTTTWebhook.h"

#define WIFI_SSID "Wifi SSID Here"
#define	WIFI_PASSWORD "wifi password here"

#define IFTTT_API_KEY "IFTTT maker webhook key"
#define IFTTT_EVENT_NAME "webhook event name"

void setup() {
  Serial.begin(115200);
  Serial.println("RUNNING");
  
  WiFi.mode(WIFI_STA);
  if(WiFi.status() != WL_CONNECTED){
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(WIFI_SSID);
    while(WiFi.status() != WL_CONNECTED){
      WiFi.begin(WIFI_SSID, WIFI_PASSWORD); // Connect to WPA/WPA2 network. Change this line if using open or WEP network
      Serial.print(".");
      delay(5000);     
    } 
    Serial.println("\nConnected.");
  }

  IFTTTWebhook wh(IFTTT_API_KEY, IFTTT_EVENT_NAME);
  wh.trigger();
  wh.trigger("1");
  wh.trigger("1", "2");
  wh.trigger("1", "2", "3");
}

void loop() {
}

Thanks for making my life so much easier by creating this library.

Rupin

How to pass a string value with spaces

When I'm trying to trigger a webhook with a value with a space in it, that doesn't work. IFTTT doesn't even register that my applet was called:

  • e.g.: webhook.trigger("Hello World!");

When I remove the space, my applet runs like clockwork:

  • works fine: webhook.trigger("Hello_World");

I've tried variations, to no avail:

  • with single quotes: webhook.trigger("'Hello World!'");
  • with escaped double-quotes: webhook.trigger("\"Hello World!\"");

When using the Webhooks Service Documentation page on IFTTT, I can trigger an Event successfully by entering Hello World! in the value1 field.

I suspect this is therefore this library itself which doesn't support spaces, rather than Webhooks?

Cert updated

I believe ifttt has updated its cert and may be why I can no longer get this library to work. Would you be able to update the code?

[E][ssl_client.cpp:33] handle_error(): SSL - Bad input parameters to function

If you have the error :

[E][ssl_client.cpp:33] handle_error(): SSL - Bad input parameters to function

When you put debug to verbose.

This issue is not from the library but from esp32 arduino.
espressif/arduino-esp32#2670

To fix it install latest version of esp32 arduino (1.0.4)
https://github.com/espressif/arduino-esp32/releases

Also the certificate seems to have changed

const char* _ifttt_root_certificate = R"EOF(
-----BEGIN CERTIFICATE-----
MIIE0DCCA7igAwIBAgIBBzANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx
EDAOBgNVBAgTB0FyaXpvbmExEzAR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R0cDovL2NybC5n
b2RhZGR5LmNvbS9nZHJvb3QtZzIuY3JsMEYGA1UdIAQ/MD0wOwYEVR0gADAzMDEG
CCsGAQUFBwIBFiVodHRwczovL2NlcnRzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkv
MA0GCSqGSIb3DQEBCwUAA4IBAQAIfmyTEMg4uJapkEv/oV9PBO9sPpyIBslQj6Zz
91cxG7685C/b+LrTW+C05+Z5Yg4MotdqY3MxtfWoSKQ7CC2iXZDXtHwlTxFWMMS2
RJ17LJ3lXubvDGGqv+QqG+6EnriDfcFDzkSnE3ANkR/0yBOtg2DZ2HKocyQetawi
DsoXiWJYRBuriSUBAA/NxBti21G00w9RKpv0vHP8ds42pM3Z2Czqrpv1KrKQ0U11
GIo/ikGQI31bS/6kA1ibRrLDYGCD+H1QQc7CoZDDu+8CL9IVVO5EFdkKrqeKM+2x
LXY2JtwE65/3YR8V3Idv7kaWKK2hJn0KCacuBKONvPi8BDAB
-----END CERTIFICATE-----
)EOF";

IFTTTWebhook Failed!

Hi,
for one of our peojects we like to use your IFTTTWebhook. We have setup everything
as it should (so far as I know) but to trigger the event fail.

To trigger the event via URL works, screenshot attached.

https:// maker.ifttt.com/trigger/motion_sms_alert/with/key/fahShb........

You have any idea where I start to check what the problem is?

Thanks in advance
Regards Uwe

Connecting Wifi: wlan-uni
.......
WiFi connected
IP address:
192.168.1.20
Free heap0: 43832
Failed!
Free heap1: 43096
Free heap2: 43192

2018-04-11_08-27-03

2018-04-11_08-20-54

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.