{"id":3807,"date":"2025-06-27T15:03:53","date_gmt":"2025-06-27T15:03:53","guid":{"rendered":"https:\/\/iotthinghub.com\/?p=3807"},"modified":"2025-06-27T15:40:18","modified_gmt":"2025-06-27T15:40:18","slug":"iot-whatsapp-notification-method-2-callmebot","status":"publish","type":"post","link":"https:\/\/iotthinghub.com\/?p=3807","title":{"rendered":"IoT: Whatsapp Notification Method 2: CallMeBoT"},"content":{"rendered":"\n<p class=\"has-text-color has-link-color wp-elements-82b380c4f3855084de0b93606b64f680 wp-block-paragraph\" style=\"color:#5c5c5c\">In our previous Article we communicate with whatsAPP through WhatABoT medium. In this article we introduce another medium CallMeBoT. It has very simple &amp; powerful feature for whatsAPP notification. One drawback is that it doesn\u2019t received msg &amp; it is used only for notify. In this project we use DHT11 sensor to read Temperature &amp; Humidity through GPIO2 pin of ESP01 &amp; if temperature above 25 \u00b0C GPIO0 pin will on to trigger an alarm. CallMeBoT will display data every 2 minutes. First go to the following website &amp; process the step for registration-<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-callmebot-api wp-block-embed-callmebot-api\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"f9t2k9fkzm\"><a href=\"https:\/\/www.callmebot.com\/blog\/free-api-whatsapp-messages\/\">Free API to Send Whatsapp Messages<\/a><\/blockquote><iframe class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;Free API to Send Whatsapp Messages&#8221; &#8212; CallMeBot API\" src=\"https:\/\/www.callmebot.com\/blog\/free-api-whatsapp-messages\/embed\/#?secret=f9t2k9fkzm\" data-secret=\"f9t2k9fkzm\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><figcaption class=\"wp-element-caption\"><a href=\"https:\/\/www.callmebot.com\/blog\/free-api-whatsapp-messages\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.callmebot.com\/blog\/free-api-whatsapp-messages\/<\/a><\/figcaption><\/figure>\n\n\n\n<ol style=\"color:#252525\" class=\"wp-block-list has-text-color has-link-color wp-elements-a5eabb48b41c724c55236a73361599f1\">\n<li>Add the phone number +34 644 87 21 57 into your Phone Contacts. (Name it it as you wish)<\/li>\n\n\n\n<li>Send this message &#8220;I allow callmebot to send me messages&#8221; to the new Contact created (using WhatsApp of course)<\/li>\n\n\n\n<li class=\"has-text-color has-link-color wp-elements-4927d829a7a734aaf73b52a54988c725\" style=\"color:#252525\">Wait until you receive the message &#8220;API Activated for your phone number. Your APIKEY is 123123&#8221; from the bot.<br>Note: If you don&#8217;t receive the ApiKey in 2 minutes, please try again after 24hs. The WhatsApp message from the bot will contain the apikey needed to send messages using the API.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"338\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/06\/CallMeBoT-1024x338.jpg\" alt=\"\" class=\"wp-image-3821\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/06\/CallMeBoT-1024x338.jpg 1024w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/06\/CallMeBoT-300x99.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/06\/CallMeBoT-768x253.jpg 768w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/06\/CallMeBoT.jpg 1497w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-bd514683224748d238803a8dc873f769 wp-block-paragraph\" style=\"color:#5c5c5c\">After successful registration you can send msg using GET mothod. Since it is a get method you can use either browser or POSTMAN application for testing. Format with Example-<\/p>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-70c477bea6bef66e30cc66f3f16dd539 wp-block-paragraph\" style=\"color:#252525\"><a href=\"https:\/\/api.callmebot.com\/whatsapp.php?phone=[phone_number]&amp;text=[message]&amp;apikey=[your_apikey]\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/api.callmebot.com\/whatsapp.php?phone=[phone_number]&amp;text=[message]&amp;apikey=[your_apikey]<\/a><\/p>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-6f516526ed1ea6f05b08706afcc48e95 wp-block-paragraph\" style=\"color:#252525\">https:\/\/api.callmebot.com\/whatsapp.php?phone=880XXXXXXXXXX&amp;text=&#8221;This is a test Data&#8221;&amp;apikey=XXXXXXX<\/p>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-978fc943d97336f30e2807d796778140 wp-block-paragraph\" style=\"color:#5c5c5c\">Here you have to enter your full SIM number without + sign. Since I live in Bangladesh, so I use 880 as my country code, India 91, Pakistan 92, Nepal 977 , Sri Lanka 94, USA 1 , UAE 971 etc. Remember CallMeBoT phone number +34 644 87 21 57 need to save with + sign, otherwise BOT will not active.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Lets look at the Conection Diagram-<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"892\" height=\"477\" src=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/06\/Connection-Whatsapp.jpg\" alt=\"\" class=\"wp-image-3779\" srcset=\"https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/06\/Connection-Whatsapp.jpg 892w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/06\/Connection-Whatsapp-300x160.jpg 300w, https:\/\/iotthinghub.com\/wp-content\/uploads\/2025\/06\/Connection-Whatsapp-768x411.jpg 768w\" sizes=\"(max-width: 892px) 100vw, 892px\" \/><\/figure>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-30d1c84179e923dac9f849fa4cff3b25 wp-block-paragraph\" style=\"color:#5c5c5c\">Now it times to download some driver for our project. Let\u2019s begin with some settings-&nbsp;<\/p>\n\n\n\n<ul style=\"color:#252525\" class=\"wp-block-list has-text-color has-link-color wp-elements-20e485eefee5e2ef063e2701d40f3045\">\n<li>Install the latest version of Arduino : <a href=\"https:\/\/www.arduino.cc\/en\/software\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.arduino.cc\/en\/software\/<\/a><\/li>\n\n\n\n<li>In Arduino: File>Preferences>Setting : <a href=\"http:\/\/arduino.esp8266.com\/stable\/package_esp8266com_index.json\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/arduino.esp8266.com\/stable\/package_esp8266com_index.json<\/a><\/li>\n\n\n\n<li>In Arduino Install: Tools>Board>esp8266<\/li>\n\n\n\n<li>In Arduino: Tools>Board>esp8266>Generic ESP8266 Module<\/li>\n\n\n\n<li>In Arduino Install: Library Manager > DHT sensor library<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-190a540301d2f678548d45ea0d6d28e5 wp-block-paragraph\" style=\"color:#5c5c5c\">Here interesting that the data must transmit through URL encoding method. URL encoding transforms characters that are not safe or have special meaning in URLs into a format that can be transmitted reliably across the internet. URL encoding, also known as percent-encoding, is a mechanism used to encode special characters in URLs so that they can be safely transmitted over the internet. Since URLs can only be sent over the Internet using the ASCII character set, characters outside this set or characters with special meanings (like spaces, punctuation, or non-ASCII characters) need to be encoded. Special characters are replaced with a percent sign (&#8220;%&#8221;) followed by two hexadecimal digits representing the character&#8217;s ASCII value.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-84857b2ece393da3f4e3c3e3064da90b wp-block-paragraph\" style=\"color:#5c5c5c\">For example:<\/p>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-f1b85e15a0e64f65a5e5d5c954e89a16 wp-block-paragraph\" style=\"color:#5c5c5c\">Space (&#8221; &#8220;) becomes &#8220;%20&#8221; &#8220;@&#8221; becomes &#8220;%40&#8221; &#8220;\/&#8221; becomes &#8220;%2F&#8221; &#8220;&amp;&#8221; becomes &#8220;%26&#8221; etc.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-5243e01b8df842d2827003072725bb4d wp-block-paragraph\" style=\"color:#5c5c5c\">Example: &gt; Original string:<\/p>\n\n\n\n<p class=\"has-text-align-center has-text-color has-link-color wp-elements-55233efb226634b3f187ac8c4e8c4d04 wp-block-paragraph\" style=\"color:#252525\">Hello World! &amp; Welcome to IoTthingHuB.<\/p>\n\n\n\n<p class=\"has-text-align-center has-text-color has-link-color wp-elements-49dd41e159902ca2a481cb5b9dccf2a3 wp-block-paragraph\" style=\"color:#252525\">URL-encoded: Hello%20World%21%20%26%20Welcome%20to%20 IoTthingHuB.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color wp-elements-2cc451e5b7a71a9fe00c9fe8b3dfd60c wp-block-paragraph\" style=\"color:#5c5c5c\">Example a simple C code for converting URL Encode-<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; auto-links: false; title: ; quick-code: false; notranslate\" title=\"\">\n#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n#include &lt;string.h&gt;\n#include &lt;ctype.h&gt;\n\n\/\/ Function to convert a single character to its percent-encoded form\nvoid url_encode_char(char c, char *output) {\n    sprintf(output, &quot;%%%02X&quot;, (unsigned char)c);\n}\n\n\/\/ Function to determine if a character is safe (unreserved) in URL\nint is_unreserved_char(char c) {\n    if (isalnum(c) || c == &#039;-&#039; || c == &#039;_&#039; || c == &#039;.&#039; || c == &#039;~&#039;) {\n        return 1;\n    }\n    return 0;\n}\n\n\/\/ Function to URL-encode a string\nchar *url_encode(const char *str) {\n    size_t len = strlen(str);\n    \/\/ Allocate enough space: worst case all characters need encoding (3 chars each)\n    size_t max_encoded_len = len * 3 + 1;\n    char *encoded = malloc(max_encoded_len);\n    if (encoded == NULL) {\n        printf(&quot;Memory allocation failed.\\n&quot;);\n        exit(1);\n    }\n\n    char *p = encoded;\n\n    for (size_t i = 0; i &lt; len; i++) {\n        char c = str&#x5B;i];\n        if (is_unreserved_char(c)) {\n            *p++ = c;  \/\/ Safe character, copy as is\n        } else {\n            \/\/ Encode character\n            sprintf(p, &quot;%%%02X&quot;, (unsigned char)c);\n            p += 3;\n        }\n    }\n    *p = &#039;\\0&#039;; \/\/ Null-terminate the string\n    return encoded;\n}\n\nint main() {\n    const char *original = &quot;Hello World! &amp; Welcome to IoTthingHuB.&quot;;\n    char *encoded = url_encode(original);\n\n    printf(&quot;Original: %s\\n&quot;, original);\n    printf(&quot;URL Encoded: %s\\n&quot;, encoded);\n\n    free(encoded);\n    return 0;\n}\n<\/pre><\/div>\n\n\n<p class=\"has-text-color has-link-color wp-elements-b8c7cfc18f91023a75e710666278a8bb wp-block-paragraph\" style=\"color:#5c5c5c\">Run on C platform &amp; you will see the output or you can use a browser : <a href=\"https:\/\/www.programiz.com\/c-programming\/online-compiler\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.programiz.com\/c-programming\/online-compiler\/<\/a> &amp; paste the program. For reading Temperature &amp; Humidity from DHT11 as-<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: arduino; auto-links: false; title: ; quick-code: false; notranslate\" title=\"\">\n#include &lt;DHT.h&gt;\n\/\/ DHT11 Configuration\n#define DHTPIN 2             \/\/ GPIO2 for DHT11 Sensor\n#define DHTTYPE DHT11\nDHT dht(DHTPIN, DHTTYPE);\n\ndht.begin();\n\n  float temperature = dht.readTemperature();\n  float humidity = dht.readHumidity();\n\n  if (isnan(temperature) || isnan(humidity)) {\n    Serial.println(&quot;Failed to read from DHT sensor!&quot;);\n    return;\n  }\n<\/pre><\/div>\n\n\n<p class=\"has-text-color has-link-color wp-elements-ddb2259357ae873608b8b7c77bb5039f wp-block-paragraph\" style=\"color:#5c5c5c\">For transfer data to WhatsAPP it shows HTTPS protocol with port 80, so we just use HTTP protocol &amp; the browser address with http not https. Example to send data to WhatsAPP-<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: arduino; auto-links: false; title: ; quick-code: false; notranslate\" title=\"\">\n\/\/ WiFi Credentials\nconst char* ssid =  &quot;Your_WiFi_Name&quot; ;        \/\/ Your WiFi Name\nconst char* password = &quot;Your_WiFi_Password&quot;;  \/\/ Your WiFi Password\n\n\/\/ CallMeBot API\nString phoneNumber = &quot;880xxxxxxxxxx&quot;;         \/\/ Your full WhatsApp number with country code ignore + sign\nString apiKey = &quot;xxxxxxx&quot;;                    \/\/ Your API Key\n\nWiFiClient client;\nHTTPClient http;\n\nSerial.begin(115200);\n  WiFi.begin(ssid, password);\n\n  Serial.print(&quot;Connecting to WiFi&quot;);\n  while (WiFi.status() != WL_CONNECTED) {\n    delay(500);\n    Serial.print(&quot;.&quot;);\n  }\n  Serial.println(&quot;\\nWiFi connected&quot;);\n\nString message = &quot;\ud83c\udf21 Temp: &quot; + String(temperature, 2) + &quot;\u00b0C \\r\\n \ud83d\udca7 Humidity: &quot; + String(humidity, 2) + &quot;%&quot;;\n\n  Serial.println(&quot;Sending to WhatsApp: &quot; + message);\n  String WhatsAppmsg = url_encode (message);    \/\/ From the C Function\n\n  if (WiFi.status() == WL_CONNECTED) {\n    String url = &quot;http:\/\/api.callmebot.com\/whatsapp.php?phone=&quot; + phoneNumber +\n                 &quot;&amp;text=&quot; + WhatsAppmsg + \n                 &quot;&amp;apikey=&quot; + apiKey;\n\n    http.begin(client, url);\n    int httpCode = http.GET();\n\n    if (httpCode &gt; 0) {\n      Serial.println(&quot;Message sent successfully.&quot;);\n    } else {\n      Serial.print(&quot;Error sending message: &quot;);\n      Serial.println(http.errorToString(httpCode).c_str());\n    }\n    http.end();\n<\/pre><\/div>\n\n\n<p class=\"has-text-color has-link-color wp-elements-abb67837528a76e094b019a399eea38e wp-block-paragraph\" style=\"color:#5c5c5c\">One important thing that every time you call HTTP GET method you have to terminate with HTTP END method. If the connection not closed it will not transmit next msg.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"ESP01(8 pin Smart MCU):  \u2706 Whatsapp Notification Method 2: CallMeBoT + \ud83d\udcf1 Notification\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/ZA7tgbLPRCw?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>In our previous Article we communicate with whatsAPP through WhatABoT medium. In this article we introduce another medium CallMeBoT. It has very simple &amp; powerful feature for whatsAPP notification. One drawback is that it doesn\u2019t received msg &amp; it is used only for notify. In this project we use DHT11 sensor to read Temperature &amp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-3807","post","type-post","status-publish","format-standard","hentry","category-esp01esp8266"],"_links":{"self":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts\/3807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3807"}],"version-history":[{"count":22,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts\/3807\/revisions"}],"predecessor-version":[{"id":3844,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=\/wp\/v2\/posts\/3807\/revisions\/3844"}],"wp:attachment":[{"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iotthinghub.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}