{"id":96830,"date":"2020-05-15T09:45:15","date_gmt":"2020-05-15T09:45:15","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=96830"},"modified":"2022-10-27T14:16:03","modified_gmt":"2022-10-27T14:16:03","slug":"esp32-http-post-ifttt-thingspeak-arduino","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/esp32-http-post-ifttt-thingspeak-arduino\/","title":{"rendered":"ESP32 HTTP POST with Arduino IDE (ThingSpeak and IFTTT.com)"},"content":{"rendered":"\n<p>In this guide, you&#8217;ll learn how to make HTTP POST requests using the ESP32 board with Arduino IDE. We&#8217;ll demonstrate how to post JSON data or URL encoded values to two web APIs (ThingSpeak and IFTTT.com).<\/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\/2020\/05\/ESP32-HTTP-POST-with-Arduino-IDE-IFTTT-ThingSpeak.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 HTTP POST with Arduino IDE IFTTT ThingSpeak\" class=\"wp-image-96787\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-HTTP-POST-with-Arduino-IDE-IFTTT-ThingSpeak.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-HTTP-POST-with-Arduino-IDE-IFTTT-ThingSpeak.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-HTTP-POST-with-Arduino-IDE-IFTTT-ThingSpeak.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-HTTP-POST-with-Arduino-IDE-IFTTT-ThingSpeak.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><strong>Recommended:<\/strong> <a href=\"https:\/\/randomnerdtutorials.com\/esp32-http-get-open-weather-map-thingspeak-arduino\/\">ESP32 HTTP GET with Arduino IDE (OpenWeatherMap.org and ThingSpeak)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">HTTP POST Request Method<\/h2>\n\n\n\n<p>The Hypertext Transfer Protocol (HTTP) works as a request-response protocol between a client and server. Here&#8217;s an example:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The ESP32 (client) submits an HTTP request to a Server (for example: ThingSpeak or IFTTT.com);<\/li><li>The server returns a response to the ESP32 (client);<\/li><li>Finally, the response contains status information about the request and may also contain the requested content.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">HTTP POST<\/h3>\n\n\n\n<p><strong>POST <\/strong>is used to send data to a server to create\/update a resource. For example, publish sensor readings to a server.<\/p>\n\n\n\n<p>The data sent to the server with POST is stored in the request body of the HTTP request:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POST \/update HTTP\/1.1\nHost: example.com\napi_key=api&amp;field1=value1\nContent-Type: application\/x-www-form-urlencoded<\/code><\/pre>\n\n\n\n<p>In the body request, you can also send a JSON object:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POST \/update HTTP\/1.1\nHost: example.com\n{api_key: \"api\", field1: value1}\nContent-Type: application\/json<\/code><\/pre>\n\n\n\n<p><em>(With HTTP POST, data is not visible in the URL request. However, if it&#8217;s not encrypted, it&#8217;s still visible in the request body.)<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>Before proceeding with this tutorial, make sure you complete the following prerequisites.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Arduino IDE<\/h3>\n\n\n\n<p>We&#8217;ll program the <a href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\" rel=\"noreferrer noopener\">ESP32 <\/a>using Arduino IDE, so make sure you have the ESP32 add-on installed.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/installing-the-esp32-board-in-arduino-ide-windows-instructions\/\">Installing the ESP32 Board in Arduino IDE (Windows, Mac OS X, Linux)<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Other Web Services or APIs<\/h2>\n\n\n\n<p>In this guide, you&#8217;ll learn how to setup your <a rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/esp32-dev-board-wi-fi-bluetooth\/\" target=\"_blank\">ESP32 board<\/a> to perform HTTP requests to ThingSpeak and IFTTT.com. If you prefer to learn with a local solution you can use <a href=\"https:\/\/randomnerdtutorials.com\/esp32-http-get-post-arduino\/\">HTTP with Node-RED<\/a>. All examples presented in this guide also work with other APIs.<\/p>\n\n\n\n<p>In summary, to make this guide compatible with any service, you need to search for the service API documentation. Then, you need the server name (URL or IP address), and parameters to send in the request (URL path or request body). Finally, modify our examples to integrate with any API you want to use.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. ESP32 HTTP POST Data (ThingSpeak)<\/h2>\n\n\n\n<p>In this example, the ESP32 makes an HTTP POST request to send a new value to ThingSpeak.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"900\" height=\"350\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/HTTP-POST-Thingspeak-ESP32.png?resize=900%2C350&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"HTTP POST ThingSpeak ESP32\" class=\"wp-image-96813\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/HTTP-POST-Thingspeak-ESP32.png?w=900&amp;quality=100&amp;strip=all&amp;ssl=1 900w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/HTTP-POST-Thingspeak-ESP32.png?resize=300%2C117&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/HTTP-POST-Thingspeak-ESP32.png?resize=768%2C299&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Using ThingSpeak API<\/h3>\n\n\n\n<p>ThingSpeak has a free API that allows you to store and retrieve data using HTTP. In this tutorial, you\u2019ll use the ThingSpeak API to publish and visualize data in charts from anywhere. As an example, we&#8217;ll publish random values, but in a real application you would use <a href=\"https:\/\/randomnerdtutorials.com\/esp32-bme280-arduino-ide-pressure-temperature-humidity\/\">real sensor readings<\/a>.<\/p>\n\n\n\n<p>To use ThingSpeak API, you need an API key. Follow the next steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Go to <a rel=\"noreferrer noopener\" href=\"https:\/\/thingspeak.com\/\" target=\"_blank\">ThingSpeak.com<\/a> and create a free account.<\/li><li>Then, open the <a rel=\"noreferrer noopener\" href=\"https:\/\/thingspeak.com\/channels\" target=\"_blank\">Channels<\/a> tab.<\/li><li>Create a <strong>New Channel<\/strong>.<\/li><\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"453\" height=\"326\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-ThingSpeak-New-Channel.png?resize=453%2C326&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 ESP8266 NodeMCU ThingSpeak Create New Channel\" class=\"wp-image-96802\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-ThingSpeak-New-Channel.png?w=453&amp;quality=100&amp;strip=all&amp;ssl=1 453w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-ThingSpeak-New-Channel.png?resize=300%2C216&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 453px) 100vw, 453px\" \/><\/figure><\/div>\n\n\n<ol start=\"4\"><li>Open your newly created channel and select the <strong>API Keys<\/strong> tab to copy your Write API Key.<\/li><\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"628\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-ThingSpeak-View-API-Key-Write-Copy.png?resize=1024%2C628&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 ESP8266 NodeMCU ThingSpeak View API Key Write Copy\" class=\"wp-image-96803\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-ThingSpeak-View-API-Key-Write-Copy.png?w=1024&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-ThingSpeak-View-API-Key-Write-Copy.png?resize=300%2C184&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-ThingSpeak-View-API-Key-Write-Copy.png?resize=768%2C471&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Code ESP32 HTTP POST ThingSpeak<\/h3>\n\n\n\n<p>Copy the next sketch to your Arduino IDE:<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*\r\n  Rui Santos\r\n  Complete project details at Complete project details at https:\/\/RandomNerdTutorials.com\/esp32-http-post-ifttt-thingspeak-arduino\/ \r\n\r\n  Permission is hereby granted, free of charge, to any person obtaining a copy\r\n  of this software and associated documentation files.\r\n\r\n  The above copyright notice and this permission notice shall be included in all\r\n  copies or substantial portions of the Software.\r\n*\/\r\n\r\n#include &lt;WiFi.h&gt;\r\n#include &lt;HTTPClient.h&gt;\r\n\r\nconst char* ssid = &quot;REPLACE_WITH_YOUR_SSID&quot;;\r\nconst char* password = &quot;REPLACE_WITH_YOUR_PASSWORD&quot;;\r\n\r\n\/\/ Domain Name with full URL Path for HTTP POST Request\r\nconst char* serverName = &quot;http:\/\/api.thingspeak.com\/update&quot;;\r\n\/\/ Service API Key\r\nString apiKey = &quot;REPLACE_WITH_YOUR_API_KEY&quot;;\r\n\r\n\/\/ THE DEFAULT TIMER IS SET TO 10 SECONDS FOR TESTING PURPOSES\r\n\/\/ For a final application, check the API call limits per hour\/minute to avoid getting blocked\/banned\r\nunsigned long lastTime = 0;\r\n\/\/ Set timer to 10 minutes (600000)\r\n\/\/unsigned long timerDelay = 600000;\r\n\/\/ Timer set to 10 seconds (10000)\r\nunsigned long timerDelay = 10000;\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n\r\n  WiFi.begin(ssid, password);\r\n  Serial.println(&quot;Connecting&quot;);\r\n  while(WiFi.status() != WL_CONNECTED) {\r\n    delay(500);\r\n    Serial.print(&quot;.&quot;);\r\n  }\r\n  Serial.println(&quot;&quot;);\r\n  Serial.print(&quot;Connected to WiFi network with IP Address: &quot;);\r\n  Serial.println(WiFi.localIP());\r\n \r\n  Serial.println(&quot;Timer set to 10 seconds (timerDelay variable), it will take 10 seconds before publishing the first reading.&quot;);\r\n\r\n  \/\/ Random seed is a number used to initialize a pseudorandom number generator\r\n  randomSeed(analogRead(33));\r\n}\r\n\r\nvoid loop() {\r\n  \/\/Send an HTTP POST request every 10 seconds\r\n  if ((millis() - lastTime) &gt; timerDelay) {\r\n    \/\/Check WiFi connection status\r\n    if(WiFi.status()== WL_CONNECTED){\r\n      WiFiClient client;\r\n      HTTPClient http;\r\n    \r\n      \/\/ Your Domain name with URL path or IP address with path\r\n      http.begin(client, serverName);\r\n      \r\n      \/\/ Specify content-type header\r\n      http.addHeader(&quot;Content-Type&quot;, &quot;application\/x-www-form-urlencoded&quot;);\r\n      \/\/ Data to send with HTTP POST\r\n      String httpRequestData = &quot;api_key=&quot; + apiKey + &quot;&amp;field1=&quot; + String(random(40));           \r\n      \/\/ Send HTTP POST request\r\n      int httpResponseCode = http.POST(httpRequestData);\r\n      \r\n      \/*\r\n      \/\/ If you need an HTTP request with a content type: application\/json, use the following:\r\n      http.addHeader(&quot;Content-Type&quot;, &quot;application\/json&quot;);\r\n      \/\/ JSON data to send with HTTP POST\r\n      String httpRequestData = &quot;{\\&quot;api_key\\&quot;:\\&quot;&quot; + apiKey + &quot;\\&quot;,\\&quot;field1\\&quot;:\\&quot;&quot; + String(random(40)) + &quot;\\&quot;}&quot;;           \r\n      \/\/ Send HTTP POST request\r\n      int httpResponseCode = http.POST(httpRequestData);*\/\r\n     \r\n      Serial.print(&quot;HTTP Response code: &quot;);\r\n      Serial.println(httpResponseCode);\r\n        \r\n      \/\/ Free resources\r\n      http.end();\r\n    }\r\n    else {\r\n      Serial.println(&quot;WiFi Disconnected&quot;);\r\n    }\r\n    lastTime = millis();\r\n  }\r\n}\r\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP32\/HTTP\/ESP32_HTTP_POST_Think_Speak.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Setting your network credentials<\/h4>\n\n\n\n<p>Modify the next lines with your network credentials: SSID and password. The code is well commented on where you should make the changes.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Replace with your network credentials\nconst char* ssid     = \"REPLACE_WITH_YOUR_SSID\";\nconst char* password = \"REPLACE_WITH_YOUR_PASSWORD\";<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Setting your API Key<\/h4>\n\n\n\n<p>Modify the <span class=\"rnthl rntliteral\">apiKey<\/span> variable to include your ThingSpeak API key.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>String apiKey = \"REPLACE_WITH_YOUR_API_KEY\";<\/code><\/pre>\n\n\n\n<p>Now, upload the code to your board and it should work straight away. Read the next section, if you want to learn how to make the HTTP POST request.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">HTTP POST Request<\/h4>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">loop()<\/span> is where you make the HTTP POST request with URL encoded data every 10 seconds with random data:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Specify content-type header\nhttp.addHeader(\"Content-Type\", \"application\/x-www-form-urlencoded\");\n\n\/\/ Data to send with HTTP POST\nString httpRequestData = \"api_key=\" + apiKey + \"&amp;field1=\" + String(random(40));\n\n\/\/ Send HTTP POST request\nint httpResponseCode = http.POST(httpRequestData);<\/code><\/pre>\n\n\n\n<p>For example, the ESP32 makes a URL encoded request to publish a new value (30) to <span class=\"rnthl rntliteral\">field1<\/span>. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POST \/update HTTP\/1.1\nHost: api.thingspeak.com\napi_key=api&amp;field1=30\nContent-Type: application\/x-www-form-urlencoded<\/code><\/pre>\n\n\n\n<p>Or you can uncomment these next lines to make a request with JSON data (instead of URL-encoded request):<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ If you need an HTTP request with a content type: application\/json, use the following:\nhttp.addHeader(\"Content-Type\", \"application\/json\");\n\n\/\/ JSON data to send with HTTP POST\nString httpRequestData = \"{\\\"api_key\\\":\\\"\" + apiKey + \"\\\",\\\"field1\\\":\\\"\" + String(random(40)) + \"\\\"}\";\n\n\/\/ Send HTTP POST request\nint httpResponseCode = http.POST(httpRequestData);<\/code><\/pre>\n\n\n\n<p>Here&#8217;s a sample HTTP POST request with JSON data:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POST \/update HTTP\/1.1\nHost: api.thingspeak.com\n{api_key: \"api\", field1: 30}\nContent-Type: application\/json<\/code><\/pre>\n\n\n\n<p>Then, the following lines print the server response code.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Serial.print(\"HTTP Response code: \");\nSerial.println(httpResponseCode);<\/code><\/pre>\n\n\n\n<p>In the Arduino IDE serial monitor, you should see an HTTP response code of 200 (this means that the request has succeeded).<\/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=\"903\" height=\"589\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-POST-Arduino-IDE-Serial-Monitor-Response.png?resize=903%2C589&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 ESP8266 NodeMCU HTTP POST Arduino IDE Serial Monitor Response\" class=\"wp-image-96785\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-POST-Arduino-IDE-Serial-Monitor-Response.png?w=903&amp;quality=100&amp;strip=all&amp;ssl=1 903w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-POST-Arduino-IDE-Serial-Monitor-Response.png?resize=300%2C196&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-POST-Arduino-IDE-Serial-Monitor-Response.png?resize=768%2C501&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 903px) 100vw, 903px\" \/><\/figure><\/div>\n\n\n<p>Your ThingSpeak Dashboard should be receiving new random readings every 10 seconds.<\/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=\"463\" height=\"314\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-GET-POST-ThingSpeak-chart.png?resize=463%2C314&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 ESP8266 NodeMCU HTTP GET and HTTP POST with Arduino IDE ThingSpeak Chart\" class=\"wp-image-96806\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-GET-POST-ThingSpeak-chart.png?w=463&amp;quality=100&amp;strip=all&amp;ssl=1 463w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-GET-POST-ThingSpeak-chart.png?resize=300%2C203&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 463px) 100vw, 463px\" \/><\/figure><\/div>\n\n\n<p>For a final application, you might need to increase the timer or check the API call limits per hour\/minute to avoid getting blocked\/banned.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. ESP32 HTTP POST (IFTTT.com)<\/h2>\n\n\n\n<p>In this example you\u2019ll learn how to trigger a web API to send email notifications. As an example, we\u2019ll use the IFTTT.com API. IFTTT has has a free plan with lots of useful automations.<\/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=\"900\" height=\"349\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/HTTP-POST-IFTTT-ESP32.png?resize=900%2C349&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"HTTP POST IFTTT ESP32\" class=\"wp-image-96811\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/HTTP-POST-IFTTT-ESP32.png?w=900&amp;quality=100&amp;strip=all&amp;ssl=1 900w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/HTTP-POST-IFTTT-ESP32.png?resize=300%2C116&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/HTTP-POST-IFTTT-ESP32.png?resize=768%2C298&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Using IFTTT.com Webhooks API<\/h3>\n\n\n\n<p>IFTTT stands for \u201cIf This Than That\u201d, and it is a free web-based service to create chains of simple conditional statements called applets.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/Wordmark_on_gray.png?resize=308%2C114&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"IFTTT.com logo png\" class=\"wp-image-96853\" width=\"308\" height=\"114\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/Wordmark_on_gray.png?w=800&amp;quality=100&amp;strip=all&amp;ssl=1 800w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/Wordmark_on_gray.png?resize=300%2C111&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/Wordmark_on_gray.png?resize=768%2C283&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 308px) 100vw, 308px\" \/><\/figure><\/div>\n\n\n<p>This means you can trigger an event when something happens. In this example, the applet sends three random values to your email when the ESP32 makes a request. You can replace those random values with useful <a href=\"https:\/\/randomnerdtutorials.com\/esp32-bme280-arduino-ide-pressure-temperature-humidity\/\">sensor readings<\/a>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Creating an IFTTT Account<\/h4>\n\n\n\n<p>If you don\u2019t have an IFTTT account, go the IFTTT website: <a rel=\"noreferrer noopener\" href=\"https:\/\/ifttt.com\/\" target=\"_blank\">ifttt.com<\/a> and enter your email to create an account and get started. Creating an account on IFTTT is free!<\/p>\n\n\n\n<p>Next, you need to create a new applet. Follow the next steps to create a new<br>applet:<\/p>\n\n\n\n<p>1. Open the left menu and click the &#8220;<strong>Create<\/strong>&#8221; button.<\/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=\"954\" height=\"559\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ifttt-discover-create-new-applet.png?resize=954%2C559&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ifttt discover create new applet\" class=\"wp-image-96860\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ifttt-discover-create-new-applet.png?w=954&amp;quality=100&amp;strip=all&amp;ssl=1 954w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ifttt-discover-create-new-applet.png?resize=300%2C176&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ifttt-discover-create-new-applet.png?resize=768%2C450&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 954px) 100vw, 954px\" \/><\/figure><\/div>\n\n\n<p>2. Click on the \u201c<strong>this<\/strong>\u201d word. Search for the \u201c<strong>Webhooks<\/strong>\u201d service and select the Webhooks icon.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"654\" height=\"417\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/select-webhooks-ifttt-1.png?resize=654%2C417&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Select webhooks services IFTTT.com\" class=\"wp-image-96863\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/select-webhooks-ifttt-1.png?w=654&amp;quality=100&amp;strip=all&amp;ssl=1 654w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/select-webhooks-ifttt-1.png?resize=300%2C191&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 654px) 100vw, 654px\" \/><\/figure><\/div>\n\n\n<p>3. Choose the \u201c<strong>Receive a web request<\/strong>\u201d trigger and give a name to the event. In this case, I&#8217;ve typed \u201c<strong>test_event<\/strong>\u201d. Then, click the \u201c<strong>Create trigger<\/strong>\u201d button.<\/p>\n\n\n\n<p>4. Click the \u201c<strong>that<\/strong>\u201d word to proceed. Now, define what happens when the event you\u2019ve defined is triggered. Search for the \u201c<strong>Email<\/strong>\u201d service and select it.<\/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=\"495\" height=\"424\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/select-email-service-ifttt.png?resize=495%2C424&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"select email service ifttt\" class=\"wp-image-96864\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/select-email-service-ifttt.png?w=495&amp;quality=100&amp;strip=all&amp;ssl=1 495w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/select-email-service-ifttt.png?resize=300%2C257&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 495px) 100vw, 495px\" \/><\/figure><\/div>\n\n\n<p>5. Then, select <strong>Send me an email<\/strong>. You can leave the default options.<\/p>\n\n\n\n<p>6. Press the \u201c<strong>Create action<\/strong>\u201d button to create your Applet. Then, click on <strong>Continue<\/strong>, and finally, <strong>Finish<\/strong>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Testing Your Applet<\/h4>\n\n\n\n<p>Before proceeding with the project, it\u2019s important to test your Applet first. Follow the next steps to test it:<\/p>\n\n\n\n<p>1. Search for <strong>Webhooks <\/strong>service or open this link: <a rel=\"noreferrer noopener\" href=\"https:\/\/ifttt.com\/maker_webhooks\" target=\"_blank\">https:\/\/ifttt.com\/maker_webhooks<\/a><\/p>\n\n\n\n<p>2. Click the \u201c<strong>Documentation<\/strong>\u201d button. <\/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=\"954\" height=\"611\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/webhooks-documentation-ifttt.png?resize=954%2C611&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"webhooks documentation ifttt\" class=\"wp-image-96865\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/webhooks-documentation-ifttt.png?w=954&amp;quality=100&amp;strip=all&amp;ssl=1 954w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/webhooks-documentation-ifttt.png?resize=300%2C192&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/webhooks-documentation-ifttt.png?resize=768%2C492&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 954px) 100vw, 954px\" \/><\/figure><\/div>\n\n\n<p>A page showing your unique API key will show up.<\/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=\"684\" height=\"91\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/10\/IFTTT-API-KEYU.png?resize=684%2C91&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"IFTTT API key\" class=\"wp-image-120187\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/10\/IFTTT-API-KEYU.png?w=684&amp;quality=100&amp;strip=all&amp;ssl=1 684w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/10\/IFTTT-API-KEYU.png?resize=300%2C40&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 684px) 100vw, 684px\" \/><\/figure><\/div>\n\n\n<p>Save your API key because you&#8217;ll need it later.<\/p>\n\n\n\n<p>3. Fill the \u201cTo trigger an Event with 3 JSON values\u201d section with the event name created previously, in our case <strong>test_event<\/strong>. Add some random values to the <strong>value1<\/strong>, <strong>value2<\/strong>, and <strong>value 3<\/strong> fields. Then, click the \u201c<strong>Test it<\/strong>\u201d button.<\/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=\"777\" height=\"529\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/10\/IFTTT-Trigger-an-Event-3-JSON-Values.png?resize=777%2C529&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"IFTTT Trigger an Event with 3 JSON values\" class=\"wp-image-120188\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/10\/IFTTT-Trigger-an-Event-3-JSON-Values.png?w=777&amp;quality=100&amp;strip=all&amp;ssl=1 777w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/10\/IFTTT-Trigger-an-Event-3-JSON-Values.png?resize=300%2C204&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2022\/10\/IFTTT-Trigger-an-Event-3-JSON-Values.png?resize=768%2C523&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 777px) 100vw, 777px\" \/><\/figure><\/div>\n\n\n<p>4. The event should be successfully triggered, and you\u2019ll get a green message saying \u201c<strong>Event has been triggered<\/strong>\u201d.<\/p>\n\n\n\n<p>5. Go to your Email account. You should have a new email in your inbox from the IFTTT service with the values you\u2019ve defined in the previous step.<\/p>\n\n\n\n<p>If you\u2019ve received an email with the data entered in the test request, it means your Applet is working as expected. Now, we need to program the ESP32 to send an HTTP POST request to the IFTTT service with the sensor readings.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Code ESP32 HTTP POST Webhooks IFTTT.com<\/h3>\n\n\n\n<p>After installing the necessary board add-ons and libraries, copy the following code to your Arduino IDE, but don\u2019t upload it yet. You need to make some changes to make it work for you.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*\r\n  Rui Santos\r\n  Complete project details at Complete project details at https:\/\/RandomNerdTutorials.com\/esp32-http-post-ifttt-thingspeak-arduino\/\r\n\r\n  Permission is hereby granted, free of charge, to any person obtaining a copy\r\n  of this software and associated documentation files.\r\n\r\n  The above copyright notice and this permission notice shall be included in all\r\n  copies or substantial portions of the Software.\r\n*\/\r\n\r\n#include &lt;WiFi.h&gt;\r\n#include &lt;HTTPClient.h&gt;\r\n\r\nconst char* ssid = &quot;REPLACE_WITH_YOUR_SSID&quot;;\r\nconst char* password = &quot;REPLACE_WITH_YOUR_PASSWORD&quot;;\r\n\r\n\/\/ Domain Name with full URL Path for HTTP POST Request\r\n\/\/ REPLACE WITH YOUR EVENT NAME AND API KEY - open the documentation: https:\/\/ifttt.com\/maker_webhooks\r\nconst char* serverName = &quot;http:\/\/maker.ifttt.com\/trigger\/REPLACE_WITH_YOUR_EVENT\/with\/key\/REPLACE_WITH_YOUR_API_KEY&quot;;\r\n\/\/ Example:\r\n\/\/const char* serverName = &quot;http:\/\/maker.ifttt.com\/trigger\/test_event\/with\/key\/nAZjOphL3d-ZO4N3k64-1A7gTlNSrxMJdmqy3tC&quot;;\r\n\r\n\/\/ THE DEFAULT TIMER IS SET TO 10 SECONDS FOR TESTING PURPOSES\r\n\/\/ For a final application, check the API call limits per hour\/minute to avoid getting blocked\/banned\r\nunsigned long lastTime = 0;\r\n\/\/ Set timer to 10 minutes (600000)\r\n\/\/unsigned long timerDelay = 600000;\r\n\/\/ Timer set to 10 seconds (10000)\r\nunsigned long timerDelay = 10000;\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n\r\n  WiFi.begin(ssid, password);\r\n  Serial.println(&quot;Connecting&quot;);\r\n  while(WiFi.status() != WL_CONNECTED) {\r\n    delay(500);\r\n    Serial.print(&quot;.&quot;);\r\n  }\r\n  Serial.println(&quot;&quot;);\r\n  Serial.print(&quot;Connected to WiFi network with IP Address: &quot;);\r\n  Serial.println(WiFi.localIP());\r\n \r\n  Serial.println(&quot;Timer set to 10 seconds (timerDelay variable), it will take 10 seconds before publishing the first reading.&quot;);\r\n\r\n  \/\/ Random seed is a number used to initialize a pseudorandom number generator\r\n  randomSeed(analogRead(33));\r\n}\r\n\r\nvoid loop() {\r\n  \/\/Send an HTTP POST request every 10 seconds\r\n  if ((millis() - lastTime) &gt; timerDelay) {\r\n    \/\/Check WiFi connection status\r\n    if(WiFi.status()== WL_CONNECTED){\r\n      WiFiClient client;\r\n      HTTPClient http;\r\n    \r\n      \/\/ Your Domain name with URL path or IP address with path\r\n      http.begin(client, serverName);\r\n      \r\n      \/\/ Specify content-type header\r\n      http.addHeader(&quot;Content-Type&quot;, &quot;application\/x-www-form-urlencoded&quot;);\r\n      \/\/ Data to send with HTTP POST\r\n      String httpRequestData = &quot;value1=&quot; + String(random(40)) + &quot;&amp;value2=&quot; + String(random(40))+ &quot;&amp;value3=&quot; + String(random(40));           \r\n      \/\/ Send HTTP POST request\r\n      int httpResponseCode = http.POST(httpRequestData);\r\n      \r\n      \/*\r\n      \/\/ If you need an HTTP request with a content type: application\/json, use the following:\r\n      http.addHeader(&quot;Content-Type&quot;, &quot;application\/json&quot;);\r\n      \/\/ JSON data to send with HTTP POST\r\n      String httpRequestData = &quot;{\\&quot;value1\\&quot;:\\&quot;&quot; + String(random(40)) + &quot;\\&quot;,\\&quot;value2\\&quot;:\\&quot;&quot; + String(random(40)) + &quot;\\&quot;,\\&quot;value3\\&quot;:\\&quot;&quot; + String(random(40)) + &quot;\\&quot;}&quot;;\r\n      \/\/ Send HTTP POST request\r\n      int httpResponseCode = http.POST(httpRequestData);\r\n      *\/\r\n     \r\n      Serial.print(&quot;HTTP Response code: &quot;);\r\n      Serial.println(httpResponseCode);\r\n        \r\n      \/\/ Free resources\r\n      http.end();\r\n    }\r\n    else {\r\n      Serial.println(&quot;WiFi Disconnected&quot;);\r\n    }\r\n    lastTime = millis();\r\n  }\r\n}\r\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP32\/HTTP\/ESP32_HTTP_POST_IFTTT.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Setting your network credentials<\/h4>\n\n\n\n<p>Modify the next lines with your network credentials: SSID and password. The code is well commented on where you should make the changes.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Replace with your network credentials\nconst char* ssid     = \"REPLACE_WITH_YOUR_SSID\";\nconst char* password = \"REPLACE_WITH_YOUR_PASSWORD\";<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Setting your IFTTT.com API Key<\/h4>\n\n\n\n<p>Insert your event name and API key in the following line:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>const char* serverName = \"http:\/\/maker.ifttt.com\/trigger\/REPLACE_WITH_YOUR_EVENT\/with\/key\/REPLACE_WITH_YOUR_API_KEY\";<\/code><\/pre>\n\n\n\n<p>Example URL:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>const char* serverName = \"http:\/\/maker.ifttt.com\/trigger\/test_event\/with\/key\/nAZjOphL3d-ZO4N3k64-1A7gTlNSrxMJdmqy3t\";<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">HTTP POST Request<\/h4>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">loop()<\/span> is where you make the HTTP POST request every 10 seconds with sample data:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ Specify content-type header\nhttp.addHeader(\"Content-Type\", \"application\/x-www-form-urlencoded\");\n\n\/\/ Data to send with HTTP POST\nString httpRequestData = \"value1=\" + String(random(40)) + \"&amp;value2=\" + String(random(40))+ \"&amp;value3=\" + String(random(40));\n\n\/\/ Send HTTP POST request\nint httpResponseCode = http.POST(httpRequestData);<\/code><\/pre>\n\n\n\n<p>The ESP32 makes a new URL encoded request to publish some random values in the <span class=\"rnthl rntliteral\">value1<\/span>, <span class=\"rnthl rntliteral\">value2<\/span> and <span class=\"rnthl rntliteral\">value3<\/span> fields. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POST \/trigger\/test_event\/with\/key\/nAZjOphL3d-ZO4N3k64-1A7gTlNSrxMJdmqy3tC HTTP\/1.1\nHost: maker.ifttt.com\nvalue1=15&amp;value2=11&amp;value3=30\nContent-Type: application\/x-www-form-urlencoded<\/code><\/pre>\n\n\n\n<p>Alternatively, you can uncomment these next lines to make a request with JSON data:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>\/\/ If you need an HTTP request with a content type: application\/json, use the following:\nhttp.addHeader(\"Content-Type\", \"application\/json\");\n\n\/\/ JSON data to send with HTTP POST\nString httpRequestData = \"{\\\"value1\\\":\\\"\" + String(random(40)) + \"\\\",\\\"value2\\\":\\\"\" + String(random(40)) + \"\\\",\\\"value3\\\":\\\"\" + String(random(40)) + \"\\\"}\";\n\n\/\/ Send HTTP POST request\nint httpResponseCode = http.POST(httpRequestData);<\/code><\/pre>\n\n\n\n<p>Here&#8217;s an example of HTTP POST request with a JSON data object. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POST \/trigger\/test_event\/with\/key\/nAZjOphL3d-ZO4N3k64-1A7gTlNSrxMJdmqy3tC HTTP\/1.1\nHost: maker.ifttt.com\n{value1: 15, value2: 11, value3: 30}\nContent-Type: application\/json<\/code><\/pre>\n\n\n\n<p>Then, the following lines of code print the HTTP response from the server.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>Serial.print(\"HTTP Response code: \");\nSerial.println(httpResponseCode);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">HTTP POST Demonstration<\/h3>\n\n\n\n<p>After uploading the code, open the Serial Monitor and you&#8217;ll see a message printing the HTTP response code 200 indicating that the request has succeeded.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"903\" height=\"589\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-POST-Arduino-IDE-Serial-Monitor-Response.png?resize=903%2C589&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 ESP8266 NodeMCU HTTP POST Arduino IDE Serial Monitor Response\" class=\"wp-image-96785\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-POST-Arduino-IDE-Serial-Monitor-Response.png?w=903&amp;quality=100&amp;strip=all&amp;ssl=1 903w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-POST-Arduino-IDE-Serial-Monitor-Response.png?resize=300%2C196&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-POST-Arduino-IDE-Serial-Monitor-Response.png?resize=768%2C501&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 903px) 100vw, 903px\" \/><\/figure>\n\n\n\n<p>Go to your email account, and you should get a new email from IFTTT with three random values. In this case: 38, 20 and 13.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"794\" height=\"395\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-POST-Arduino-IDE-IFTTT-Response.png?resize=794%2C395&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP32 ESP8266 NodeMCU HTTP POST Arduino IDE IFTTT Response\" class=\"wp-image-96784\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-POST-Arduino-IDE-IFTTT-Response.png?w=794&amp;quality=100&amp;strip=all&amp;ssl=1 794w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-POST-Arduino-IDE-IFTTT-Response.png?resize=300%2C149&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-ESP8266-NodeMCU-HTTP-POST-Arduino-IDE-IFTTT-Response.png?resize=768%2C382&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 794px) 100vw, 794px\" \/><\/figure><\/div>\n\n\n<p>For demonstration purposes, we&#8217;re publishing new data every 10 seconds. However, for a long term project you should increase the timer or check the API call limits per hour\/minute to avoid getting blocked\/banned.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>In this tutorial you&#8217;ve learned how to integrate your ESP32 with web services using HTTP POST requests. You can also make <a href=\"https:\/\/randomnerdtutorials.com\/esp32-http-get-open-weather-map-thingspeak-arduino\/\">HTTP GET requests with the ESP32<\/a>.<\/p>\n\n\n\n<p>If you&#8217;re using an ESP8266 board, read:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-http-get-open-weather-map-thingspeak-arduino\/\">Guide for ESP8266 NodeMCU HTTP GET Request<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-nodemcu-http-post-ifttt-thingspeak-arduino\/\">Guide for ESP8266 NodeMCU HTTP POST Request<\/a><\/li><\/ul>\n\n\n\n<p><strong>You might also like reading:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><a href=\"https:\/\/randomnerdtutorials.com\/learn-esp32-with-arduino-ide\/\">[Course] <\/a><\/strong><span><strong><a href=\"https:\/\/randomnerdtutorials.com\/learn-esp32-with-arduino-ide\/\">Learn ESP32 with Arduino IDE<\/a><\/strong><\/span><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-esp8266-send-email-notification\/\">ESP32\/ESP8266 Send Email Notification using PHP Script<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/visualize-esp32-esp8266-sensor-readings-from-anywhere\/\">Visualize Your Sensor Readings from Anywhere in the World<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-relay-module-ac-web-server\/\">ESP32 Relay Module Web Server<\/a><\/li><\/ul>\n\n\n\n<p>I hope you liked this project. If you have any questions, post a comment below and we&#8217;ll try to get back to you.<\/p>\n\n\n\n<p class=\"rntbox rntclgray\">If you like ESP32, you might consider enrolling in our course &#8220;<a href=\"https:\/\/randomnerdtutorials.com\/learn-esp32-with-arduino-ide\/\">Learn ESP32 with Arduino IDE<\/a>&#8220;. You can also access our free <a href=\"https:\/\/randomnerdtutorials.com\/projects-esp32\/\">ESP32 resources here<\/a>. <\/p>\n\n\n\n<p>Thank you for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, you&#8217;ll learn how to make HTTP POST requests using the ESP32 board with Arduino IDE. We&#8217;ll demonstrate how to post JSON data or URL encoded values to &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP32 HTTP POST with Arduino IDE (ThingSpeak and IFTTT.com)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/esp32-http-post-ifttt-thingspeak-arduino\/#more-96830\" aria-label=\"Read more about ESP32 HTTP POST with Arduino IDE (ThingSpeak and IFTTT.com)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":96787,"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":[281,276,277,299,264],"tags":[],"class_list":["post-96830","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp32-project","category-esp32","category-esp32-arduino-ide","category-0-esp32","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/05\/ESP32-HTTP-POST-with-Arduino-IDE-IFTTT-ThingSpeak.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\/96830","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=96830"}],"version-history":[{"count":2,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/96830\/revisions"}],"predecessor-version":[{"id":120189,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/96830\/revisions\/120189"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/96787"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=96830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=96830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=96830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}