{"id":121964,"date":"2023-01-12T15:44:39","date_gmt":"2023-01-12T15:44:39","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=121964"},"modified":"2024-03-15T17:25:01","modified_gmt":"2024-03-15T17:25:01","slug":"micropython-whatsapp-esp32-esp826","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/micropython-whatsapp-esp32-esp826\/","title":{"rendered":"MicroPython: Send Messages to WhatsApp with the ESP32\/ESP826"},"content":{"rendered":"\n<p>Learn how to program your ESP32 and ESP8266 boards with MicroPython to send messages to your WhatsApp account. This can be useful to receive notifications from your board with sensor readings, alert messages when a sensor reading is above or below a certain threshold, when motion is detected, and many other applications. We\u2019ll use a free API called&nbsp;<a href=\"https:\/\/www.callmebot.com\/blog\/free-api-whatsapp-messages\/\" target=\"_blank\" rel=\"noreferrer noopener\">CallMeBot<\/a>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/11\/MicroPython-ESP32-ESP8266-Send-Messages-WhatsApp.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"MicroPython Send Messages to WhatsApp with the ESP32 ESP826 NodeMCU\" class=\"wp-image-121975\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/11\/MicroPython-ESP32-ESP8266-Send-Messages-WhatsApp.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/11\/MicroPython-ESP32-ESP8266-Send-Messages-WhatsApp.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/11\/MicroPython-ESP32-ESP8266-Send-Messages-WhatsApp.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/11\/MicroPython-ESP32-ESP8266-Send-Messages-WhatsApp.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p>If you prefer to program your boards using Arduino IDE, you can check the following tutorials instead:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-send-messages-whatsapp\/\">ESP32: Send Messages to WhatsApp (Arduino IDE)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-send-messages-whatsapp\/\">ESP8266 NodeMCU: Send Messages to WhatsApp (Arduino IDE)<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"rntbox rntclblue\">New to MicroPython? You can get started here: <a href=\"https:\/\/randomnerdtutorials.com\/getting-started-micropython-esp32-esp8266\/\">Getting Started with MicroPython on ESP32 and ESP8266<\/a>.<\/p>\n\n\n\n<p>To follow this tutorial you need MicroPython firmware installed in your ESP32 or ESP8266 boards. You also need an IDE to write and upload the code to your board. We suggest using Thonny IDE or uPyCraft IDE:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Thonny IDE:\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-thonny-micropython-python-ide-esp32-esp8266\/\">Installing and getting started with Thonny IDE<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/flashing-micropython-firmware-esptool-py-esp32-esp8266\/\">Flashing MicroPython Firmware with esptool.py<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>uPyCraft IDE:\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-micropython-esp32-esp8266\/\">Getting Started with uPyCraft IDE<\/a><\/li>\n\n\n\n<li>Install uPyCraft IDE (<a href=\"https:\/\/randomnerdtutorials.com\/install-upycraft-ide-windows-pc-instructions\/\">Windows<\/a>,&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/install-upycraft-ide-mac-os-x-instructions\/\">Mac OS X<\/a>,&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/install-upycraft-ide-linux-ubuntu-instructions\/\">Linux<\/a>)<\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/flash-upload-micropython-firmware-esp32-esp8266\/\">Flash\/Upload MicroPython Firmware to ESP32 and ESP8266<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>Or, if you&#8217;re familiar with VS Code, you may want to use the PyMakr extension:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-esp32-esp8266-vs-code-pymakr\/\">MicroPython: Program ESP32\/ESP8266 using VS Code and Pymakr<\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"rntbox rntclblue\">Learn more about MicroPython:&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/micropython-programming-with-esp32-and-esp8266\/\">MicroPython Programming with ESP32 and ESP8266 eBook<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introducing WhatsApp<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"200\" height=\"200\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/09\/Whatsapp-logo.png?resize=200%2C200&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"WhatsApp logo\" class=\"wp-image-116773\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/09\/Whatsapp-logo.png?w=200&amp;quality=100&amp;strip=all&amp;ssl=1 200w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/09\/Whatsapp-logo.png?resize=150%2C150&amp;quality=100&amp;strip=all&amp;ssl=1 150w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/><\/figure><\/div>\n\n\n<p>\u201cWhatsApp Messenger, or simply WhatsApp, is an internationally available American freeware, cross-platform centralized instant messaging and voice-over-IP service owned by Meta Platforms.\u201d It allows you to send messages using your phone\u2019s internet connection, so you can avoid SMS fees.<\/p>\n\n\n\n<p>WhatsApp is free and is available for Android and iOS. Install WhatsApp on your smartphone if you don\u2019t have it already.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">CallMeBot WhatsApp API<\/h1>\n\n\n\n<p>To send messages to your WhatsApp account with the ESP32 and ESP8266 boards, we\u2019ll use a free API service called CallMeBot. You can learn more about CallMeBot at the following link:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.callmebot.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.callmebot.com\/<\/a><\/li>\n<\/ul>\n\n\n\n<p>Basically, it works as a gateway that allows you to send a message to yourself. All the information about how to send messages using the API can be found <a href=\"https:\/\/www.callmebot.com\/blog\/free-api-whatsapp-messages\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"callmebot-api-key\">Getting the CallMeBot API KEY<\/h2>\n\n\n\n<p>Before starting using the API, you need to get the CallmeBot WhatsApp API key. Follow the next instructions (<a href=\"https:\/\/www.callmebot.com\/blog\/free-api-whatsapp-messages\/\" target=\"_blank\" rel=\"noopener\">check this link<\/a> for the instructions on the official website).<\/p>\n\n\n\n<ol class=\"wp-block-list\" style=\"list-style-type:1\">\n<li>Add the phone number\u00a0<strong>+34 621 331 709<\/strong>\u00a0to your Phone Contacts. (Name it as you wish) \u2014 please\u00a0<a href=\"https:\/\/www.callmebot.com\/blog\/free-api-whatsapp-messages\/\" target=\"_blank\" rel=\"noreferrer noopener\">double-check the number on the CallMeBot website<\/a>, because it sometimes changes.<\/li>\n\n\n\n<li>Send the following message: &#8220;<em>I allow callmebot to send me messages&#8221;<\/em> to the new Contact created (using WhatsApp of course);<\/li>\n\n\n\n<li>Wait until you receive the message &#8220;<em>API Activated for your phone number. Your APIKEY is XXXXXX<\/em>&#8221; from the bot.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"350\" height=\"458\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/09\/Get-CallMeBot-API-Key.png?resize=350%2C458&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Get CallMeBot API key\" class=\"wp-image-116707\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/09\/Get-CallMeBot-API-Key.png?w=350&amp;quality=100&amp;strip=all&amp;ssl=1 350w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/09\/Get-CallMeBot-API-Key.png?resize=229%2C300&amp;quality=100&amp;strip=all&amp;ssl=1 229w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/figure><\/div>\n\n\n<p><strong>Note:<\/strong> If you don&#8217;t receive the API key in 2 minutes, please try again after 24hs. The WhatsApp message from the bot will contain the API key needed to send messages using the API.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">CallMeBot API<\/h2>\n\n\n\n<p>To send a message using the CallMeBot API you need to make a POST request to the following URL (but using your information):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">https:\/\/api.callmebot.com\/whatsapp.php?phone=<strong>[phone_number]<\/strong>&amp;text=<strong>[message]<\/strong>&amp;apikey=<strong>[your_apikey]<\/strong><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span class=\"rnthl rntliteral\">[phone_number]<\/span>: phone number associated with your WhatsApp account in international format;<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span class=\"rnthl rntliteral\">[message]<\/span>: the message to be sent, should be URL encoded. <\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span class=\"rnthl rntliteral\">[your_apikey]<\/span>: the API key you received during the activation process in the previous section.<\/li>\n<\/ul>\n\n\n\n<p>For the official documentation, you can check the following link: <a href=\"https:\/\/www.callmebot.com\/blog\/free-api-whatsapp-messages\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.callmebot.com\/blog\/free-api-whatsapp-messages\/<\/a><\/p>\n\n\n\n<p>To make HTTP requests with the ESP32 and ESP8266 using MicroPython, you can use the methods provided by the <a href=\"https:\/\/makeblock-micropython-api.readthedocs.io\/en\/latest\/public_library\/Third-party-libraries\/urequests.html#module-urequests\" target=\"_blank\" rel=\"noopener\"><span class=\"rnthl rntliteral\">urequests<\/span> library<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Send Messages to WhatsApp &#8211; MicroPython Script (ESP32\/ESP8266)<\/h2>\n\n\n\n<p>Copy the following code to your MicroPython project <em>main.py<\/em> file. The code is compatible with both the ESP32 and ESP8266 boards.<\/p>\n\n\n\n<p>Before uploading the code to your board, you need to insert your network credentials, your phone number in international format, and the API key.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># Complete project details at https:\/\/RandomNerdTutorials.com\/micropython-whatsapp-esp32-esp826\/\r\n\r\ntry:\r\n  import urequests as requests\r\nexcept:\r\n  import requests\r\n  \r\nimport network\r\n\r\nimport esp\r\nesp.osdebug(None)\r\n\r\nimport gc\r\ngc.collect()\r\n\r\n#Your network credentials\r\nssid = 'REPLACE_WITH_YOUR_SSID'\r\npassword = 'REPLACE_WITH_YOUR_SSID'\r\n\r\n#Your phone number in international format\r\nphone_number = 'YOUR_PHONE_NUMER_INTERNATIONAL_FORMAT'\r\n#Your callmebot API key\r\napi_key = 'CALLMEBOT_API_KEY'\r\n\r\ndef connect_wifi(ssid, password):\r\n  #Connect to your network\r\n  station = network.WLAN(network.STA_IF)\r\n  station.active(True)\r\n  station.connect(ssid, password)\r\n  while station.isconnected() == False:\r\n    pass\r\n  print('Connection successful')\r\n  print(station.ifconfig())\r\n\r\ndef send_message(phone_number, api_key, message):\r\n  #set your host URL\r\n  url = 'https:\/\/api.callmebot.com\/whatsapp.php?phone='+phone_number+'&amp;text='+message+'&amp;apikey='+api_key\r\n\r\n  #make the request\r\n  response = requests.get(url)\r\n  #check if it was successful\r\n  if response.status_code == 200:\r\n    print('Success!')\r\n  else:\r\n    print('Error')\r\n    print(response.text)\r\n\r\n# Connect to WiFi\r\nconnect_wifi(ssid, password)\r\n# Send message to WhatsApp &quot;Hello&quot;\r\nmessage = 'Hello%20from%20ESP32%20%28micropython%29' #YOUR MESSAGE HERE (URL ENCODED)https:\/\/www.urlencoder.io\/ \r\nsend_message(phone_number, api_key, message)<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP-MicroPython\/esp_send_message_whatsapp_main.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How the Code Works<\/h3>\n\n\n\n<p>The code is pretty straightforward to understand.<\/p>\n\n\n\n<p>We start by including the required libraries. The <span class=\"rnthl rntliteral\">urequests<\/span> library to make HTTP requests and the <span class=\"rnthl rntliteral\">network<\/span> library to set the ESP32\/ESP8266 as a WiFi station and connect it to your local network.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>try:\n  import urequests as requests\nexcept:\n  import requests\n  \nimport network\n\nimport esp\nesp.osdebug(None)\n\nimport gc\ngc.collect()<\/code><\/pre>\n\n\n\n<p>Insert your network credentials in the following variables so that the ESP can connect to your local network and have access to internet.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>#Your network credentials\nssid = 'REPLACE_WITH_YOUR_SSID'\npassword = 'REPLACE_WITH_YOUR_SSID'<\/code><\/pre>\n\n\n\n<p>Insert your phone number in international format (including the <span class=\"rnthl rntliteral\">+<\/span> sign) in the following line:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>#Your phone number in international format\nphone_number = 'YOUR_PHONE_NUMER_INTERNATIONAL_FORMAT<\/code><\/pre>\n\n\n\n<p>Then, insert the <a href=\"#callmebot-api-key\">callmebot API key<\/a> you&#8217;ve got previously.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>#Your callmebot API key\napi_key = 'CALLMEBOT_API_KEY'<\/code><\/pre>\n\n\n\n<p>We created a function called <span class=\"rnthl rntliteral\">connect_wifi()<\/span> that accepts as arguments the SSID and password of the network you want to connect to. You should call this function later to actually connect the ESP board to the internet.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>def connect_wifi(ssid, password):\n  #Connect to your network\n  station = network.WLAN(network.STA_IF)\n  station.active(True)\n  station.connect(ssid, password)\n  while station.isconnected() == False:\n    pass\n  print('Connection successful')\n  print(station.ifconfig())<\/code><\/pre>\n\n\n\n<p>To make it easier to adapt the code to your projects, we created a function called <span class=\"rnthl rntliteral\">send_message()<\/span> that contains all the necessary instructions to send the messages to WhatsApp. This function accepts as arguments the phone number, callmebot API key and the message you want to send. You just need to call this function with the required arguments when you want to send a message.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>def send_message(phone_number, api_key, message):\n  #set your host URL\n  url = 'https:\/\/api.callmebot.com\/whatsapp.php?phone='+phone_number+'&amp;text='+message+'&amp;apikey='+api_key\n\n  #make the request\n  response = requests.get(url)\n  #check if it was successful\n  if response.status_code == 200:\n    print('Success!')\n  else:\n    print('Error')\n    print(response.text)<\/code><\/pre>\n\n\n\n<p>Now that we&#8217;ve created all the necessary functions, call the <span class=\"rnthl rntliteral\">connect_wifi()<\/span> function to connect the ESP to your local network.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>connect_wifi(ssid, password)<\/code><\/pre>\n\n\n\n<p>We created a variable called <span class=\"rnthl rntliteral\">message<\/span> that contains the text that we want to send. The message should be in URL encoded format. You can use <a href=\"https:\/\/www.urlencoder.io\/\" target=\"_blank\" rel=\"noopener\">this tool<\/a> to convert your text to URL encoded format. We&#8217;re sending the following message: <span class=\"rnthl rntliteral\">Hello from ESP32 (micropython)<\/span>. You can send whatever text makes sense for your project including values from sensor readings, for example.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>message = 'Hello%20from%20ESP32%20%28micropython%29' #YOUR MESSAGE HERE (URL ENCODED)https:\/\/www.urlencoder.io\/ <\/code><\/pre>\n\n\n\n<p>Finally, call the <span class=\"rnthl rntliteral\">send_message()<\/span> function to send the message.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>send_message(phone_number, api_key, message)<\/code><\/pre>\n\n\n\n<p>As you can see, sending a message to WhatsApp using MicroPython is pretty straightforward. You can use the <span class=\"rnthl rntliteral\">send_message()<\/span> function in your projects to send messages using your boards.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Demonstration<\/h2>\n\n\n\n<p>After inserting your credentials, phone number and API key, you can upload the <em>main.py<\/em> file to your board using your <a href=\"https:\/\/randomnerdtutorials.com\/micropython-ides-esp32-esp8266\/\">favorite MicroPython IDE<\/a>. <\/p>\n\n\n\n<p>Reset the board to start running the code. You should get a success message on the shell.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"551\" height=\"158\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/11\/Send-Message-WhatsApp-MicroPython.png?resize=551%2C158&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"MicroPython Send Messages to WhatsApp with the ESP32 ESP826 NodeMCU Demonstration\" class=\"wp-image-121972\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/11\/Send-Message-WhatsApp-MicroPython.png?w=551&amp;quality=100&amp;strip=all&amp;ssl=1 551w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/11\/Send-Message-WhatsApp-MicroPython.png?resize=300%2C86&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 551px) 100vw, 551px\" \/><\/figure><\/div>\n\n\n<p>After receiving that success message, you should receive a message from the WhatsApp Bot with the content you&#8217;ve set on the code. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"418\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/11\/WhatsApp-message-received-fromESP32-ESP8266.png?resize=500%2C418&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"MicroPython Send Messages to WhatsApp with the ESP32 ESP826 NodeMCU Demonstration Testing\" class=\"wp-image-121971\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/11\/WhatsApp-message-received-fromESP32-ESP8266.png?w=500&amp;quality=100&amp;strip=all&amp;ssl=1 500w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/11\/WhatsApp-message-received-fromESP32-ESP8266.png?resize=300%2C251&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/figure><\/div>\n\n\n<p>Congratulations! You&#8217;ve successfully sent messages to your WhatsApp account with the ESP32 and ESP8266 boards (programmed with MicroPython).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this tutorial, you learned how to send messages to your WhatsApp account using the ESP32 and ESP8266 programmed with MicroPython firmware. <\/p>\n\n\n\n<p>To send the messages we used a <a href=\"https:\/\/www.callmebot.com\/blog\/free-api-whatsapp-messages\/\" target=\"_blank\" rel=\"noopener\">free API called callmebot<\/a> that allows you to send messages to yourself for personal projects. To send a message, we just need to make a request to a URL with the required parameters. Making a request with MicroPython is very straightforward using the <span class=\"rnthl rntliteral\">urequests<\/span> library.<\/p>\n\n\n\n<p>We hope you&#8217;ve found this tutorial useful. We have other tutorials (using Arduino IDE) showing how to send different types of notifications. You can check the tutorials below.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-send-email-smtp-server-arduino-ide\/\">Send emails with the ESP32<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-send-email-smtp-server-arduino\/\">Send emails with the ESP826<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/send-sms-esp32-twilio\/\">Send SMS with the ESP32<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-door-status-telegram\/\">Send messages to Telegram with the ESP32<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-door-status-telegram\/\">Send messages to Telegram with the ESP8266<\/a><\/li>\n<\/ul>\n\n\n\n<p>You can check all our&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32-esp8266-micropython\/\">MicroPython projects here<\/a>.<\/p>\n\n\n\n<p>If you want to learn more about programming the ESP32 and ESP8266 boards with MicroPython, check out our eBook:&nbsp;<a href=\"https:\/\/randomnerdtutorials.com\/micropython-programming-with-esp32-and-esp8266\/\"><strong>MicroPython Programming with ESP32 and ESP8266<\/strong><\/a><strong>.<\/strong><\/p>\n\n\n\n<p>Thanks for reading<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to program your ESP32 and ESP8266 boards with MicroPython to send messages to your WhatsApp account. This can be useful to receive notifications from your board with sensor &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"MicroPython: Send Messages to WhatsApp with the ESP32\/ESP826\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/micropython-whatsapp-esp32-esp826\/#more-121964\" aria-label=\"Read more about MicroPython: Send Messages to WhatsApp with the ESP32\/ESP826\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":121975,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[310,309,264],"tags":[],"class_list":["post-121964","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-micropython","category-0-esp32-micropython","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/11\/MicroPython-ESP32-ESP8266-Send-Messages-WhatsApp.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/121964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=121964"}],"version-history":[{"count":15,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/121964\/revisions"}],"predecessor-version":[{"id":150453,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/121964\/revisions\/150453"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/121975"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=121964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=121964"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=121964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}