OneSignal integration with ESP8266

Hello everyone,
I am trying to compile my code but it is continuously giving me error

c:\Users\Admin\Documents\Arduino\libraries\OneSignal-Embedded-SDK\src\OSESP32Client.cpp:3:10: fatal error: HTTPClient.h: No such file or directory
    3 | #include <HTTPClient.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

Here is my code

#define OS_ESP8266
#include <ESP8266WiFiMulti.h>
#include <OneSignal.h>
#define OS_APP_ID "---"
#define OS_USER_ID "---"
#define WIFI_SSID "--"
#define WIFI_PASSPHRASE "--"
OneSignal onesignal(OS_APP_ID);
ESP8266WiFiMulti wifiMulti;

void setup() {
  Serial.begin(115200);
  Serial.println("Connecting to wifi");
  wifiMulti.addAP(WIFI_SSID, WIFI_PASSPHRASE);
  while (wifiMulti.run() != WL_CONNECTED) {  
    delay(500);
    Serial.println("Waiting for connection");
  }
  Serial.println("Connected to " + String(WIFI_SSID));
  OSNotification notif;
  notif.contents = "Hello, World!";
  notif.headings = "Test Title";
  notif.url = "https://www.google.com";
  Serial.println("Built notification, building audience");
  OSAudience audience(OS_USER_ID);
  String result = onesignal.sendNotificationToAudience(notif, audience);
  Serial.println("Sent with result:");
  Serial.println(result);
}

void loop() {

}

never used OneSignal however looking at OneSignal-Embedded-SDK file src/OneSignal.h

#ifndef ONESIGNAL_H
#define ONESIGNAL_H

// Currently only compiling for ESP32 & ESP8266 is supported

// UNCOMMENT THIS LINE IF YOU ARE COMPILING FOR THE ESP8266
//#include "OSESP8266Client.h"

// UNCOMMENT THIS LINE IF YOU ARE COMPILING FOR THE ESP32
#include "OSESP32Client.h"

#include <Arduino.h>
#include "OSNotification.h"

class OneSignal

looks like to need to uncomment

//#include "OSESP8266Client.h"

and comment out

#include "OSESP32Client.h"

have you tried the ESP32 example?

I have did that an the esp32 example works fine with esp32 not esp8266.
I don't understand even after commenting #include "OSESP32Client.h" I still get

c:\Users\Admin\Documents\Arduino\libraries\OneSignal-Embedded-SDK\src\OSESP32Client.cpp:3:10: fatal error: HTTPClient.h: No such file or directory
    3 | #include <HTTPClient.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

this error.
Why is it compiling OSESP32Client.h file?

no idea what is going on

it appears the ESP8266 version has problems with includes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.