• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP8266 NodeMCU: Send Messages to WhatsApp not compiling

Q&A Forum › Category: ESP8266 › ESP8266 NodeMCU: Send Messages to WhatsApp not compiling
0 Vote Up Vote Down
Herman Van twillert asked 2 years ago

Hello
Thanks for this update and tip.
I was not able to get my project working with Firebase (bi-directional).
Now this Whatsapp and Telegram option should make it a lot  but…..
Then I get “HTTPClient.cpp:30:10: fatal error: esp32-hal-log.h: No such file or directory”
I tried instllations witha lot of libraries  with same result
Any tip about a  solution?
 
The complete compiler error is below.
”
“C:\\Users\\username\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\3.0.4-gcc10.3-1757bed/bin/xtensa-lx106-elf-g++” -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -D_GNU_SOURCE “-IC:\\Users\\username\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/include” “-IC:\\Users\\username\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/lwip2/include” “-IC:\\Users\\username\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2/tools/sdk/libc/xtensa-lx106-elf/include” “-IC:\\Users\\username\\AppData\\Local\\Temp\\arduino-sketch-18A8D0C47D2CE6D49A570E0572C75497/core” -c -w -Werror=return-type -Os -g -free -fipa-pta -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++17 -ffunction-sections -fdata-sections -fno-exceptions -DMMU_IRAM_SIZE=0x8000 -DMMU_ICACHE_SIZE=0x8000 -w -x c++ -E -CC -DNONOSDK22x_190703=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10607 -DARDUINO_ESP8266_NODEMCU_ESP12E -DARDUINO_ARCH_ESP8266 “-DARDUINO_BOARD=\”ESP8266_NODEMCU_ESP12E\”” -DLED_BUILTIN=2 -DFLASHMODE_DIO -DESP8266 “-IC:\\Users\\username\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\cores\\esp8266” “-IC:\\Users\\username\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\variants\\nodemcu” “-Id:\\Arduino\\libraries\\WiFiEsp\\src” “-Id:\\Arduino\\libraries\\HTTPClient\\src” “-IC:\\Users\\hvt-top3\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\3.0.2\\libraries\\ESP8266WiFi\\src” “-Id:\\Arduino\\libraries\\UrlEncode\\src” “d:\\Arduino\\libraries\\HTTPClient\\src\\HTTPClient.cpp” -o nul
Alternatives for esp32-hal-log.h: []
ResolveLibrary(esp32-hal-log.h)
  -> candidates: []
d:\Arduino\libraries\HTTPClient\src\HTTPClient.cpp:30:10: fatal error: esp32-hal-log.h: No such file or directory
   30 | #include <esp32-hal-log.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
Multiple libraries were found for “WiFiClient.h”
  Used: C:\Users\username\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi
  Not used: D:\Arduino\libraries\WiFi
Using library WiFiEsp at version 2.2.2 in folder: D:\Arduino\libraries\WiFiEsp
Using library HTTPClient at version 2.0.0 in folder: D:\Arduino\libraries\HTTPClient
Using library ESP8266WiFi at version 1.0 in folder: C:\Users\hvt-top3\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi
Using library UrlEncode at version 1.0.0 in folder: D:\Arduino\libraries\UrlEncode
exit status 1
 

Question Tags: ESP8266 NodeMCU: Send Messages to WhatsApp
17 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
I already answered your question via email:
”
You don’t need to install any libraries.
The HTTPClient library is the one installed by default that comes with the ESP32 or ESP8266 installation.,
I recommend deleting all the other libraries you’ve installed because they can cause conflict with the original library.
 
Make sure you’re selecting the right board in Tools > Board. Please notice that the code is different for ESP32 and ESP8266.
I also recommend updating your boards’ installation. Go to Tools > Board > Boards Manager, search for ESP32 or ESP8266, and then, update to the newest version.
 
You may also need to follow this trick to fix your installation (even though the problem presented is slightly different): https://randomnerdtutorials.com/solved-arduino-ide-esp32-esp8266-installation/
”
 
Regards,
Sara

0 Vote Up Vote Down
Herman Van twillert answered 2 years ago

Due to a local power-shutdown my email messages arrived later 
 

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

No worries.
Let me know if you were able to solve your issue.
Regards,
Sara

0 Vote Up Vote Down
Herman Van twillert answered 2 years ago

Hoi Sara,
I followed your advise, deleting the libraries involving httpClients,  without succes.
Though the ESP32 board compiles ok and also my ld-Thinker project but, unfortunately  NOT my nodemcuv1,   which is my most favourite hardware.
Then I looked in the Arduino forum  and came across a  tip to use the basic example
“BasicHttpClient”  and that  did compile.
There are a few differencess  and I got it compiling now changing and adding the lines as follows

//  #include <WiFi.h>    
#include <ESP8266WiFi.h>

//#  include <HTTPClient.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
#include <UrlEncode.h>

 
 
AND

void sendMessage(String message){
 
  // Data to send with HTTP POST
  HTTPClient http;
  WiFiClient client;

  String url = “https://api.callmebot.com/whatsapp.php?phone=&#8221; + phoneNumber + “&apikey=” + apiKey + “&text=” + urlEncode(  message);  

  http.begin(client, url);    

It finally compled and works
Thanks
 

 

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

I’m sorry, but I don’t understand.
That’s the code that we have for the EPS8266. It uses the ESP8266HTTPClient.h library.
I think you were following the wrong tutorial for the ESP8266.
This is the right tutorial for the ESP8266: https://randomnerdtutorials.com/esp8266-nodemcu-send-messages-whatsapp/
Regards,
Sara

0 Vote Up Vote Down
Herman Van twillert answered 2 years ago

so i invented the wheel again. !!!
So finally it all compiled and flashed.
I added a debug line to display the complete URL line with the following result in the Serial monitor

.......
Connected to WiFi network with IP Address: 192.168.100.63
start
https://api.callmebot.com/whatsapp.php?phone=0031653896647&apikey=4488702&text=Hello%20from%20ESP8266%21
Error sending the message
HTTP response code: 400

When I put this message in the CallmeBot site,  all goes well and the message is received in my Whats App    

so now what…..
 

0 Vote Up Vote Down
Herman Van twillert answered 2 years ago

and yes, i tried the same with the phone number +31653896647 with same result

So sending in in any browser   the message is send fine.

 

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

You should use the phone number in international format including the + sign.
In the URL that you posted you don’t have the + sign.
Regards,
Sara

0 Vote Up Vote Down
Herman Van twillert answered 2 years ago

as I did also without different result, no chnge

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

The 404 code means a bad request.
Please make sure you’re using the right API key for that number and that all the details are correct.
Note that you can only send messages to the number where you requested the API key.
Regards,
Sara
 

0 Vote Up Vote Down
Herman Van twillert answered 2 years ago

When i copy hat cmplete line and paste it in eh location on a webbrowser the message arrives on my whatsapp allright.
Stiil when send by a nodemcu v1 i receive code 400
 

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

When I try that URL you sent in private I get an error:
APIKey is invalid. Please create a new one or contact support if you lost it.

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Make sure you have the latest version of the ESP8266 boards installed.
Go to Tools > Boards > Boards Manager, search for ESP8266 and update to the newest version.
Regards,
Sara

0 Vote Up Vote Down
Herman Van twillert answered 2 years ago

it was aready the newest version but ALAS I uninstalled, restarted the IDE and installed ESP8266 again. compiles goes ok.
But same response

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi again.
I tested the code again to see if there was something wrong, and it works perfectly fine for me.
So, I’m really not sure why it doesn’t work with your board 😐
Regards,

0 Vote Up Vote Down
Herman Van twillert answered 2 years ago

myomyomy

I changed the secure https to http and, it works.

Probably this is the cause for teh probelem with the firebase project. Totally frustrated I left this project 2 months ago.

Now I have to chase why this did now works on https . I have a server running here which operates on https fine for quite a while

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

If you want to use HTTPS, check the example here: https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient/examples/BasicHttpsClient/BasicHttpsClient.ino

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.