<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: WhatsApp API for developers</title>
    <description>The latest articles on Forem by WhatsApp API for developers (@whapicloud).</description>
    <link>https://forem.com/whapicloud</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1171150%2Fa2054cbb-a7f4-43db-bbe7-d061e8e63f51.png</url>
      <title>Forem: WhatsApp API for developers</title>
      <link>https://forem.com/whapicloud</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/whapicloud"/>
    <language>en</language>
    <item>
      <title>Building WhatsApp Automation with n8n Cloud: Complete Integration Guide</title>
      <dc:creator>WhatsApp API for developers</dc:creator>
      <pubDate>Wed, 03 Sep 2025 09:46:38 +0000</pubDate>
      <link>https://forem.com/whapicloud/building-whatsapp-automation-with-n8n-cloud-complete-integration-guide-52fb</link>
      <guid>https://forem.com/whapicloud/building-whatsapp-automation-with-n8n-cloud-complete-integration-guide-52fb</guid>
      <description>&lt;p&gt;Learn how to integrate &lt;a href="https://whapi.cloud/n8n-whatsapp-integration" rel="noopener noreferrer"&gt;Whapi.Cloud with n8n Cloud&lt;/a&gt; using HTTP requests to build powerful WhatsApp automation workflows. This comprehensive guide covers everything from receiving webhooks and sending messages to creating groups, managing channels, and building community engagement tools directly from your n8n Cloud workflows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This guide focuses on integrating Whapi.Cloud via HTTP requests in &lt;strong&gt;n8n Cloud&lt;/strong&gt;. If you're using &lt;strong&gt;Self-Hosted n8n&lt;/strong&gt;, we offer a dedicated custom module for seamless integration. Learn more here → &lt;a href="https://support.whapi.cloud/help-desk/integrations/custom-node-for-n8n" rel="noopener noreferrer"&gt;Custom Node for n8n&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/XJd41xmXoJM"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;




&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;To follow this guide, you'll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An active &lt;strong&gt;Whapi.Cloud&lt;/strong&gt; account and your channel's &lt;strong&gt;API Token&lt;/strong&gt; (available in your &lt;a href="https://panel.whapi.cloud/dashboard" rel="noopener noreferrer"&gt;Whapi.Cloud dashboard&lt;/a&gt;). For detailed token setup instructions, refer to: &lt;a href="https://support.whapi.cloud/help-desk" rel="noopener noreferrer"&gt;Getting Started&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;An active &lt;strong&gt;n8n Cloud&lt;/strong&gt; account with workflow creation permissions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ensure both accounts are properly configured before proceeding.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Setting up Webhook in n8n
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;In your n8n Cloud workflow, add a new &lt;strong&gt;Webhook&lt;/strong&gt; node.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnf4fu17ehtfjqjmmicng.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnf4fu17ehtfjqjmmicng.png" alt="Setting up Webhook in n8n"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Configure the node by selecting &lt;strong&gt;POST&lt;/strong&gt; as the HTTP method. Copy the generated Webhook URL provided by n8n.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fptfzmp29td55naxumj9q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fptfzmp29td55naxumj9q.png" alt="Simple webhook configuration in n8n"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to your Whapi.Cloud channel settings and paste the copied URL into the webhook URL field. Enable the events you wish to receive (e.g., incoming messages, group updates, channel activities).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsukqf5th4mtt55xkg0rj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsukqf5th4mtt55xkg0rj.png" alt="Set specific events in the webhook settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your Whapi.Cloud events (new messages, group interactions, community updates) will now trigger this Webhook node in n8n.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Receiving Messages in n8n
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Ensure your Webhook node in n8n is active and configured for &lt;strong&gt;POST&lt;/strong&gt; requests.&lt;/li&gt;
&lt;li&gt;Send a test message to your connected WhatsApp number.&lt;/li&gt;
&lt;li&gt;The Webhook node in n8n will capture the incoming message instantly.&lt;/li&gt;
&lt;li&gt;Inspect the received JSON payload to understand its structure for further workflow automation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxv9nx95brimt4zbkzvnq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxv9nx95brimt4zbkzvnq.png" alt="Example JSON payload"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example JSON payload&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can view all examples of incoming callbacks here: &lt;a href="https://support.whapi.cloud/help-desk/receiving/webhooks/incoming-webhooks-format" rel="noopener noreferrer"&gt;Incoming webhooks format&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example JSON payload:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"messages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"p.w30M7fgwWD4XwHu.g4CA-gBgTwl0rVw"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"from_me"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Please&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;note&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;this&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;parameter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;which&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;allows&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;you&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;understand&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;whether&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;message&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;incoming&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;or&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;outgoing.&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;In&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;future&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;we&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;will&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;filter&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;webhooks&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;based&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;on&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;this&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;parameter.&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"chat_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"919984351847@s.whatsapp.net"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1712995245&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mobile"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hello world"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"from"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"919984351847"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"from_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Gerald"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"event"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"messages"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"event"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"post"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"channel_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"MANTIS-M72HC"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Sending Messages from n8n
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Add an &lt;strong&gt;HTTP Request&lt;/strong&gt; node to your n8n workflow.
To do this, select Core, then HTTP Request.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fee3rqkhzivtsonph60pi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fee3rqkhzivtsonph60pi.png" alt="Add an HTTP Request node"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Configure the HTTP Request node as follows:
You will need to use the correct request configuration from the Whapi.Cloud documentation. Examples and convenient documentation with examples can be found here: &lt;a href="https://whapi.readme.io/reference/sendmessagetext" rel="noopener noreferrer"&gt;API Docs&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTTP Method:&lt;/strong&gt; &lt;code&gt;POST&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;URL:&lt;/strong&gt; &lt;code&gt;https://gate.whapi.cloud/messages/text&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Information for the request can be easily obtained from our docs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg4d0amczrj2sicmds0an.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg4d0amczrj2sicmds0an.png" alt="Information for the request can be easily obtained from our docs"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Authentication:&lt;/strong&gt;&lt;br&gt;
To authorize, you will need to select &lt;strong&gt;Bearer Auth&lt;/strong&gt; in the Credential Type field. After that, enter and save your channel token from Whapi.Cloud.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the &lt;strong&gt;Body&lt;/strong&gt; section, select &lt;strong&gt;RAW / JSON&lt;/strong&gt; and enter:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"to"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"recipient_number"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"body"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hello from n8n and Whapi.Cloud!"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;"recipient_number"&lt;/code&gt; with the recipient's WhatsApp number (international format, no &lt;code&gt;+&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frn5fktbbdsuu3oiesova.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frn5fktbbdsuu3oiesova.png" alt="Parameters for sending a message in WhatsApp"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can specify either the recipient's number in international format or the chat ID. It doesn't matter which one you use. For more information about what a chat ID is, see: &lt;a href="https://support.whapi.cloud/help-desk/faq/chat-id.-what-is-it-and-how-to-get-it" rel="noopener noreferrer"&gt;Chat ID. What is it and how to get it?&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Building a WhatsApp Bot with Message Filtering
&lt;/h2&gt;

&lt;p&gt;So far, we've covered the basic setup of connecting the WhatsApp API to n8n, allowing you to receive incoming messages and send messages to any number — including groups, channels, and community members.&lt;/p&gt;

&lt;p&gt;Now let's explore a common use case: building an automated bot in WhatsApp. In this scenario, you typically want the bot to respond only to &lt;strong&gt;incoming&lt;/strong&gt; messages, and ignore outgoing ones to avoid loops.&lt;/p&gt;

&lt;p&gt;To achieve this, you'll need to filter incoming webhooks. Let's add a &lt;strong&gt;Filter&lt;/strong&gt; node to your workflow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkfcuzin7d85hkcq0oawp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkfcuzin7d85hkcq0oawp.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your goal is to distinguish incoming messages from outgoing ones. This can be done by checking the &lt;code&gt;from_me&lt;/code&gt; parameter in the webhook payload:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;from_me = true&lt;/code&gt; → the message was sent &lt;strong&gt;by you&lt;/strong&gt; (outgoing)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;from_me = false&lt;/code&gt; → the message was received &lt;strong&gt;from the user&lt;/strong&gt; (incoming)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzm9j8f0g4lfxb50dozdj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzm9j8f0g4lfxb50dozdj.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By filtering for &lt;code&gt;from_me = false&lt;/code&gt;, your bot will respond only to actual user messages and won't react to its own replies. Make sure to set the data type to &lt;strong&gt;Boolean&lt;/strong&gt; when configuring the filter, as shown in the example below.&lt;/p&gt;




&lt;h2&gt;
  
  
  Creating WhatsApp Groups and Managing Communities via n8n
&lt;/h2&gt;

&lt;p&gt;Now let's walk through how to create a new WhatsApp group and send a message to it - along the way, we'll highlight a few important details for community management.&lt;/p&gt;

&lt;p&gt;To create a group, use the &lt;strong&gt;Create Group&lt;/strong&gt; endpoint. You can find the full documentation here: 👉 &lt;a href="https://whapi.readme.io/reference/creategroup" rel="noopener noreferrer"&gt;https://whapi.readme.io/reference/creategroup&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In n8n, add an &lt;strong&gt;HTTP Request&lt;/strong&gt; node:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set the method to &lt;strong&gt;POST&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;URL: &lt;code&gt;https://gate.whapi.cloud/groups&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add your channel's &lt;strong&gt;Authorization Bearer Token&lt;/strong&gt; to the headers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now let's review the required parameters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;subject&lt;/code&gt;: the name of the group&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;participants&lt;/code&gt;: an array of phone numbers (as strings) to be added to the group during creation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The easiest way to pass the participants array is by selecting &lt;strong&gt;"Specify Body → Using JSON"&lt;/strong&gt; in the HTTP node. This allows you to enter the full JSON payload directly in the body. (There is also a more advanced method using a Set node to build the array dynamically, but we won't cover that here.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3e6pdika6k0z6zi6kst9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3e6pdika6k0z6zi6kst9.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can copy a ready-to-use JSON body directly from our documentation: &lt;a href="https://whapi.readme.io/reference/creategroup" rel="noopener noreferrer"&gt;https://whapi.readme.io/reference/creategroup&lt;/a&gt;. This helps avoid issues with extra line breaks or formatting.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flb387uy0nynqrf0p9z37.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flb387uy0nynqrf0p9z37.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After sending the request, the response will include full details of the newly created group. Make sure to &lt;strong&gt;save the&lt;/strong&gt; &lt;code&gt;**group_id**&lt;/code&gt;, as you'll need it later in the &lt;code&gt;to&lt;/code&gt; parameter when sending messages to the group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8dmo8swpc0rwhu2ej2bg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8dmo8swpc0rwhu2ej2bg.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also note the optional field &lt;code&gt;unprocessed_participants&lt;/code&gt;. This indicates which numbers could not be added to the group. To understand why this may happen and how to avoid it, see our guide: &lt;a href="https://support.whapi.cloud/help-desk/faq/why-arent-participants-being-added-to-the-group" rel="noopener noreferrer"&gt;Why aren't participants being added to the group?&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Unlock advanced WhatsApp features in n8n
&lt;/h2&gt;

&lt;p&gt;With Whapi.Cloud and n8n, you can extend your automation to include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Group Management&lt;/strong&gt;: Add/remove participants, update group settings, manage admin roles&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Channel Operations&lt;/strong&gt;: Create and manage WhatsApp channels for broadcasting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community Engagement&lt;/strong&gt;: Automate responses, schedule announcements, and manage member interactions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analytics Integration&lt;/strong&gt;: Track message delivery, engagement rates, and community growth&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Need help getting started? We will tell you exactly how to create the scenario you need or help you find a mistake. Our support team is always here to assist you: &lt;a href="https://whapi.cloud/n8n-whatsapp-integration" rel="noopener noreferrer"&gt;https://whapi.cloud/n8n-whatsapp-integration&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>learning</category>
      <category>tooling</category>
    </item>
    <item>
      <title>Optimize your WhatsApp bot development with WhatsApp API PHP SDK</title>
      <dc:creator>WhatsApp API for developers</dc:creator>
      <pubDate>Mon, 23 Dec 2024 07:31:46 +0000</pubDate>
      <link>https://forem.com/whapicloud/optimize-your-whatsapp-bot-development-with-whatsapp-api-php-sdk-5233</link>
      <guid>https://forem.com/whapicloud/optimize-your-whatsapp-bot-development-with-whatsapp-api-php-sdk-5233</guid>
      <description>&lt;h1&gt;
  
  
  Unlock the Power of WhatsApp API with the PHP SDK from Whapi.Cloud
&lt;/h1&gt;

&lt;p&gt;Streamline your &lt;a href="https://whapi.cloud/create-whatsapp-chatbot" rel="noopener noreferrer"&gt;WhatsApp bot&lt;/a&gt; development with the &lt;strong&gt;Whapi.Cloud PHP SDK&lt;/strong&gt;, a comprehensive toolkit designed to simplify integration and automate messaging workflows. Whether you’re sending messages, managing groups, or creating advanced customer interactions, this SDK empowers developers to build robust, scalable solutions with ease.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Choose the Whapi.Cloud PHP SDK?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No Number Migration Required&lt;/strong&gt;: Use your existing number without the need to migrate.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple Integration&lt;/strong&gt;: Connect any number via QR code for quick testing.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Effortless Webhook Setup&lt;/strong&gt;: Configure webhooks for real-time messaging with just a few clicks.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive Functionality&lt;/strong&gt;: Send and receive text, media, files, locations, polls, and more across personal and group chats.
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Obtain Your API Token
&lt;/h3&gt;

&lt;p&gt;Register and log in to your &lt;a href="https://panel.whapi.cloud/register" rel="noopener noreferrer"&gt;Whapi.Cloud Dashboard&lt;/a&gt; to authorize your number and generate an API token. This token will serve as the key to unlocking the SDK’s capabilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Download the SDK
&lt;/h3&gt;

&lt;p&gt;Access the PHP SDK directly from the official GitHub repository: &lt;a href="https://github.com/Whapi-Cloud/whatsapp-api-sdk-php" rel="noopener noreferrer"&gt;Download Here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Install the SDK
&lt;/h3&gt;

&lt;p&gt;Install the SDK using Composer for easy dependency management:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer require whapi-cloud/whatsapp-api-sdk-php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Setting Up Your Integration
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Initialize the Client
&lt;/h3&gt;

&lt;p&gt;To authenticate your API requests, initialize the client with your API token.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use OpenAPI\Client\Api\MessagesApi;
use OpenAPI\Client\Configuration;

// Initialize the client
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()
    -&amp;gt;setApiKey('token', "your_token")
    -&amp;gt;setAccessToken("your_token");

$apiInstance = new OpenAPI\Client\Api\MessagesApi(
    new GuzzleHttp\Client(),
    $config
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Messaging API: Key Features and Examples
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Sending Text Messages
&lt;/h3&gt;

&lt;p&gt;Effortlessly send text messages using the API. You can also include optional settings like typing simulation or ephemeral visibility.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$sender_text = new \OpenAPI\Client\Model\SenderText();
$sender_text-&amp;gt;setTo('13016789891'); // Include country code
$sender_text-&amp;gt;setBody('Your message here'); // Message content
$sender_text-&amp;gt;setEphemeral(3600); // Message visibility time
$sender_text-&amp;gt;setTypingTime(5.0); // Typing simulation duration

$result = $apiInstance-&amp;gt;sendMessageText($sender_text);
print_r($result);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Retrieving Messages with Webhooks
&lt;/h2&gt;

&lt;p&gt;Webhooks provide real-time updates for incoming messages, ensuring your bot stays up-to-date.&lt;/p&gt;
&lt;h3&gt;
  
  
  Retrieve Multiple Messages
&lt;/h3&gt;

&lt;p&gt;Use the following example to retrieve a batch of messages.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$count = 100;
$offset = 0;
$result = $apiInstance-&amp;gt;getMessages($count, $offset);
print_r($result);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Retrieve a Single Message
&lt;/h3&gt;

&lt;p&gt;To fetch a specific message by its ID, use this example:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$message_id = "your_message_id";
$result = $apiInstance-&amp;gt;getMessage($message_id);
print_r($result);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For detailed webhook setup instructions, check the &lt;a href="https://support.whapi.cloud/help-desk/receiving/webhooks/where-to-find-the-webhook-url" rel="noopener noreferrer"&gt;Webhook Guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  WhatsApp Groups API: Automate Group Management
&lt;/h2&gt;

&lt;p&gt;Simplify and streamline the management of WhatsApp groups with Whapi.Cloud's Groups API. These features empower you to automate tasks, saving time and reducing manual effort.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features for Group Management
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Create, Update, or Delete Groups&lt;/strong&gt;: Programmatically manage your WhatsApp groups with ease.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Participant Management&lt;/strong&gt;: Add, remove, or block members as required.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom Group Settings&lt;/strong&gt;: Adjust group names, avatars, and permissions effortlessly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generate Invitation Links&lt;/strong&gt;: Quickly create and share group invite links for seamless onboarding.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example: Creating a Group
&lt;/h3&gt;

&lt;p&gt;Below is a practical example of how to create a new WhatsApp group using the API.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$create_group_request = [&lt;br&gt;
    "subject" =&amp;gt; "Group Name",&lt;br&gt;
    "participants" =&amp;gt; [&lt;br&gt;
        "13016789891",&lt;br&gt;
        "13016789892"&lt;br&gt;
    ]&lt;br&gt;
];

&lt;p&gt;$result = $apiInstance-&amp;gt;createGroup($create_group_request);&lt;br&gt;
print_r($result);&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Best Practices and Important Notes&lt;br&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Working with Phone Numbers
&lt;/h3&gt;

&lt;p&gt;When using the Whapi.Cloud API, follow these best practices for handling phone numbers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Always include the country code&lt;/strong&gt;: For example, use '13016789891' for a US number.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Avoid special characters and spaces&lt;/strong&gt;: Numbers should be entered as a continuous string of digits.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Media Requirements
&lt;/h3&gt;

&lt;p&gt;Ensure your media files meet the following criteria to guarantee smooth delivery:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Publicly Accessible URLs&lt;/strong&gt;: All media files must be hosted at a URL that is accessible without authentication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Supported Formats&lt;/strong&gt;: Common image formats such as JPEG and PNG are supported, along with other standard file types.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Optimizing Messaging
&lt;/h3&gt;

&lt;p&gt;For a more engaging and user-friendly experience, use these options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ephemeral Messages&lt;/strong&gt;: Set messages to disappear after a specific time for added privacy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Typing Simulation&lt;/strong&gt;: Simulate typing indicators to provide a more natural, human-like interaction.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Why Choose Whapi.Cloud?
&lt;/h2&gt;

&lt;p&gt;Whapi.Cloud offers a robust and user-friendly WhatsApp API gateway, designed to make integration simple and efficient for developers. Here’s why it stands out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive Group Management&lt;/strong&gt;: Easily create, manage, and automate WhatsApp groups, communities, and channels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interactive Messaging Features&lt;/strong&gt;: Add dynamic elements such as buttons, media sharing, polls, and reactions to enhance communication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reliable Support&lt;/strong&gt;: Access fast and knowledgeable assistance from our dedicated care team to ensure your development process runs smoothly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whapi.Cloud’s transparency, flexibility, and robust documentation make it an ideal solution for scaling your WhatsApp operations while maintaining control and efficiency.&lt;/p&gt;




&lt;h2&gt;
  
  
  Get Started Today
&lt;/h2&gt;

&lt;p&gt;Take the first step toward powerful WhatsApp automation with the &lt;strong&gt;Whapi.Cloud PHP SDK&lt;/strong&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Links to Get Started:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Register for your API token&lt;/strong&gt;: &lt;a href="https://panel.whapi.cloud/register" rel="noopener noreferrer"&gt;Whapi.Cloud Dashboard&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Download the PHP SDK&lt;/strong&gt;: &lt;a href="https://github.com/Whapi-Cloud/whatsapp-api-sdk-php" rel="noopener noreferrer"&gt;GitHub Repository&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Streamline your WhatsApp bot development and start building interactive solutions today. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://panel.whapi.cloud/register" rel="noopener noreferrer"&gt;Begin your journey with Whapi.Cloud now!&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>api</category>
      <category>whatsapp</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Building Your First WhatsApp Bot in Python: A Beginner’s Guide</title>
      <dc:creator>WhatsApp API for developers</dc:creator>
      <pubDate>Tue, 26 Nov 2024 10:10:50 +0000</pubDate>
      <link>https://forem.com/whapicloud/building-your-first-whatsapp-bot-in-python-a-beginners-guide-41lf</link>
      <guid>https://forem.com/whapicloud/building-your-first-whatsapp-bot-in-python-a-beginners-guide-41lf</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Creating a WhatsApp bot might initially feel overwhelming, but with clear instructions, it transforms into an accessible and manageable project. For Python developers new to API integrations, this guide simplifies the process, offering step-by-step instructions for building a basic WhatsApp bot. You'll learn everything from obtaining an API token to setting up webhooks for automated responses.&lt;/p&gt;

&lt;p&gt;This tutorial serves as &lt;strong&gt;a beginner-friendly starting point&lt;/strong&gt;, making it an excellent resource for developers looking to explore WhatsApp API capabilities and lay the groundwork for building more advanced chatbot solutions in the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features of This WhatsApp Bot
&lt;/h2&gt;

&lt;p&gt;This basic bot showcases how to handle incoming messages by responding with predefined text or media, such as images, depending on the message's content. It’s a valuable learning tool for developers eager to understand the fundamentals of API interactions and automated messaging workflows.&lt;/p&gt;

&lt;p&gt;A standout feature of this bot is its ability to function effortlessly within &lt;strong&gt;WhatsApp Groups&lt;/strong&gt; and Communities, making it an effective solution for automating interactions and enhancing productivity within the messenger.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/GhsRJBXztoc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before you begin, ensure you have the following:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Obtain Your API Token
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://panel.whapi.cloud/register" rel="noopener noreferrer"&gt;Register on Whapi.Cloud&lt;/a&gt;. This platform provides an easy-to-use API gateway compatible with Python and other programming languages, enabling you to connect your app, website, or CRM with WhatsApp. That said, this system works with &lt;strong&gt;Groups, Channels, Statuses&lt;/strong&gt;, and more.&lt;/li&gt;
&lt;li&gt;Retrieve your API token by following &lt;a href="https://support.whapi.cloud/help-desk/getting-started/getting-started#pair-your-number" rel="noopener noreferrer"&gt;the detailed instructions&lt;/a&gt; provided in Whapi.Cloud’s documentation.&lt;/li&gt;
&lt;li&gt;Download the source code for the bot from GitHub: &lt;a href="https://github.com/Whapi-Cloud/whatsapp-simple-bot-python" rel="noopener noreferrer"&gt;[GitHub Repository]&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Save the token in a &lt;code&gt;.env&lt;/code&gt; file for secure access within your bot script.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  2. Set Up Your Webhook URL
&lt;/h3&gt;

&lt;p&gt;A webhook is a mechanism that allows one application to deliver real-time information to another. In the case of this WhatsApp bot, the webhook URL acts as the endpoint where WhatsApp forwards incoming messages, enabling your bot to process and respond accordingly.&lt;/p&gt;

&lt;p&gt;To enable your bot to handle messages, setting up a webhook URL is essential.&lt;/p&gt;

&lt;p&gt;This &lt;a href="https://support.whapi.cloud/help-desk/receiving/webhooks/where-to-find-the-webhook-url" rel="noopener noreferrer"&gt;[guide]&lt;/a&gt; provides detailed instructions on locating your webhook URL, recommended server configurations, and popular options for setup. If you’re working in a local environment, deploying to a live server isn’t required. Instead, you can use a tunneling tool to expose your local server and allow external requests to reach it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing Locally:&lt;/strong&gt; For local testing, use Ngrok to expose your server online temporarily, allowing you to simulate bot functions without needing to deploy on a live server.&lt;/p&gt;

&lt;p&gt;Download and unzip Ngrok, then run: &lt;code&gt;./ngrok http PORT_NUMBER&lt;/code&gt;&lt;br&gt;
Replace &lt;code&gt;PORT_NUMBER&lt;/code&gt; with the port where your server is running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Set Webhook URL in Dashboard:&lt;/strong&gt; Copy the Ngrok-generated link as your webhook URL in the Whapi.Cloud dashboard. This directs incoming messages to your bot’s local server, allowing real-time interaction with WhatsApp.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0kysgg2lrgbusm0eoysy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0kysgg2lrgbusm0eoysy.png" alt="Settings of your channel in the dashboard" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  3. Setting Up Your Bot
&lt;/h3&gt;

&lt;p&gt;Follow these steps to get the bot running:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the directory containing the bot’s files: &lt;code&gt;cd /path/to/bot&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Install the required dependencies: &lt;code&gt;pip install -r requirements.txt&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run the bot: &lt;code&gt;python index.py&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If everything is done correctly, your bot is ready to go. Just write the test command &lt;code&gt;“help”&lt;/code&gt; to the number connected to the API from another number.&lt;/p&gt;
&lt;h4&gt;
  
  
  Understanding the Structure of Your WhatsApp Bot
&lt;/h4&gt;

&lt;p&gt;The bot is designed with simplicity in mind, making it easy for beginners to understand. The directory structure includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;files/&lt;/code&gt;: Stores media files, such as images, that the bot sends.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.env&lt;/code&gt;: Contains configuration variables like the API token and base URL.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;index.py&lt;/code&gt;: The main Python script where the bot’s logic resides.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;requirements.txt&lt;/code&gt;: Lists all necessary Python packages.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Customizing and Enhancing Your WhatsApp Bot
&lt;/h2&gt;

&lt;p&gt;Once the basic setup is in place, you can start expanding your bot's functionality to make it more versatile and tailored to specific needs. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Here are some ideas for extending its capabilities:&lt;/em&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Add New Commands and Responses
&lt;/h4&gt;

&lt;p&gt;Modify the &lt;code&gt;index.py&lt;/code&gt; file to include additional commands and features. Extend the conditional logic to recognize new keywords or phrases and define unique responses. These could range from simple text and images to more complex content types.&lt;/p&gt;

&lt;p&gt;Send a Variety of Content&lt;br&gt;
Move beyond basic messages by leveraging Whapi.Cloud’s API to send a diverse range of content. Here are some options you can integrate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Files in various formats&lt;/li&gt;
&lt;li&gt;Shared locations&lt;/li&gt;
&lt;li&gt;Contact cards&lt;/li&gt;
&lt;li&gt;Stickers and polls&lt;/li&gt;
&lt;li&gt;Product details in messages&lt;/li&gt;
&lt;li&gt;Interactive buttons for user actions&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Introduce Message Reactions
&lt;/h4&gt;

&lt;p&gt;Enhance user interaction by adding message reaction features. Your bot can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Quote incoming messages&lt;/li&gt;
&lt;li&gt;Respond with emoji reactions&lt;/li&gt;
&lt;li&gt;Mark messages as read&lt;/li&gt;
&lt;li&gt;Simulate typing indicators in real-time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These additions not only make the bot more engaging but also provide a human-like experience, improving interaction quality.&lt;/p&gt;
&lt;h2&gt;
  
  
  Automated WhatsApp Group Management
&lt;/h2&gt;

&lt;p&gt;Whapi.Cloud’s API offers extensive tools for automating &lt;a href="https://whapi.cloud/features" rel="noopener noreferrer"&gt;WhatsApp Group management&lt;/a&gt;, transforming your bot into an efficient group coordination assistant. Here are some of the tasks you can automate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create, update, or delete groups programmatically.&lt;/li&gt;
&lt;li&gt;Retrieve group details, such as member lists, participant numbers, and other metadata.&lt;/li&gt;
&lt;li&gt;Manage group membership by adding or removing users, assigning admin roles, or blocking members as needed.&lt;/li&gt;
&lt;li&gt;Adjust group settings, including the group name, avatar, and permissions.&lt;/li&gt;
&lt;li&gt;Generate and distribute group invitation links with ease.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For detailed implementation instructions and code samples, refer to Whapi.Cloud’s comprehensive documentation. Each feature is clearly explained, complete with practical examples to help you make the most of your bot’s potential.&lt;/p&gt;

&lt;p&gt;With these advanced capabilities, you can build a robust WhatsApp bot that goes far beyond basic message automation, delivering a solution tailored to your specific requirements.&lt;/p&gt;
&lt;h2&gt;
  
  
  ChatGPT Integration: Bring AI into Your WhatsApp Bot
&lt;/h2&gt;

&lt;p&gt;Adding ChatGPT support is a powerful way to enhance your WhatsApp bot with AI-driven, human-like responses. In this example, we’ll keep things simple: when a user sends a message like /ai [your question], the bot replies using ChatGPT.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Install Dependencies&lt;/strong&gt;&lt;br&gt;
To enable ChatGPT, add the following packages to your requirements.txt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openai&amp;gt;=1.91.0,&amp;lt;2.0.0
httpx&amp;gt;=0.28.1,&amp;lt;1.0.0
httpcore&amp;gt;=1.0.9,&amp;lt;2.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install them using: &lt;code&gt;pip install -r requirements.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Set Your OpenAI API Key&lt;/strong&gt;&lt;br&gt;
Register at &lt;em&gt;platform.openai.com&lt;/em&gt;, generate your secret API key, and add it to your &lt;strong&gt;.env&lt;/strong&gt; file: &lt;code&gt;OPENAI_API_KEY=your_api_key_here&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Implement AI Logic&lt;/strong&gt;&lt;br&gt;
Next, create a basic Flask app (&lt;code&gt;index.py&lt;/code&gt;) that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Receives webhook events from Whapi.Cloud&lt;/li&gt;
&lt;li&gt;Detects messages starting with /ai&lt;/li&gt;
&lt;li&gt;Sends the prompt to ChatGPT&lt;/li&gt;
&lt;li&gt;Replies to the user via the WhatsApp API&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This structure provides a clean, minimal foundation for integrating AI into your bot.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Import necessary libraries for web server, HTTP requests, OpenAI API, environment variables, and .env file loading
from flask import Flask, request, jsonify  # Flask is used to create the web server and handle HTTP requests
import requests  # Used to send HTTP requests to the WhatsApp API
from openai import OpenAI  # OpenAI client for interacting with ChatGPT
import os  # For accessing environment variables
from dotenv import load_dotenv  # For loading variables from a .env file

# Load environment variables from a .env file into the environment
load_dotenv()
# Create a Flask web application instance
app = Flask(__name__)

# Retrieve required configuration values from environment variables
API_TOKEN = os.getenv("API_TOKEN")  # Token for authenticating with WhatsApp API
API_URL = os.getenv("API_URL")      # Base URL for WhatsApp API
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")  # API key for OpenAI

# Ensure all required environment variables are set, otherwise stop the program with an error
if not API_TOKEN or not API_URL or not OPENAI_API_KEY:
    raise RuntimeError("Missing required environment variables: API_TOKEN, API_URL, or OPENAI_API_KEY")

# Initialize the OpenAI client with the provided API key
openai_client = OpenAI(api_key=OPENAI_API_KEY)

# Function to send a prompt to ChatGPT and get a response
# Takes a string prompt and returns the model's reply as a string
def ask_openai(prompt):
    response = openai_client.chat.completions.create(
        model="gpt-3.5-turbo",  # Specify which OpenAI model to use
        messages=[{"role": "user", "content": prompt}]  # Provide the user's message to the model
    )
    # Extract and return the text of the model's reply
    return response.choices[0].message.content.strip()

# Function to send a text message to a WhatsApp user via the WhatsApp API
# 'to' is the recipient's chat ID, 'body' is the message text
def send_message(to, body):
    headers = {
        "Authorization": f"Bearer {API_TOKEN}",  # Add authentication token to the request
        "Content-Type": "application/json"        # Specify that we're sending JSON data
    }
    payload = {"to": to, "body": body}  # Prepare the message data
    # Send the message to the WhatsApp API endpoint
    response = requests.post(f"{API_URL}/messages/text", json=payload, headers=headers)
    print("Whapi response:", response.status_code, response.text)  # Log the API response for debugging

# Define a webhook endpoint to receive incoming WhatsApp messages
@app.route("/hook/messages", methods=["POST"])
def webhook():
    data = request.json  # Parse the incoming JSON data
    print("Incoming:", data)  # Log the incoming data for debugging

    # Loop through all received messages (could be more than one in a single webhook call)
    for msg in data.get("messages", []):
        if msg.get("from_me"):
            continue  # Skip messages sent by the bot itself

        sender = msg.get("chat_id")  # Get the sender's chat ID
        # Safely extract the message text, handling cases where 'text' might be missing
        text = (msg.get("text") or {}).get("body", "").strip()

        # If the message starts with '/ai ', treat it as a prompt for ChatGPT
        if text.lower().startswith("/ai "):
            prompt = text[4:].strip()  # Extract the user's prompt after '/ai '
            if not prompt:
                send_message(sender, "Please provide a prompt after /ai.")  # Ask user to provide a prompt
            else:
                try:
                    reply = ask_openai(prompt)  # Get response from ChatGPT
                    send_message(sender, reply)  # Send the response back to the user
                except Exception as e:
                    send_message(sender, f"Error: {e}")  # Inform user if something went wrong
        else:
            # If the message doesn't start with '/ai ', send instructions to the user
            send_message(sender, "Hi! To ask me something, type:\n/ai your question")

    # Respond to WhatsApp API to confirm receipt of the webhook
    return jsonify({"status": "received"})

# Optional: health check endpoint to verify the bot is running
@app.route("/", methods=["GET"])
def index():
    return "Bot is running"

# Function to register the webhook URL with the WhatsApp API
def register_webhook():
    if os.getenv("BOT_URL"):
        headers = {"Authorization": f"Bearer {API_TOKEN}"}
        payload = {
            "webhooks": [
                {
                    "url": os.getenv("BOT_URL"),  # The public URL where Whapi should send messages
                    "events": [{"type": "messages", "method": "post"}],  # Listen for message events
                    "mode": "method"
                }
            ]
        }
        # Register the webhook
        response = requests.patch(f"{API_URL}/settings", json=payload, headers=headers)
        print("Webhook setup:", response.status_code, response.text)  # Log the result

# If this script is run directly (not imported), start the bot
if __name__ == "__main__":
    register_webhook()  # Optionally register the webhook on startup
    port = int(os.getenv("PORT", 80))  # Use the PORT environment variable or default to 80
    app.run(host="0.0.0.0", port=port)  # Start the Flask web server, accessible from any network interface
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This basic bot processes incoming messages, filters out messages from itself, and searches for messages beginning with /ai. If such a command is found, it extracts the question, sends it to ChatGPT, and responds using the WhatsApp API with an AI response. This script is ready for testing. And its useful part has already been implemented in our chatbot &lt;a href="https://github.com/Whapi-Cloud/python-whatsapp-chatbot" rel="noopener noreferrer"&gt;example on GitHub&lt;/a&gt; to make it easier for you to get started!&lt;/p&gt;




&lt;h2&gt;
  
  
  FAQs and Troubleshooting
&lt;/h2&gt;

&lt;p&gt;Setting up and operating a WhatsApp bot may occasionally present challenges. Here are some common issues and steps you can take to resolve them:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;The Bot Is Not Responding to Incoming Messages&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;1. Verify Your Testing Method&lt;/strong&gt;&lt;br&gt;
Ensure you’re testing with a phone number different from the one assigned to the bot. The bot is programmed to respond only to messages received from external sources, so messages sent from the same number will be ignored.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Check Your Webhook Configuration&lt;/strong&gt;&lt;br&gt;
If the bot isn’t responding to messages from other numbers, the issue might be with the webhook setup. Follow these steps to troubleshoot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simulate Webhook Requests: Use tools like &lt;a href="https://panel.whapi.cloud/tools/webhook-testing" rel="noopener noreferrer"&gt;Webhook Request Debugger&lt;/a&gt; to test incoming requests and verify that the webhook URL matches the one expected by the API.&lt;/li&gt;
&lt;li&gt;Server Response Validation: Confirm that your server is returning a &lt;code&gt;200 OK&lt;/code&gt; response, which indicates the webhook is active and properly receiving requests.&lt;/li&gt;
&lt;li&gt;Endpoint Testing: Use &lt;a href="https://whapi.readme.io/reference/webhooktest" rel="noopener noreferrer"&gt;an endpoint tester&lt;/a&gt; to send mock callbacks to your webhook URL and ensure it is correctly configured.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Reach Out for Support&lt;/strong&gt;&lt;br&gt;
If you’ve tried the above steps and the issue persists, don’t hesitate to contact our technical support team. You can reach us via the chat widget on our website or email &lt;a href="//care@whapi.cloud"&gt;care@whapi.cloud&lt;/a&gt;. Our team is ready to help resolve webhook or configuration issues and get your bot running smoothly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This Python-based WhatsApp bot serves as the perfect entry point for developers exploring API integration and chatbot development. By following this step-by-step guide, you’ll acquire the foundational skills needed to create more sophisticated bots that can process diverse commands, handle media interactions, and automate messaging tasks.&lt;/p&gt;

&lt;p&gt;Whether you’re new to Python programming or looking to expand your expertise in chatbot development, this project equips you with the essential tools to master WhatsApp API integration. Start building your custom bots today and pave the way for advanced Python automation projects in the future.&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>api</category>
      <category>whatsapp</category>
    </item>
    <item>
      <title>Building Your First WhatsApp Bot in PHP: A Beginner's Guide to Code and Integration</title>
      <dc:creator>WhatsApp API for developers</dc:creator>
      <pubDate>Wed, 06 Nov 2024 08:44:45 +0000</pubDate>
      <link>https://forem.com/whapicloud/building-your-first-whatsapp-bot-in-php-a-beginners-guide-to-code-and-integration-1ng0</link>
      <guid>https://forem.com/whapicloud/building-your-first-whatsapp-bot-in-php-a-beginners-guide-to-code-and-integration-1ng0</guid>
      <description>&lt;p&gt;Building a custom WhatsApp bot might seem daunting at first, but with clear guidance, it’s a manageable and rewarding project for developers—especially those just beginning to explore API integrations. This tutorial provides a straightforward path to setting up a WhatsApp bot in PHP, covering everything from API token setup to tailored message responses.&lt;/p&gt;

&lt;p&gt;Designed for beginners, this guide is the perfect foundation for developing more advanced bots in the future.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features of This WhatsApp Bot
&lt;/h3&gt;

&lt;p&gt;This introductory bot is programmed to respond to incoming messages with preset text and image replies, depending on the message content. It’s a practical starting point for developers wanting to learn about API-driven interactions and automated messaging.&lt;/p&gt;

&lt;p&gt;One standout feature: this bot operates seamlessly within WhatsApp Groups and communities, enabling you to bring automation to your WhatsApp channels with ease.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/1SQ048ZDnE0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;To get started, make sure you have the following setup:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Obtain Your API Token
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Register on &lt;a href="https://panel.whapi.cloud/register" rel="noopener noreferrer"&gt;Whapi.Cloud&lt;/a&gt;. Whapi.Cloud provides an easy to use API gateway that is compatible with any programming language. It will allow you to integrate your website, store, app or CRM with WhatsApp without nerves.&lt;/li&gt;
&lt;li&gt;Download the ready-to-use bot source code from GitHub: &lt;a href="https://github.com/Whapi-Cloud/whatsapp-simple-php-bot" rel="noopener noreferrer"&gt;https://github.com/Whapi-Cloud/whatsapp-simple-php-bot&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Get your API Token to work with your WhatsApp. How to get the token is very detailed &lt;a href="https://support.whapi.cloud/help-desk/getting-started/getting-started" rel="noopener noreferrer"&gt;in this instruction&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Save this token in &lt;strong&gt;/config/config.php&lt;/strong&gt; for easy access by the bot.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  2. Set Up Your Webhook URL
&lt;/h2&gt;

&lt;p&gt;A webhook is a tool that enables one application to send real-time data to another. For this WhatsApp bot, the webhook URL is the designated address where WhatsApp sends incoming messages for your bot to process and reply.&lt;/p&gt;

&lt;p&gt;To allow the bot to receive messages, you’ll need to configure a webhook URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://support.whapi.cloud/help-desk/receiving/webhooks/where-to-find-the-webhook-url" rel="noopener noreferrer"&gt;This guide&lt;/a&gt; covers where to find this link, recommended server options, and popular solutions available. If you’re testing locally, however, a live server isn’t necessary. You can set up a tunnel to allow requests to reach your local machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing Locally&lt;/strong&gt;: For local testing, use &lt;em&gt;Ngrok&lt;/em&gt; to expose your server online temporarily, allowing you to simulate bot functions without needing to deploy on a live server.&lt;/p&gt;

&lt;p&gt;Download and unzip Ngrok, then run:&lt;br&gt;
&lt;code&gt;./ngrok http PORT_NUMBER&lt;/code&gt;&lt;br&gt;
Replace &lt;em&gt;PORT_NUMBER&lt;/em&gt; with the port where your server is running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Set Webhook URL in Dashboard&lt;/strong&gt;: Copy the Ngrok-generated link as your webhook URL in the Whapi.Cloud dashboard. This directs incoming messages to your bot’s local server, allowing real-time interaction with WhatsApp.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjldse3ynk3xgdbz8lthy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjldse3ynk3xgdbz8lthy.png" alt="Channel settings after it is connected to your number" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Install Composer
&lt;/h2&gt;

&lt;p&gt;Composer is needed to handle dependencies for this bot. Run the following commands to install Composer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Install Dependencies
&lt;/h2&gt;

&lt;p&gt;With Composer installed, navigate to the bot’s directory and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php composer.phar install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Launch the Bot
&lt;/h2&gt;

&lt;p&gt;After setting everything up, start the bot with the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php server.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a video tutorial on setup, check out our &lt;a href="https://youtu.be/1SQ048ZDnE0" rel="noopener noreferrer"&gt;YouTube guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Structure of Your WhatsApp Bot
&lt;/h2&gt;

&lt;p&gt;This bot is structured with clarity and detailed comments, making it beginner-friendly and easy to navigate. Below is an overview of the primary components:&lt;/p&gt;

&lt;h4&gt;
  
  
  Core Modules
&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;/src/channel.php&lt;/em&gt;&lt;br&gt;
This module contains essential functions that manage communication between the bot and users:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;checkHealth(): Confirms that the bot’s channel is functioning properly.&lt;/li&gt;
&lt;li&gt;sendMessage(): Sends text messages to specified recipients.&lt;/li&gt;
&lt;li&gt;setWebHook(): Configures the webhook automatically (optional).&lt;/li&gt;
&lt;li&gt;getWebHooks(): Retrieves webhook details from the API.&lt;/li&gt;
&lt;li&gt;sendLocalJPG(): Converts images from the /images/ directory to base64 and sends them as media messages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The code snippet demonstrating sendMessage() functionality. This feature displays the “Typing” status in your WhatsApp for 5 seconds and then sends a text message after that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function sendMessage($to, $body): bool {
  $ch = curl_init('https://gate.whapi.cloud/messages/text');
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      'Authorization: Bearer ' . $this-&amp;gt;token,
      'Content-Type: application/json'
  ]);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
      'typing_time' =&amp;gt; 5,
      'to' =&amp;gt; $to,
      'body' =&amp;gt; $body
  ]));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $response = curl_exec($ch);
  $data = json_decode($response, true);
  curl_close($ch);

  return $data['sent'] ?? false;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Primary Logic
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;/src/Whapi.php&lt;/em&gt;&lt;br&gt;
The main logic for the bot resides here, controlling how it processes and responds to incoming messages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Message Filtering: Screens out outgoing messages, ensuring only external incoming messages are handled.&lt;/li&gt;
&lt;li&gt;Sender and Content Parsing: Extracts the sender’s phone number and the message text.&lt;/li&gt;
&lt;li&gt;Command-Based Responses: Uses a switch statement to define responses based on specific commands or keywords received.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This structure allows for easy customization and extension, providing a solid foundation to build upon as you add new features.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// The main cycle of the bot is to check and react to the incoming message depending on the text
switch ($receivedText) {
  case 'help':
      $channel-&amp;gt;sendMessage($senderPhone, 'Text1'); // If the bot receives the message 'help', it will send the message 'Text1'
      break;
  case 'command':
      $channel-&amp;gt;sendMessage($senderPhone, 'Text2');
      break;
  case 'image':
      $channel-&amp;gt;sendLocalJPG(__DIR__ . '/../public/images/example.jpeg', $senderPhone, 'Caption'); // We encode the picture in base64, so it's easier to send a media message.
      break;
  default:
      $channel-&amp;gt;sendMessage($senderPhone, 'Unknown command'); // On an unknown team, it's best to send navigation information to help your customer navigate
      break;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Customizing and Expanding Your WhatsApp Bot
&lt;/h2&gt;

&lt;p&gt;With the initial setup complete, you have a strong foundation to enhance your bot with &lt;a href="https://whapi.cloud/features" rel="noopener noreferrer"&gt;new features and customizations&lt;/a&gt;. Here are some ways to expand its functionality and tailor it to your needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Add Custom Commands and Responses
&lt;/h3&gt;

&lt;p&gt;Customize your bot’s behavior by adding commands within the &lt;code&gt;/src/Whapi.php&lt;/code&gt; file. Expand the switch statement to recognize additional keywords or phrases and create unique responses, from text and images to other content types.&lt;/p&gt;

&lt;h3&gt;
  
  
  Send Varied Content
&lt;/h3&gt;

&lt;p&gt;Go beyond basic text and images by implementing advanced messaging options available through Whapi.Cloud’s API. These include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Files in multiple formats&lt;/li&gt;
&lt;li&gt;Location sharing&lt;/li&gt;
&lt;li&gt;Contact information cards&lt;/li&gt;
&lt;li&gt;Stickers and polls&lt;/li&gt;
&lt;li&gt;Product listings within messages&lt;/li&gt;
&lt;li&gt;Interactive messages with buttons for user actions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Interactive Message Reactions
&lt;/h3&gt;

&lt;p&gt;Make your bot more engaging by adding message reactions. Enable it to quote messages, respond with emoji reactions, mark messages as read, or show real-time typing indicators. These small interactions add a human-like element to your bot’s responses.&lt;/p&gt;

&lt;h3&gt;
  
  
  Automated WhatsApp Group Management
&lt;/h3&gt;

&lt;p&gt;With Whapi.Cloud’s API, you can automate a range of &lt;a href="https://whapi.cloud/whatsapp-community-api" rel="noopener noreferrer"&gt;group management tasks&lt;/a&gt;, turning your bot into a powerful tool for group coordination:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatically create, modify, or delete groups.&lt;/li&gt;
&lt;li&gt;Access group information, including member details and total counts.&lt;/li&gt;
&lt;li&gt;Manage membership by adding or removing users, assigning administrator roles, and blocking members.&lt;/li&gt;
&lt;li&gt;Customize group settings like name, avatar, and permissions.&lt;/li&gt;
&lt;li&gt;Generate and share group invitation links effortlessly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For full implementation details and code examples, check out Whapi.Cloud’s detailed documentation. &lt;a href="https://whapi.readme.io/reference/sendmessagetext" rel="noopener noreferrer"&gt;Each method&lt;/a&gt; is thoroughly explained with examples to help you unlock the full potential of your bot’s capabilities.&lt;/p&gt;

&lt;p&gt;These enhancements make it possible to build a highly functional WhatsApp bot tailored to your unique needs, going far beyond basic message responses.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQs and Troubleshooting
&lt;/h2&gt;

&lt;p&gt;Setting up and running a WhatsApp bot can sometimes present challenges. Here are some solutions for common issues to help keep your bot operating smoothly:&lt;/p&gt;

&lt;h4&gt;
  
  
  Bot Isn’t Responding to Incoming Messages
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;1. Confirm Your Testing Method&lt;/strong&gt;&lt;br&gt;
Make sure you’re testing from a different phone number than the one the bot uses. The bot is designed to respond only to messages from external sources, so messages from the same number won’t trigger a response.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Check Webhook Functionality&lt;/strong&gt;&lt;br&gt;
If the bot still isn’t responding, the webhook configuration might need attention. Here are a few steps to troubleshoot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simulate Webhook Requests: Use a tool like &lt;a href="https://panel.whapi.cloud/tools/webhook-testing" rel="noopener noreferrer"&gt;Webhook Request Debugger&lt;/a&gt; to simulate incoming requests and confirm that your bot’s webhook URL matches what the API expects.&lt;/li&gt;
&lt;li&gt;Server Response Verification: Ensure your server responds with a &lt;code&gt;200 OK&lt;/code&gt; status, indicating that the webhook is active and receiving requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also use &lt;a href="https://whapi.readme.io/reference/webhooktest" rel="noopener noreferrer"&gt;an endpoint tester&lt;/a&gt; to verify your webhook link, which sends test callbacks to simulate real incoming requests.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Contact Technical Support&lt;/strong&gt;&lt;br&gt;
If these steps don’t resolve the issue, reach out to our technical support team. Use the chat widget on our website or email &lt;a href="//care@whapi.cloud"&gt;care@whapi.cloud&lt;/a&gt;, and our team will assist with any webhook or bot configuration issues to get you up and running.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This WhatsApp bot in PHP offers an ideal entry point for beginners exploring chatbot creation and API integration. By following this guide, you’ll develop foundational skills for building more advanced bots capable of responding to various commands with text, images, and more. This project lays the groundwork for creating versatile and interactive bots that can grow in complexity as you expand your API knowledge.&lt;/p&gt;

</description>
      <category>php</category>
      <category>beginners</category>
      <category>whatsapp</category>
      <category>api</category>
    </item>
    <item>
      <title>Simple WhatsApp ChatBot in Node.js for Beginners</title>
      <dc:creator>WhatsApp API for developers</dc:creator>
      <pubDate>Tue, 22 Oct 2024 13:27:16 +0000</pubDate>
      <link>https://forem.com/whapicloud/simple-whatsapp-chatbot-on-nodejs-for-beginners-559a</link>
      <guid>https://forem.com/whapicloud/simple-whatsapp-chatbot-on-nodejs-for-beginners-559a</guid>
      <description>&lt;p&gt;Are you looking to build your first bot but don’t know where to start? Then you're in the right place! I'm excited to announce the release of a new, simple WhatsApp bot built with Node.js that’s perfect for beginners.&lt;/p&gt;

&lt;p&gt;In this tutorial, we are excited to announce the release of a simple WhatsApp bot built with Node.js—an ideal starting point for beginner developers. If you're just venturing into bot development, this bot will help you learn how to handle commands, respond to messages, and even share images, all while keeping the complexity at bay. You’ll focus on the core functionality without being overwhelmed by unnecessary features.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Build a WhatsApp Bot?
&lt;/h2&gt;

&lt;p&gt;WhatsApp is one of the most widely used messaging platforms in the world, and many businesses use it for customer support, notifications, and marketing. A bot can automate these tasks, saving time and effort, and enhancing user experience.&lt;/p&gt;

&lt;p&gt;However, for someone new to development, it can be challenging to figure out where to begin with building a WhatsApp bot. That's why I've created this bot with simplicity in mind, offering only core functionality like responding to text commands and sending images.&lt;/p&gt;

&lt;p&gt;Let’s dive into the details of this project and explore how to set up your very own WhatsApp bot!&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s Inside This WhatsApp Bot
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/Whapi-Cloud/whatsapp-simple-node-js-bot" rel="noopener noreferrer"&gt;This bot&lt;/a&gt; is designed to respond to a few basic commands. When a user sends a message to the connected WhatsApp channel, the bot can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reply with text messages.&lt;/li&gt;
&lt;li&gt;Send images based on commands.&lt;/li&gt;
&lt;li&gt;Understand and talk about a team he doesn't know.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These functionalities give you a hands-on way to understand how to process messages and how to structure your own bot logic.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/bxwlAMm6B5U"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we get started, there are a few things you’ll need:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Node.js – Make sure you have Node.js installed on your system. If you haven't installed it yet, you can download it from &lt;a href="https://nodejs.org/" rel="noopener noreferrer"&gt;Node.js official website&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;API Token from &lt;a href="https://whapi.cloud/" rel="noopener noreferrer"&gt;Whapi.Cloud&lt;/a&gt; – Whapi.Cloud provides an easy-to-use API for WhatsApp integration. You’ll need to &lt;a href="https://panel.whapi.cloud/dashboard" rel="noopener noreferrer"&gt;sign up&lt;/a&gt; for an account and grab a token. We have described in more detail how to connect a WhatsApp account and get a token &lt;a href="https://support.whapi.cloud/help-desk/getting-started/getting-started" rel="noopener noreferrer"&gt;in our knowledge base here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A Webhook – The bot relies on a webhook to receive incoming messages. If you don't know how to set it up, we'll tell you more about it below.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Project Structure Overview
&lt;/h3&gt;

&lt;p&gt;Here’s a breakdown of the key files in this project:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;index.js&lt;/strong&gt; – This file verifies the WhatsApp channel, checks the API token, and sets up the webhook programmatically through the API. There’s no need to configure the webhook manually in the interface, as it's handled here automatically.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;/modules/channel.ts&lt;/strong&gt; – Contains essential functions such as:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;checkHealth()&lt;/code&gt; – Verifies the channel’s functionality.&lt;br&gt;
&lt;code&gt;sendMessage()&lt;/code&gt; – Sends text messages.&lt;br&gt;
&lt;code&gt;setWebHook()&lt;/code&gt; – Sets the webhook for incoming messages.&lt;br&gt;
&lt;code&gt;getWebHooks()&lt;/code&gt; – Retrieves existing webhooks.&lt;br&gt;
&lt;code&gt;sendLocalJPG()&lt;/code&gt; – Converts images from the /images/ folder into Base64 and sends them as WhatsApp messages.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;/endpoints/hook.ts&lt;/strong&gt; – This is where the core bot logic lives:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;It listens for incoming messages and ignores outgoing messages.&lt;/li&gt;
&lt;li&gt;It fetches the sender's number and message text.&lt;/li&gt;
&lt;li&gt;It filters out non-text messages.&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;switch&lt;/code&gt; statement processes the command and sends back the appropriate response, either a text message or an image.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Step-by-Step Setup
&lt;/h2&gt;

&lt;p&gt;Follow these simple steps to get your WhatsApp bot running:&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Clone the Project
&lt;/h3&gt;

&lt;p&gt;Start by cloning the repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/Whapi-Cloud/whatsapp-simple-node-js-bot
cd whatsapp-bot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Update the Config
&lt;/h3&gt;

&lt;p&gt;Next, open the &lt;code&gt;config.json&lt;/code&gt; file and add your API token and webhook URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "webhookUrl": "YOUR-WEBHOOK-URL",
    "token": "YOUR-TOKEN",
    "port": "8080"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Where to Find the Webhook URL?
&lt;/h4&gt;

&lt;p&gt;To set up a webhook URL, you'll need to configure a server endpoint that can handle incoming HTTP requests from our API. This allows your application to receive real-time data, such as message updates, directly from WhatsApp.&lt;/p&gt;

&lt;p&gt;You can set up a webhook on &lt;a href="https://support.whapi.cloud/help-desk/receiving/webhooks/where-to-find-the-webhook-url#setting-up-a-webhook-on-a-hosting-platform" rel="noopener noreferrer"&gt;a hosting platform&lt;/a&gt;, &lt;a href="https://support.whapi.cloud/help-desk/receiving/webhooks/where-to-find-the-webhook-url#popular-cloud-services" rel="noopener noreferrer"&gt;in the cloud services&lt;/a&gt;, or &lt;a href="https://support.whapi.cloud/help-desk/receiving/webhooks/how-to-check-the-webhook#how-to-test-webhook-locally" rel="noopener noreferrer"&gt;locally (using Ngrok or similar programs)&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;The links provided will give you instructions on how to use this option. In this article's example, we will use Ngrok.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Install Dependencies
&lt;/h3&gt;

&lt;p&gt;Install the required dependencies by running:&lt;br&gt;
&lt;code&gt;npm install&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Run the Bot
&lt;/h3&gt;

&lt;p&gt;To start your bot, run the following command:&lt;br&gt;
&lt;code&gt;npm run start&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And that’s it! Your bot is now up and running. It will respond to incoming messages based on the logic defined in &lt;code&gt;/endpoints/hook.ts&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Detailed Features
&lt;/h2&gt;

&lt;p&gt;Here’s a closer look at what the bot does and how it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Channel Health Check&lt;br&gt;
Before anything else, the bot ensures that the WhatsApp channel is functioning correctly by using the &lt;code&gt;checkHealth()&lt;/code&gt; function in &lt;em&gt;/modules/channel.ts&lt;/em&gt;. This prevents problems from occurring later and helps you ensure that the session is working correctly and your channel is running.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sending Messages&lt;br&gt;
The bot uses the &lt;code&gt;sendMessage()&lt;/code&gt; function to send replies to users. The bot script itself contains logic for processing various types of responses (skips outgoing messages; processes only incoming text messages; sends messages in response to the numbers that were written to it).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Webhook Setup&lt;br&gt;
Instead of manually setting up the webhook in the Whapi.Cloud interface, the &lt;code&gt;setWebHook()&lt;/code&gt; function handles this automatically via the API, streamlining the setup process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Image Handling&lt;br&gt;
The &lt;code&gt;sendLocalJPG()&lt;/code&gt; function allows the bot to send images in response to certain commands. It converts images from the /images/ folder into Base64 format and sends them via WhatsApp.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Processing Incoming Messages&lt;br&gt;
The core bot logic in &lt;em&gt;/endpoints/hook.ts&lt;/em&gt; listens for incoming messages, processes the text, and replies accordingly. The bot handles various commands using the &lt;code&gt;switch&lt;/code&gt; statement, which makes it easy to expand the bot's capabilities in the future.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Ready to learn more?
&lt;/h4&gt;

&lt;p&gt;If you want to dive deeper into the API or expand the bot's capabilities, check out our more comprehensive &lt;a href="https://github.com/Whapi-Cloud/nodejs-whatsapp-chatbot" rel="noopener noreferrer"&gt;chatbot on GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This simple WhatsApp bot built with Node.js is a great way to start learning how to develop chatbots. With the functionality to send both text and images, and clear, easy-to-understand code, this project is perfect for beginner developers.&lt;/p&gt;

&lt;p&gt;Start your journey with WhatsApp bot development today by trying out this bot and customizing it to your needs. Be sure to also &lt;a href="https://whapi.cloud/features" rel="noopener noreferrer"&gt;explore Whapi.Cloud’s API&lt;/a&gt; for additional functionality and support for more complex features.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try it now, and happy coding!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>whatsapp</category>
      <category>beginners</category>
      <category>opensource</category>
    </item>
    <item>
      <title>How to register a virtual WhatsApp number</title>
      <dc:creator>WhatsApp API for developers</dc:creator>
      <pubDate>Wed, 09 Oct 2024 10:52:13 +0000</pubDate>
      <link>https://forem.com/whapicloud/how-to-register-a-virtual-whatsapp-number-5fp1</link>
      <guid>https://forem.com/whapicloud/how-to-register-a-virtual-whatsapp-number-5fp1</guid>
      <description>&lt;h2&gt;
  
  
  What is a virtual number and why do I need it?
&lt;/h2&gt;

&lt;p&gt;This article is intended for entrepreneurs, marketers and professionals who actively use WhatsApp to interact with customers, mass mailings and automate business processes. Using a personal number for these purposes can be insecure and inconvenient due to the risks of blocking and the need to buy SIM cards.&lt;/p&gt;

&lt;p&gt;Virtual numbers make registering accounts on WhatsApp simpler, making it much easier to manage and automate. This is especially important for mass activity, as it allows for quick recovery when accounts are blocked, minimizing potential losses. This approach opens up great opportunities for safer and more convenient use of WhatsApp for commercial purposes, as even if one account is blocked, you can quickly register a new one without risking your core numbers and infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Virtual number and its use in WhatsApp
&lt;/h2&gt;

&lt;p&gt;Using a personal number for commercial purposes carries the risk of blocking and loss of privacy, and restoring the account, in case of a ban, will be difficult. Virtual numbers help to avoid this by providing access to numbers from any country and region with full messenger functionality.&lt;/p&gt;

&lt;p&gt;To sign up for WhatsApp, you need to have the app itself on your phone, accept the terms of use and enter your phone number in international format. This number will then receive a confirmation code via SMS or call, which must be entered into the app. This process is simple on a regular smartphone, but without a physical device it becomes more complicated as you will need a method of receiving messages or calls to confirm.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqcpl1944vjgxev3tsxnk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqcpl1944vjgxev3tsxnk.jpg" alt="Sometimes WhatsApp offers other signup options, but more often you'll need to accept a message or call" width="800" height="280"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Sometimes WhatsApp offers other signup options, but more often you'll need to accept a message or call&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you have multiple devices, you can manually register numbers on each of them, which takes time and effort. How to do this is detailed below. If you don't have a physical gadget, you can use emulators or special API methods offered by us as a WhatsApp API provider. These methods allow you to automate processes, but they have their own peculiarities and limitations that are important to consider. The details will be discussed in the following sections.&lt;/p&gt;

&lt;p&gt;Thus, virtual numbers are convenient for anonymity and automation of registration, but their use without a physical device requires a more careful approach. In this article, we will consider where and how to get a virtual number, how to receive an SMS or call on it, as well as the pros and cons of using emulators and other options for registering accounts in WhatsApp via API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Several ways to get a virtual number for WhatsApp
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Official virtual number providers&lt;/strong&gt;&lt;br&gt;
Virtual number providers such as Twilio, Vonage and Voximplant offer numbers that support SMS and calling directly. They require detailed business verification including providing a lot of documents. The advantage of these providers is that they provide APIs for integration, but setting up SMS and call acceptance remains your responsibility. &lt;/p&gt;

&lt;p&gt;Twilio, for example, offers out-of-the-box webhooks for SMS, but costs more and requires more verification. Voximplant offers more affordable numbers, but setting them up to receive messages and calls is more complicated and may require you to set up IP telephony yourself.&lt;/p&gt;

&lt;p&gt;Many numbers provided by these services may have already been used in public services and become unavailable for registration in WhatsApp. The app will simply not allow the use of such a number while requesting another one. This complicates the process and makes it impractical to use these numbers to register in the messenger.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjdkosdopq15b71ypx3hk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjdkosdopq15b71ypx3hk.jpg" alt="More often than not, numbers from exchanges and providers fail to register in WhatsApp" width="590" height="1232"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(More often than not, numbers from exchanges and providers fail to register in WhatsApp)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Using such services requires technical knowledge and can be labor-intensive with no guarantee of results. Therefore, they are more suitable for long-term business tasks not related to mass activity on WhatsApp.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. VoIP exchanges&lt;/strong&gt;&lt;br&gt;
VoIP exchanges are platforms where you can purchase virtual numbers from different providers with flexible terms and conditions. Services such as DIDWW, CallHippo, VoIP.ms and TollFreeForwarding offer a wide range of numbers from different countries, allowing you to find the right one at a favorable price. However, support on these platforms is limited as they act as intermediaries. In addition, exchanges may ask for documents to verify an account or business. Often, numbers can be temporary or previously used, making it difficult to sign up for WhatsApp, and you'll need additional technical setup to receive SMS or calls anyway.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvhqqduvz9q9rsqzheuen.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvhqqduvz9q9rsqzheuen.png" alt="Sometimes you will need a bit of technical knowledge to set up receiving messages or calls" width="800" height="681"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(Sometimes you will need a bit of technical knowledge to set up receiving messages or calls)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. One-time activation services&lt;/strong&gt;&lt;br&gt;
These platforms offer temporary numbers that can be rented for quick registration in WhatsApp or other services. They are convenient because the registration process is fully automated and does not require identity verification or documents. The user receives the number in a few minutes and can immediately use it to receive SMS or calls in a convenient out-of-the-box interface without any technical settings. However, this approach carries risks: numbers can be previously used or stolen, making them unreliable for long-term use. Since such services operate in a gray zone, we will not provide links to them, but they can be easily found on the Internet.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnvfv33lvkvtfh15j4t51.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnvfv33lvkvtfh15j4t51.png" alt="“Gray” services for buying cheap one-time activations" width="530" height="620"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(“Gray” services for buying cheap one-time activations)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So, you have decided on a virtual number provider that meets your requirements. But now how to organize your work if you don't want to use physical devices or need to register accounts en masse with minimal effort?&lt;/p&gt;

&lt;h2&gt;
  
  
  How to register many numbers in WhatsApp?
&lt;/h2&gt;

&lt;p&gt;Mass activity usually requires a large number of numbers, but it is inconvenient and cumbersome to store many devices at home or in the office. Let's take a look at all the solutions for active number registration in WhatsApp.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Gadget farm&lt;/u&gt;&lt;br&gt;
A gadget farm is a group of mobile devices used to handle multiple accounts simultaneously. Usually, these are dozens or even hundreds of smartphones or tablets that perform some tasks. Most often, the devices are physically placed on a special rack or in an enclosure, connected to power and the internet. But it is possible to use automated systems to manage farms.&lt;/p&gt;

&lt;p&gt;You may well use several of your old phones in your work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can install regular WhatsApp and WhatsApp Business on each device, which allows you to already use two numbers on one phone.&lt;/li&gt;
&lt;li&gt;In regular WhatsApp, you can connect multiple numbers in one app via the “Multi-Account” feature. To do this, go to your account settings, select “Add a new number” and follow the instructions.&lt;/li&gt;
&lt;li&gt;Cloning apps create duplicate apps, allowing you to run multiple accounts on the same device. However, WhatsApp can recognize this and block the accounts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnqwjeftn3h1rkrox6e5p.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnqwjeftn3h1rkrox6e5p.jpg" alt="Adding a new account in WhatsApp" width="590" height="1231"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(Adding a new account in WhatsApp)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Thus, even a few old phones at home can provide up to ten active WhatsApp accounts. However, these devices require constant monitoring and periodic switching on to log into the app. If you don't log into WhatsApp on your phone for 14 days, it drops all connected sessions (like Web versions or API connections). This means you'll have to put your phones on charge frequently, messing around with devices and keeping track of them, which creates more inconvenience and makes it harder to manage your gadget farm.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to register a number in WhatsApp without a gadget?
&lt;/h2&gt;

&lt;p&gt;&lt;u&gt;Emulators&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Using emulators for WhatsApp allows you to run the application on your computer without a phone, which is convenient for mass registration of numbers. How to choose the right one? Here are a few of the most convenient options below &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BlueStacks&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;A popular emulator with support for a variety of applications. It is easy to install and use, but requires enough system resources. Good for running WhatsApp on PC, but can be noticeable for WhatsApp security.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nox&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A lightweight emulator optimized for games and apps. Has flexible settings and can run multiple instances of WhatsApp at the same time, which is convenient for mass usage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memu&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An emulator with high performance and flexible customization. Features a simple interface and support for multiple Android versions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LDPlayer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Lightweight and fast emulator with good compatibility. Supports many apps and games, but like the others, has the risk of being detected by WhatsApp.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cloud Emulator&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cloud emulators allow you to run applications remotely, which reduces the load on local resources and improves stability. However, they require additional customization and can be more expensive.&lt;/p&gt;

&lt;p&gt;For all the pros, there are cons to this use of emulators:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Session disconnection after 14 days: as with a session on a physical device, if you don't log into your account for two weeks, WhatsApp will disconnect connected devices (like the Web version, which could be your agents or APIs). This requires regular checking and running emulators.&lt;/li&gt;
&lt;li&gt;Increased risk of blocking: WhatsApp monitors virtual devices and may block an account if it detects emulator usage.&lt;/li&gt;
&lt;li&gt;Problems with updates: Emulators may not be compatible with newer versions of WhatsApp, making them more difficult to use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Overall, emulators do not guarantee stable performance and require constant monitoring, making them not the most reliable option for mass activity.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Device-Free WhatsApp API&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Mobile instances or Device-Free WhatsApp Channel from Whapi.Cloud allows you to register numbers and work with APIs without using a physical device. This is convenient for companies that need mass registration and automation. Whapi.Cloud offers extensive functionality for developers: managing and parsing groups, checking numbers for WhatsApp and more. This approach solves many of the problems faced by users of traditional VoIP numbers and emulators. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjfjt5fb2kzsclw5q09lk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjfjt5fb2kzsclw5q09lk.jpg" alt="Registering a new account via API, without using a gadget. The screenshot from the Developer Hub interface shows a repeated request to register a new number with the code already received and a successful registration response" width="800" height="495"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;(Registering a new account via API, without using a gadget. The screenshot from the Developer Hub interface shows a repeated request to register a new number with the code already received and a successful registration response)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;At the moment, the Device-Free WhatsApp API functionality is only available to some partners as part of closed beta testing. If you are interested in learning more and would like to participate in the testing, contact us for a survey and possible access to this technology. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://whapi.cloud/device-free-whatsapp-api" rel="noopener noreferrer"&gt;&amp;gt;Sign up as a beta participant&amp;lt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also check out the full range of Whapi.Cloud API features which includes account management, parsing of groups, channels, communities, mass checking of numbers against WhatsApp, ability to send buttons, surveys, media and more.&lt;br&gt;
&lt;a href="https://whapi.cloud/features" rel="noopener noreferrer"&gt;Learn more about Whapi.Cloud&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Using a virtual number for WhatsApp opens up many opportunities, providing privacy and convenience of working with the messenger. With its help, you can use regional numbers to enter new markets, automate mass registration and account management. This is especially useful for companies that value flexibility and scalability. Platforms like Whapi.Cloud offer powerful APIs for automating groups, mailings, and number verification. If you're looking for a truly feature-rich solution to work effectively with WhatsApp, try our API and unlock all its capabilities.&lt;/p&gt;

</description>
      <category>whatsapp</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
    <item>
      <title>WhatsApp Communities API: sending announcements and managing members</title>
      <dc:creator>WhatsApp API for developers</dc:creator>
      <pubDate>Fri, 04 Oct 2024 14:11:55 +0000</pubDate>
      <link>https://forem.com/whapicloud/whatsapp-communities-api-sending-announcements-and-managing-members-422o</link>
      <guid>https://forem.com/whapicloud/whatsapp-communities-api-sending-announcements-and-managing-members-422o</guid>
      <description>&lt;p&gt;Whapi.Cloud is an easy-to-use &lt;a href="https://whapi.cloud" rel="noopener noreferrer"&gt;WhatsApp API&lt;/a&gt; compatible with any programming language.  Knowing that managing communities in WhatsApp is time-consuming, we have implemented convenient and simple mechanisms for working with communities. Let's familiarize ourselves with them in more detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are WhatsApp Communities?
&lt;/h2&gt;

&lt;p&gt;Simplistically speaking, communities in WhatsApp are a super-group of several smaller individual groups.  To illustrate how the community structure works, take a look at the image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmcc2sm0dm2plf4242kck.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmcc2sm0dm2plf4242kck.png" alt="WhatsApp Community"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, Communities help avoid chaos in large WhatsApp groups by offering a structure where it's easy to manage threaded discussions and send announcements to all participants at once.&lt;/p&gt;

&lt;p&gt;You can try our Whapi.Cloud API right now: after signing up, you are given a trial channel, it is limited to five days and does not require a linked card. After that, you can continue on the free plan.&lt;br&gt;
This article will have more detailed instructions on how to get started: &lt;a href="https://support.whapi.cloud/help-desk/getting-started/getting-started" rel="noopener noreferrer"&gt;Let's Dive into Whapi.Cloud: A Three-Step Journey&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How it works?
&lt;/h2&gt;

&lt;p&gt;When you create a community, WhatsApp automatically creates a special group for announcements. While this may seem a bit unexpected, two groups with the same name are actually created. One is used as the “Announcements Group” to send messages to all members of the community, and the other is used for technical communication between groups. However, this won't create any difficulties in managing the community - you can easily work with them through the API.&lt;br&gt;
Let's explore an example to understand how everything functions technically. &lt;br&gt;
We'll begin by covering the basics — creating a new community.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating a new community
&lt;/h2&gt;

&lt;p&gt;To create a WhatsApp community through the API, you'll need to use the following endpoint:&lt;br&gt;
 &lt;code&gt;POST https://gate.whapi.cloud/communities&lt;/code&gt;&lt;br&gt;
Here is an example request to get a new community:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --request POST \
--url https://gate.whapi.cloud/communities \
--header 'accept: application/json' \
--header 'authorization: Bearer {YOUR_TOKEN}' \
--header 'content-type: application/json' \
--data '
{
"subject": "A new community of scientists",
"description": "This is where we bring together all our faculties to stay connected and up to date with the latest news"
}
'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After creating a community, you will get its unique identifier, which is needed to bind or unbind groups. When you request a list of groups, you will see two groups with the same name but different identifiers. Pay attention to the “announcements” string - only the second group has it. This is the group you should use to send announcements or add members.&lt;br&gt;
By the way, and in our documentation you will find sample requests in all popular programming languages, which can greatly facilitate the development of your integration&lt;br&gt;
And this is how the response from the system will look like, indicating the successful execution of the request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
"id": "120363326919215056@g.us",
"name": "A new community of scientists",
"conversationTimestamp": 1727856652,
"subject": "A new community of scientists",
"subjectOwner": "919984351847@s.whatsapp.net",
"subjectTime": 1727856652,
"size": 1,
"creation": 1727856652,
"owner": "919984351847@s.whatsapp.net",
"desc": "This is where we bring together all our faculties to stay connected and up to date with the latest news",
"descId": "9A7C840518933B604F7257DB",
"restrict": false,
"announce": false,
"isCommunity": true,
"isCommunityAnnounce": false,
"joinApprovalMode": false,
"memberAddMode": false,
"participants": [
{
"id": "919984351847@s.whatsapp.net",
"admin": "superadmin"
}
],
"author": "919984351847@s.whatsapp.net"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Adding Participants
&lt;/h2&gt;

&lt;p&gt;Now let's understand how to add a user to a WhatsApp community.&lt;br&gt;
Adding a user to a community also follows the principles of adding a participant to a separate WhatsApp group. For this, use endpoint:&lt;br&gt;
&lt;code&gt;POST https://gate.whapi.cloud/communities/{CommunityID}/participants&lt;/code&gt; &lt;br&gt;
An example of the request you need to pass can be found below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --request POST \
     --url https://gate.whapi.cloud/communities/120363326919215056%40g.us/participants \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "participants": [
    "61371989950",
    "919984651849"
  ]
}
'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Due to WhatsApp's anti-spam policy, some contacts will not be added to the group automatically!&lt;/li&gt;
&lt;li&gt;All group members are automatically added to the announcements group.&lt;/li&gt;
&lt;li&gt;Removing a group from the community also removes members from the announcement group.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Receiving information about community members
&lt;/h2&gt;

&lt;p&gt;It is often necessary to get general information about a community, such as the community name, description, community avatar and member details.&lt;br&gt;
To do this, the following endpoint will be needed:&lt;br&gt;
&lt;code&gt;GET https://gate.whapi.cloud/communities/{CommunityID}&lt;/code&gt;&lt;br&gt;
The API request will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --request GET \
     --url https://gate.whapi.cloud/communities/120363330016374615%40g.us \
     --header 'accept: application/json' \
     --header 'authorization: Bearer {Your_Token}'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will receive the response in the following form:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "id": "120363383016284615@g.us",
  "name": "The fans",
  "type": "group",
  "timestamp": 1726495201,
  "chat_pic": "https://pps.whatsapp.net/v/t61.24694-24/45953409_389421433863366_1005252150886406739_n.jpg?stp=dst-jpg_s96x96&amp;amp;ccb=11-4&amp;amp;oh=01_Q5AaID5KTLWAwXvRX9fgs8wo5ktRhbO6BA8_4BjhtULS9jn2&amp;amp;oe=670A3091&amp;amp;_nc_sid=5e03e0&amp;amp;_nc_cat=108",
  "not_spam": false,
  "last_message": {
    "id": "ASh2dw-wngBq53PmZvvVw",
    "type": "system",
    "subtype": "group_change_icon",
    "chat_id": "120363383016284615@g.us",
    "from": "919984351847",
    "from_me": true,
    "source": "system",
    "timestamp": 1727128547,
    "status": "pending"
  },
  "participants": [
    {
      "id": "306894857630",
      "rank": "admin"
    },
    {
      "id": "61393175919",
      "rank": "creator"
    },
    {
      "id": "905544751391",
      "rank": "admin"
    }
  ],
  "name_at": 1724862124,
  "description": "heavy music fans by country",
  "description_id": "6959470654CD9BE1FB509998",
  "created_at": 1724862124,
  "created_by": "61371989950"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is important to remember that you cannot get information about all members of a community if you are not an administrator of that community. If you are a member, you will only see the number of administrators and the community creator.&lt;br&gt;
However, you can get information about the members of groups that you are a member of as a community member.&lt;/p&gt;
&lt;h2&gt;
  
  
  Adding an existing WhatsApp group to a community
&lt;/h2&gt;

&lt;p&gt;To connect an existing WhatsApp group to a community, you need to know the community ID as well as the ID of the group you want to connect.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To get the group ID, use the method &lt;code&gt;GET https://gate.whapi.cloud/groups&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;To add the selected group to the community, you will need the method &lt;code&gt;PUT https://gate.whapi.cloud/communities/{CommunityID}/{GroupID}&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Removing a WhatsApp group from the community
&lt;/h2&gt;

&lt;p&gt;Sometimes you may need to remove a group from the community. To do this, use the following method&lt;br&gt;
&lt;code&gt;DELETE https://gate.whapi.cloud/communities/{CommunityID}/{GroupID}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To get the identifier of the required group, use the endpoint we specified earlier in the previous paragraph.&lt;/p&gt;
&lt;h2&gt;
  
  
  Sending an announcement to a WhatsApp community
&lt;/h2&gt;

&lt;p&gt;Of course, the main purpose of WhatsApp communities is to send announcements. Sending an announcement to a community is technically fully compliant and follows the rules for sending a message to a regular WhatsApp group. To send this message, use standard messaging methods.&lt;br&gt;
Let's consider sending a simple text message as an example. We will need an endpoint as well as the group ID with the announcements parameter:&lt;br&gt;
&lt;code&gt;POST https://gate.whapi.cloud/messages/text&lt;/code&gt; &lt;br&gt;
 In the request it will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --request POST \
     --url https://gate.whapi.cloud/messages/text \
     --header 'accept: application/json' \
     --header 'authorization: Bearer your_token' \
     --header 'content-type: application/json' \
     --data '
{
  "to": "120363330016384615@g.us",
  "body": "Hello, everybody!"
}
'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/PlVVoWkDb08"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Where the to parameter should contain the group ID and the body parameter should contain the text of your message. If you need to send a media file or document, just use the appropriate methods: &lt;br&gt;
to send an image &lt;a href="https://whapi.readme.io/reference/sendmessageimage" rel="noopener noreferrer"&gt;you will need the method&lt;/a&gt;&lt;br&gt;
&lt;code&gt;POST https://gate.whapi.cloud/messages/image&lt;/code&gt;&lt;br&gt;&lt;br&gt;
to send a document, &lt;a href="https://whapi.readme.io/reference/sendmessagedocument" rel="noopener noreferrer"&gt;use this method&lt;/a&gt;&lt;br&gt;
&lt;code&gt;POST https://gate.whapi.cloud/messages/document&lt;/code&gt;  &lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;As you can see, WhatsApp communities are a convenient and effective tool to increase interaction with your users. &lt;br&gt;
With our API, managing communities becomes even easier and faster, allowing you to easily organize and structure groups for effective communication.&lt;/p&gt;

&lt;p&gt;At the same time, using our provider opens up new possibilities in messenger automation! For example, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://whapi.cloud/whatsapp-check-numbers" rel="noopener noreferrer"&gt;Check for a number in WhatsApp&lt;/a&gt;; &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://whapi.readme.io/reference/getchats" rel="noopener noreferrer"&gt;Get a list of all your chats&lt;/a&gt;; &lt;/li&gt;
&lt;li&gt;Create and &lt;a href="https://whapi.readme.io/reference/createstory" rel="noopener noreferrer"&gt;send statuses&lt;/a&gt;;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://whapi.cloud/whatsapp-channels" rel="noopener noreferrer"&gt;Manage WhatsApp channels.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and more.&lt;/p&gt;

&lt;p&gt;We understand that you may have questions or need additional support. That's why our live support team is always available to help you at any stage of integration and utilization. Feel free to ask questions!&lt;/p&gt;

&lt;p&gt;We invite you to test our API and see for yourself how easy and convenient it is to manage communities through Whapi.Cloud. Get started today and get the most out of WhatsApp's capabilities for your business!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://whapi.cloud/features" rel="noopener noreferrer"&gt;View all Whapi.Cloud API features&lt;/a&gt;&lt;/p&gt;

</description>
      <category>whatsapp</category>
      <category>api</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Running WhatsApp bot on Node.js</title>
      <dc:creator>WhatsApp API for developers</dc:creator>
      <pubDate>Mon, 01 Apr 2024 10:40:36 +0000</pubDate>
      <link>https://forem.com/whapicloud/running-whatsapp-bot-on-nodejs-199e</link>
      <guid>https://forem.com/whapicloud/running-whatsapp-bot-on-nodejs-199e</guid>
      <description>&lt;p&gt;&lt;em&gt;Bot source code and step-by-step guide for setup and launch. Key features: sending messages to private chats and groups, creating groups, sending media files and products, receiving and reading messages, server tips&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For those who don't have time to read:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/Whapi-Cloud/nodejs-whatsapp-chatbot" rel="noopener noreferrer"&gt;Source code of a powerful WhatsApp bot on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/Whapi-Cloud/whatsapp-simple-node-js-bot" rel="noopener noreferrer"&gt;Github repository&lt;/a&gt; with a simple WhatsApp bot - &lt;strong&gt;great for beginners!&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7s8821gmny4usakavlea.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7s8821gmny4usakavlea.png" alt="Image description" width="800" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;A WhatsApp chatbot allows automatic responses to requests, sending notifications, requesting information, making communication efficient and available 24/7.&lt;/p&gt;

&lt;p&gt;This guide for programmers is a step-by-step instruction on setting up and launching your own chatbot using the Whapi.Cloud API on Node.JS, as well as demonstrating the key functions and capabilities of the gateway and bot.&lt;/p&gt;

&lt;p&gt;You will be able to use our source code in your project, easily modifying and supplementing the script's functionality. Based on the code, you can create your chatbot or any integration. Easily integrate it into existing workflows, continuing to use WhatsApp as usual!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtube.com/shorts/7tC0mvkn8fY" rel="noopener noreferrer"&gt;A short video demonstration of the bot in action&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Source Code
&lt;/h2&gt;

&lt;p&gt;The script of this chatbot includes basic functions that are often used by small and medium businesses and covers most tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sending a plain message;&lt;/li&gt;
&lt;li&gt;Sending media: image / file / video;&lt;/li&gt;
&lt;li&gt;Sending a contact (vCard);&lt;/li&gt;
&lt;li&gt;Sending a product;&lt;/li&gt;
&lt;li&gt;Creating a WhatsApp group;&lt;/li&gt;
&lt;li&gt;Sending a group invitation;&lt;/li&gt;
&lt;li&gt;Sending a message to a WhatsApp group;&lt;/li&gt;
&lt;li&gt;Receiving and processing incoming messages;&lt;/li&gt;
&lt;li&gt;Responding to an unknown command (for implementing menus, instructions, or a welcome message).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHyb: &lt;a href="https://github.com/Whapi-Cloud/nodejs-whatsapp-chatbot" rel="noopener noreferrer"&gt;https://github.com/Whapi-Cloud/nodejs-whatsapp-chatbot&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  WhatsApp API Provider
&lt;/h2&gt;

&lt;p&gt;Whapi.Cloud provides an easy-to-use API gateway compatible with any programming language. This allows you to integrate your website, store, app, or CRM with WhatsApp seamlessly.&lt;/p&gt;

&lt;p&gt;Our Cloud API is an independent development and has no restrictions for working with sending messages, groups, channels, statuses, calls, and other functionalities of your messenger. Additionally, access to the API has a fixed price, and no charges are made for sent messages. This is a key advantage of our simple and powerful API.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Connect to Whapi.Cloud
&lt;/h3&gt;

&lt;p&gt;Another advantage of our gateway is the speed of onboarding and startup. You will not need to undergo business verification or change your number. Connect your own number and continue using WhatsApp as usual!&lt;/p&gt;

&lt;p&gt;So, &lt;a href="https://panel.whapi.cloud/register" rel="noopener noreferrer"&gt;register at Whapi.Cloud&lt;/a&gt;. You will need a valid email address to pass email verification or a Google account.&lt;/p&gt;

&lt;p&gt;On the Dashboard, you will find a trial channel individually allocated for you. For the first 5 days, you will have the opportunity to test all the API functionality completely free.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff91n55v2fs7qmj2400o1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff91n55v2fs7qmj2400o1.png" alt="Free access to the API for 5 days" width="800" height="149"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Navigate to the page of this channel by simply clicking on it.&lt;/p&gt;

&lt;p&gt;Unlike other providers, we give you the opportunity to connect your existing WhatsApp or WhatsApp Business to the API. Simply scan the QR code as you do in WhatsApp Web, and you'll be ready to go in a few seconds. From Meta's perspective, this is a standard connection to WhatsApp Web, and if you do not use Whapi.Cloud for spamming, your number will continue to work in the usual manner.&lt;/p&gt;

&lt;p&gt;Skip the third step 'Channel Settings', as we won't need them right now.&lt;/p&gt;

&lt;p&gt;Great, now you have access to the &lt;strong&gt;API Token&lt;/strong&gt;, which will be required for testing and further work with the endpoints. Save this token, as it will come in handy more than once.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ighf3srh3ib1avpp31x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3ighf3srh3ib1avpp31x.png" alt="Image description" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's move to &lt;em&gt;config.js&lt;/em&gt; and replace the token variable by inserting your current key:&lt;br&gt;
&lt;code&gt;token: "YOUR_CHANNEL_TOKEN"&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Webhook Configuration
&lt;/h2&gt;
&lt;h3&gt;
  
  
  What is a Webhook and Why is it Needed
&lt;/h3&gt;

&lt;p&gt;To receive incoming data from your messenger, such as an incoming message or incoming call or a notification that someone has joined your group, you will need to use a Webhook.&lt;/p&gt;

&lt;p&gt;This technology will allow you to instantly receive notifications about any event in your WhatsApp and respond to it.&lt;/p&gt;

&lt;p&gt;In simple terms, for example: Contact A sent you a message -&amp;gt; The chatbot script received a message from Contact A -&amp;gt; Checked if this message is a command it recognizes -&amp;gt; Executed the script command (for example, sent a welcome message or sent a product, etc.)&lt;/p&gt;

&lt;p&gt;Thus, the two systems (our API gateway connected to WhatsApp and your chatbot) exchange information without the need for any external actions.&lt;/p&gt;

&lt;p&gt;Technically, upon receiving a message, the system will perform a POST request with a JSON body to the configured URL of your script. The JSON body will include all the information about the incoming message, such as text, sender's number, sending time, etc., allowing you to read this information on the fly.&lt;/p&gt;

&lt;p&gt;Let's move on to setting up this URL!&lt;/p&gt;
&lt;h3&gt;
  
  
  Locally or on a Server
&lt;/h3&gt;

&lt;p&gt;When developing a WhatsApp bot, you might want to test it locally before deploying it to a server. The simplest way to do this is to use tools like &lt;strong&gt;Ngrok&lt;/strong&gt;, which creates a secure tunnel to your localhost, allowing you to provide access to your local server from the internet.&lt;/p&gt;

&lt;p&gt;Let's take a test chatbot link from Ngrok right now. Download Ngrok from the official website and extract it. Open the terminal and navigate to the folder where Ngrok is stored.&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;./ngrok http PORT_NUMBER&lt;/code&gt;, replacing &lt;em&gt;PORT_NUMBER&lt;/em&gt; with the port your Express server is running on locally.&lt;br&gt;
Now you should have a public URL that you can use as a URL for your webhook.&lt;/p&gt;

&lt;p&gt;Copy this link into the config.js file:&lt;br&gt;
&lt;code&gt;botUrl: "https://84c7-151-33-282-113.ngrok-free.app/hook"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Attention, leave “/hook” at the end of the link! The chatbot script is currently programmed to this address!&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/gql85pOlYs4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Features of Hosting on a Server
&lt;/h3&gt;

&lt;p&gt;To receive incoming webhooks, it is necessary for the public IP address / host to be accessible from the internet. Thus, the Whapi.Cloud server will be able to send a request to your server at the specified address and deliver the incoming hook.&lt;/p&gt;

&lt;p&gt;Server configuration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Whapi.Cloud only works with webhooks that use HTTPS;&lt;/li&gt;
&lt;li&gt;Your endpoint must accept &lt;code&gt;POST/PUT/PATCH/DELETE&lt;/code&gt;;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Below, in the 'Deployment' chapter, we will talk about several publicly available services where you can host your chatbot.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuration and Various Events
&lt;/h3&gt;

&lt;p&gt;Channel and webhook settings in Whapi.Cloud offer extensive customization options that can be particularly useful in projects with individual requirements.&lt;/p&gt;

&lt;p&gt;However, to simplify the launch process, we have included the installation of necessary settings directly in the code of our chatbot, freeing you from the need to enter them manually. This allows you to focus on development without worrying about additional configuration.&lt;/p&gt;

&lt;p&gt;If you want to delve into customization options or need more detailed webhook setup, you can always consult the full list of options in the Whapi.Cloud Knowledge Base in the article: &lt;a href="https://support.whapi.cloud/help-desk/receiving/webhooks/detailed-webhook-settings" rel="noopener noreferrer"&gt;Detailed Webhook Settings&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhmjghfuj4xygx4t4hugr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhmjghfuj4xygx4t4hugr.png" alt="Example of webhook settings" width="800" height="853"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Whapi-Cloud/nodejs-whatsapp-chatbot" rel="noopener noreferrer"&gt;In the source code from GitHub&lt;/a&gt;, the webhook link is automatically assigned to your channel through an API method, so no further action is required on your part. Let's dive a bit deeper into webhook modes and the events about which our service can notify you.&lt;/p&gt;

&lt;p&gt;Currently, for sending a webhook, the &lt;code&gt;Method&lt;/code&gt; mode is selected. This method is particularly suited for detailed event handling, allowing the use of different HTTP methods for specific actions. Thus, the webhook will differentiate the sent requests and send them to different addresses, for example, &lt;em&gt;https://****/hook/messages&lt;/em&gt; (events related to messages) or &lt;em&gt;https://****/hook/statuses&lt;/em&gt; (events related to message statuses) or &lt;em&gt;https://****/hook/groups&lt;/em&gt; (events related to groups).&lt;br&gt;
There are two more modes for the webhook: &lt;code&gt;Body&lt;/code&gt; (directly sends the request body to the link) and &lt;code&gt;Path&lt;/code&gt; (fully specifies the API URL request).&lt;/p&gt;

&lt;p&gt;The event and the way we notify the original chatbot is POST Messages. This webhook tracks any changes related to new messages, including sent messages and incoming messages.&lt;/p&gt;

&lt;p&gt;Learn more about all the possible events (receiving information about groups, channels, calls, statuses, message changes, etc.), supported by our system, in the article: &lt;a href="https://support.whapi.cloud/help-desk/receiving/webhooks/our-webhooks-tracked-events" rel="noopener noreferrer"&gt;Our Webhooks (Tracked Events)&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Launching and Configuring the Bot
&lt;/h2&gt;

&lt;p&gt;Right now, you can test the chatbot! Make sure that the token and webhook address in config.js are correctly specified.&lt;/p&gt;

&lt;p&gt;Launching the chatbot is done by running the command &lt;code&gt;node index.js&lt;/code&gt; in the terminal from the project's root directory. Your bot should now be active and ready to operate.&lt;/p&gt;

&lt;p&gt;By sending a message to the number to which the bot is linked from another phone, you should receive an automatic response. If the bot does not react, we recommend referring to the 'Troubleshooting' section for diagnostics and resolving potential issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Predefined Settings (Group and Product)
&lt;/h2&gt;

&lt;p&gt;The &lt;em&gt;config.js&lt;/em&gt; file contains preset values, including group and product identifiers, which your chatbot uses for sending messages. To ensure the bot operates correctly in the context of your data, it's necessary to update these parameters according to your needs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;group: '&lt;a href="mailto:120363167596599603@g.us"&gt;120363167596599603@g.us&lt;/a&gt;'&lt;/li&gt;
&lt;li&gt;product: '6559353560856703'&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first identifier is for the group to which the chatbot will send the message. You can obtain this identifier by creating a group in WhatsApp or using an existing one. The group identifier can only be obtained through the API.&lt;/p&gt;

&lt;p&gt;For this, use the API call '&lt;strong&gt;Get Group List&lt;/strong&gt;' (method: &lt;a href="https://whapi.readme.io/reference/getgroups" rel="noopener noreferrer"&gt;https://whapi.readme.io/reference/getgroups&lt;/a&gt; in Documentation). The group identifier looks like this: &lt;em&gt;&lt;a href="mailto:120363194020948049@g.us"&gt;120363194020948049@g.us&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So, once you've found the group identifier you need, now copy it into config.js.&lt;/p&gt;

&lt;p&gt;Do the same with the products from your catalog (available only in the Business version of the app). Determine the product identifier that will be sent by your chatbot. You can get a list of products using the method &lt;a href="https://whapi.readme.io/reference/getproducts" rel="noopener noreferrer"&gt;https://whapi.readme.io/reference/getproducts&lt;/a&gt; in Documentation.&lt;/p&gt;

&lt;p&gt;Replace the preset values in config.js with your group and product identifiers. After making changes, save the file and restart the bot. It should now function using the new parameters, allowing you to fully test its operation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;p&gt;Various issues can arise during the testing and operation of the WhatsApp chatbot. Here are a few typical situations and recommendations for their resolution:&lt;/p&gt;

&lt;h3&gt;
  
  
  The Bot Does Not Respond to Incoming Messages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ensure you are sending messages to the number on which the bot is running from a different phone. The bot will not be able to respond to messages sent from the same number.&lt;/li&gt;
&lt;li&gt;If the bot does not respond to messages from other numbers, check the operation of webhooks. Use services to simulate webhooks, for example, &lt;a href="https://webhook.site/" rel="noopener noreferrer"&gt;Webhook.site&lt;/a&gt;, to ensure which path the callback requests are coming through. Afterwards, check if the path matches the one you have configured. Also, ensure your server responds with 200Ok.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you encounter difficulties, do not hesitate to contact our technical support for help. You can write in the web chat widget on our site or email &lt;a href="mailto:care@whapi.cloud"&gt;care@whapi.cloud&lt;/a&gt;. We will assist you and figure out exactly what's wrong with the webhook.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Bot Sends Messages Non-Stop
&lt;/h3&gt;

&lt;p&gt;Return to the original version of the code. Our script includes a check to determine whether a message is incoming or outgoing, to prevent getting into an infinite loop of sending messages. Infinite sending may occur if there is no check for outgoing messages in the code, causing the bot to call itself, or if there is a cyclic sending of messages in the code.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Bot Works in Some Chats, But Not in Others
&lt;/h3&gt;

&lt;p&gt;Check your tariff plan on Whapi.Cloud. If you are using the trial mode or the "Sandbox" tariff, interaction is limited to a certain number of chats per month (currently up to 5 chats). In such a case, the bot will not be able to process messages in the sixth chat and subsequent ones.&lt;/p&gt;

&lt;p&gt;It's important to remember that many issues can be prevented by carefully checking your chatbot's configuration and logic before launching. Regularly updating your code and paying attention to the details of settings can help avoid most typical errors. And our support team is always in touch and ready to assist you!&lt;/p&gt;

&lt;h2&gt;
  
  
  Deployment and Using Servers
&lt;/h2&gt;

&lt;p&gt;To ensure your WhatsApp chatbot is available 24/7, it needs to be hosted on a reliable hosting platform. You can use your server, but in this chapter, we will consider the three most popular platforms - Firebase, AWS, and Heroku - and go through the basic steps of deploying your bot on each of them.&lt;/p&gt;

&lt;p&gt;The choice of platform depends on your preferences, budget, and project requirements. Each of the considered platforms offers its unique features and advantages. Firebase and AWS Lambda provide powerful backend functionality without the need to manage a server, while Heroku offers simplicity in deploying applications based on Git.&lt;/p&gt;

&lt;h4&gt;
  
  
  Firebase
&lt;/h4&gt;

&lt;p&gt;Firebase offers Cloud Functions functionality, allowing you to run your bot without worrying about server infrastructure. In our opinion, this is the most optimal option.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a project in Firebase Console;&lt;/li&gt;
&lt;li&gt;Install Firebase CLI, following &lt;a href="https://firebase.google.com/docs/cli" rel="noopener noreferrer"&gt;the instructions&lt;/a&gt;;&lt;/li&gt;
&lt;li&gt;Initialize Firebase in your project directory with the command &lt;code&gt;firebase init&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;Deploy your bot using the command &lt;code&gt;firebase deploy --only functions&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  AWS (Amazon Web Services)
&lt;/h4&gt;

&lt;p&gt;AWS Lambda offers the ability to run code in response to triggers from other AWS services, making it a good choice for a bot.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Register or log in to AWS Management Console;&lt;/li&gt;
&lt;li&gt;Create a new Lambda function through the AWS console, selecting API Gateway as the trigger;&lt;/li&gt;
&lt;li&gt;Upload your bot's code into the Lambda function;&lt;/li&gt;
&lt;li&gt;Configure the API Gateway to interact with your bot and the outside world.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Heroku
&lt;/h4&gt;

&lt;p&gt;Heroku offers an easy-to-use platform for hosting applications, which can automatically deploy code from your Git repository.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create an account on Heroku;&lt;/li&gt;
&lt;li&gt;Install Heroku CLI and log in;&lt;/li&gt;
&lt;li&gt;Create a new Heroku app through the console or using the command &lt;code&gt;heroku create&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;Link your Git repository to Heroku and perform deployment with the commands &lt;code&gt;git push heroku master&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;Set the webhook URL provided by Heroku.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Expanding Functionality
&lt;/h2&gt;

&lt;p&gt;After successfully launching and testing your WhatsApp chatbot, there are numerous ways to further expand its functionality to make the bot even more useful and interactive for users. Here are some common use cases:&lt;/p&gt;

&lt;h3&gt;
  
  
  Sending files via link.
&lt;/h3&gt;

&lt;p&gt;Sending a media file via a link is very simple. The main condition is that the file itself must be directly accessible via the link (which is why Cloud services like Google Drive or Dropbox do not work as they do not provide direct file access). Use the &lt;em&gt;media&lt;/em&gt; parameter in any of the methods that allow sending media files. Read more in our article: &lt;a href="https://support.whapi.cloud/help-desk/sending/send-video-audio-image-document" rel="noopener noreferrer"&gt;Endpoint for sending a media file&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Distributing leads among groups.
&lt;/h3&gt;

&lt;p&gt;You will need the &lt;a href="https://whapi.readme.io/reference/creategroup" rel="noopener noreferrer"&gt;group creation function&lt;/a&gt;, as well as adding a participant to the group. Adding a participant to a group is straightforward, but there are some nuances. We described in detail in the article: &lt;a href="https://support.whapi.cloud/help-desk/groups/add-new-member-to-group" rel="noopener noreferrer"&gt;"Adding a new member to a group"&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  CRM Integration with WhatsApp.
&lt;/h3&gt;

&lt;p&gt;Technically, CRM integration is not much different from a chatbot, except that it adds an additional resource with its own API that needs to be utilized. Add functions that allow users to book services, order products, or receive up-to-date information from external sources in real time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://whapi.readme.io/reference/sendmessagetext" rel="noopener noreferrer"&gt;WhatsApp API Full Documentation&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Surveys as an alternative to buttons.
&lt;/h3&gt;

&lt;p&gt;Interactive buttons in WhatsApp are a very convenient tool for customer engagement. However, this feature is not available to most WhatsApp users. We advocate for making communication with users easier, so we offer you a convenient alternative - using surveys as buttons. &lt;a href="https://support.whapi.cloud/help-desk/hints/how-to-use-polls-as-buttons" rel="noopener noreferrer"&gt;Detailed article with NodeJS source code and how to use it&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Increasing customer engagement.
&lt;/h3&gt;

&lt;p&gt;Use &lt;a href="https://whapi.readme.io/reference/createstory" rel="noopener noreferrer"&gt;stories&lt;/a&gt;, change your number statuses, put likes and other emojis on your customers' messages, send voice messages - increase engagement in customer service.&lt;/p&gt;

&lt;h3&gt;
  
  
  Checking for WhatsApp availability on a number.
&lt;/h3&gt;

&lt;p&gt;Check whether a given phone number exists on WhatsApp or not. Determine which phone numbers are active and which cannot receive WhatsApp messages. Integrate into your application before making a broadcast! &lt;a href="https://support.whapi.cloud/help-desk/source-code/whatsapp-phone-number-checker" rel="noopener noreferrer"&gt;Source code on GitHub and instructions here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We provide comprehensive support to our clients! If you have any questions about bot operation, platform setup, or encounter technical difficulties, you can always count on our help.&lt;/p&gt;

&lt;p&gt;We hope this guide will help you successfully launch your WhatsApp chatbot. Good luck in your endeavors!&lt;/p&gt;

&lt;p&gt;The original article: &lt;a href="https://whapi.cloud/setting-up-chatbot-whatsapp-nodejs" rel="noopener noreferrer"&gt;https://whapi.cloud/setting-up-chatbot-whatsapp-nodejs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>node</category>
      <category>whatsapp</category>
    </item>
    <item>
      <title>WhatsApp API March Update: Short videos, the store, views on the stories</title>
      <dc:creator>WhatsApp API for developers</dc:creator>
      <pubDate>Fri, 29 Mar 2024 08:43:15 +0000</pubDate>
      <link>https://forem.com/whapicloud/whatsapp-api-march-update-short-videos-the-store-views-on-the-stories-35i1</link>
      <guid>https://forem.com/whapicloud/whatsapp-api-march-update-short-videos-the-store-views-on-the-stories-35i1</guid>
      <description>&lt;p&gt;Powerful gateway optimization and acceleration, sending short video messages and catalog, stories views and a large amount of other improvements&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgevcq4ltg2n70ijl5qz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsgevcq4ltg2n70ijl5qz.png" alt="Image description" width="800" height="553"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whapi.Cloud provides an easy to use API gateway that is compatible with any programming language. It will allow you to integrate your website, store, app or CRM with WhatsApp without nerves.&lt;br&gt;
&lt;a href="https://whapi.cloud/features"&gt;Our Cloud API&lt;/a&gt; is independently developed and has no restrictions to handle messaging, groups, channels, statuses, calls and other functionality of your messenger. At the same time, access to the API has a fixed price, there is no charge for sent messages. This is the key advantage of our simple and powerful API. Here we’ll talk about our March update.&lt;/p&gt;
&lt;h2&gt;
  
  
  Major Backend Upgrade Boosts Our WhatsApp API Performance
&lt;/h2&gt;

&lt;p&gt;For the past two weeks, we’ve been rigorously testing and analyzing data from our massive backend upgrade, which has significantly enhanced the performance of our WhatsApp API gateway. Our infrastructure has been optimized for maximum performance and efficiency.&lt;/p&gt;

&lt;p&gt;This comprehensive upgrade has not only improved channel uptime, but also allows you to process large volumes of chats and messages without any problems or delays.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;We have seen an increase in the speed of processing requests by 4–8 times!&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Sending short video messages
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zl4li5zhas6cblo7jee.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1zl4li5zhas6cblo7jee.png" alt="Image description" width="720" height="405"&gt;&lt;/a&gt;&lt;br&gt;
Whapi.Cloud API allow you to instantly share up to 60-second video in a new format&lt;/p&gt;

&lt;p&gt;Video messages on WhatsApp allow you to instantly record and share up to 60-second video messages directly in the chat. Method responsible for sending PTV to your chats:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://whapi.readme.io/reference/sendmessageshort"&gt;https://whapi.readme.io/reference/sendmessageshort&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Sending and customization of the catalog
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://whapi.readme.io/reference/sendcatalog"&gt;https://whapi.readme.io/reference/sendcatalog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sends the store linked to the phone number.&lt;/p&gt;

&lt;p&gt;The new API Call is responsible for generating and sending a “product” type message with a link to your store.&lt;/p&gt;

&lt;p&gt;The method allows to customize the image, title and description of the store.&lt;/p&gt;

&lt;p&gt;Allows you to send a store associated with any phone number, not just your own.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffm3d6bkha27zlf83dm89.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffm3d6bkha27zlf83dm89.png" alt="Image description" width="576" height="1280"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Information about views of stories and messages in the group
&lt;/h2&gt;

&lt;p&gt;Now you can get information about who and how many times your status (stories) or a message in a group has been viewed. All you need is the message ID.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://whapi.readme.io/reference/getmessageviewstatuses"&gt;https://whapi.readme.io/reference/getmessageviewstatuses&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See who’s been looking at your statuses and messages!&lt;/p&gt;

&lt;p&gt;Example of a response to a request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "statuses": [
    {
      "id": "IXiocXvwx5tM6M1U0.Ma.g-0okBq526t1E1XA-EoRX88I",
      "code": 4,
      "status": "read",
      "recipient_id": "120363540426484704@g.us",
      "timestamp": "1710423370",
      "viewer_id": "61398176983" // The number of the contact who viewed your status
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Webhook to view status
&lt;/h3&gt;

&lt;p&gt;You will now be able to receive notifications when your stories are viewed with details: which number viewed your status and when.&lt;/p&gt;

&lt;p&gt;Make sure you have &lt;code&gt;PUT statuses&lt;/code&gt; enabled in your channel settings.&lt;/p&gt;

&lt;p&gt;An example of an incoming webhook when viewing a story:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "statuses": [
    {
      "id": "yqJ_muc_kO8-1CcA-E8JdK1c",
      "code": 4,
      "status": "read",
      "recipient_id": "stories",
      "timestamp": "1710423471",
      "viewer_id": "61398176983" // The number of the contact who viewed your status
    }
  ],
  "event": {
    "type": "statuses",
    "event": "put"
  },
  "channel_id": "MANTIS-M72HC"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Channel settings: Several new features
&lt;/h2&gt;

&lt;p&gt;A few of the new settings are described below&lt;/p&gt;

&lt;h3&gt;
  
  
  Automatic loading of profile pictures of all contacts when authorizing a number
&lt;/h3&gt;

&lt;p&gt;There is a new channel setting, “&lt;em&gt;media init_avatars&lt;/em&gt;”. Set it to &lt;code&gt;true&lt;/code&gt; to not download all avatars of contacts immediately after the number is connected, which will reduce the amount of requests in WhatsApp and increase security, especially &lt;a href="https://support.whapi.cloud/help-desk/blocking/warming-up-new-phone-numbers-for-whatsapp-api"&gt;for new numbers&lt;/a&gt;. Activate this setting if you need to know about contact images immediately (e.g. you have developed a webchat service)&lt;/p&gt;

&lt;h3&gt;
  
  
  Offline mode for your number (affects iPhone notifications)
&lt;/h3&gt;

&lt;p&gt;The “&lt;em&gt;offline_mode&lt;/em&gt;” parameter allows the account to not be labeled as online. This solves the problem for Iphones with not receiving push notifications.&lt;/p&gt;

&lt;p&gt;If &lt;code&gt;true&lt;/code&gt;, the API will not send the online status to the server when you connect. This will allow you to receive push notifications to devices connected to the number. After changing the setting, you need to re-authorize the channel.&lt;/p&gt;

&lt;h3&gt;
  
  
  Uploading old/new messages
&lt;/h3&gt;

&lt;p&gt;Parameter “&lt;em&gt;full_history&lt;/em&gt;” — allows you to fully synchronize the history of messages in the local cache. This means that after connecting the number to the channel, you will immediately have access to the entire history of correspondence. If &lt;code&gt;true&lt;/code&gt;, all messages will be cached after connection. If &lt;code&gt;false&lt;/code&gt;, only new messages will be cached. After changing the setting, you need to re-authorize.&lt;/p&gt;

&lt;h2&gt;
  
  
  CSV channels export in partner account
&lt;/h2&gt;

&lt;p&gt;We gave our partners the opportunity to export information about all channels in the project in CSV format. The exported file has information about channels at the moment of downloading: Name, ID, Phone Number, Work Period, Status, Mode. We have a very favorable approach to &lt;a href="https://whapi.cloud/become-a-partner"&gt;White Label WhatsApp API&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fleief9vrtqmdr3phll4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fleief9vrtqmdr3phll4z.png" alt="Image description" width="720" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Fixed
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Fixed getting products;&lt;/li&gt;
&lt;li&gt;Fixed Unread parameter value calculation when getting Chats;&lt;/li&gt;
&lt;li&gt;Fixed Total parameter value counting when getting groups;&lt;/li&gt;
&lt;li&gt;Fixed getting messages from channel (&lt;a href="https://whapi.readme.io/reference/getmessagesnewsletter"&gt;Get newsletter messages&lt;/a&gt;) ;&lt;/li&gt;
&lt;li&gt;Business version of the application is defined more accurately;&lt;/li&gt;
&lt;li&gt;File Link Sending Without an Extension.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Remember, if you have any questions or issues along the way, our support team is always available to help. We value every user and strive to ensure that your experience with our API is as smooth and efficient as possible.&lt;/p&gt;

&lt;p&gt;You can write to the web chat widget on our main website, or in your personal account. Or write to us by e-mail: &lt;a href="mailto:care@whapi.cloud"&gt;care@whapi.cloud&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Replacing interactive buttons in WhatsApp API</title>
      <dc:creator>WhatsApp API for developers</dc:creator>
      <pubDate>Wed, 28 Feb 2024 17:24:07 +0000</pubDate>
      <link>https://forem.com/whapicloud/replacing-interactive-buttons-in-whatsapp-api-3mja</link>
      <guid>https://forem.com/whapicloud/replacing-interactive-buttons-in-whatsapp-api-3mja</guid>
      <description>&lt;p&gt;Interactive buttons in WhatsApp are a very convenient tool for working with users. &lt;br&gt;
Many observations have confirmed that it is easier for a customer to reply with one button than to type a reply in the usual way, accordingly, the conversion rate of responses can increase by 1.5 - 2 times. However, this feature is not available to every user, but only for WhatsApp business accounts that work via Meta Cloud API.&lt;/p&gt;

&lt;p&gt;We have already told you separately &lt;a href="https://whapi.cloud/whatsapp-business-api-to-choose"&gt;in the article in detail about how our API differs from Cloud API Meta&lt;/a&gt;, what are the differences in general, what are the advantages of each gateway. So let's leave it to you to study it on your own and get straight to the point!&lt;/p&gt;

&lt;p&gt;We are in favor of facilitating communication with users, so we offer you a profitable alternative - polls. &lt;br&gt;
For the user, polls and interactive buttons are functionally similar. Surveys also require the user to click on the desired line, so this simplification is considered comfortable.&lt;/p&gt;

&lt;p&gt;To work with surveys, you will need to use the &lt;strong&gt;&lt;a href="https://whapi.readme.io/reference/sendmessagepoll"&gt;POST /messages/poll&lt;/a&gt;&lt;/strong&gt; method. You can find out more about it and test it here: &lt;br&gt;
&lt;a href="https://whapi.readme.io/reference/sendmessagepoll"&gt;https://whapi.readme.io/reference/sendmessagepoll&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Sending a poll
&lt;/h2&gt;

&lt;p&gt;Sending a poll is quite easy, you need a few parameters in the body of the request: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;to&lt;/code&gt; - in this parameter specify the Chat ID of the recipient (group, or personal number) to whom we send the survey. (Send only numbers, without formatting or masks).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;title&lt;/code&gt; - here specify the full message to the conversation partner, the text of your question.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;options&lt;/code&gt; - specify the user's response options. There can be from 2 to 12 of them. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;count&lt;/code&gt; - this parameter affects the amount of response options from the conversation partner. For example, several or only one answer from the whole survey.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import requests

url = "https://gate.whapi.cloud/messages/poll"

payload = {
    "options": ["Eyelash extensions", "Eyebrow correction and coloring", "Massage", "I'm fine with everything!"],
    "title": "Thank you for visiting the Etteri salon! We are interested in ensuring that our beauty salon meets all your wishes. What service do you think is missing in our beauty salon?",
    "count": 1
}
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer YPZapY69pl9j0xQpxoMqqsKMoBat1p8h"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzaupip97mkr4hlpbewx8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzaupip97mkr4hlpbewx8.jpg" alt="Example of a message sent to a customer" width="800" height="1182"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Tracking a user's selection in a poll
&lt;/h2&gt;

&lt;p&gt;Polls are of a customized type &lt;code&gt;"type": "poll"&lt;/code&gt;. At the same time, each option that can be voted for by the client also has its own identifier. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"results": [
          {
            "name": "I'm good",
            "voters": [],
            "count": 0,
            "id": "YCUAzJ4pYtRgSP+k/udEwRdvHxxuRQmNCrdTKz/K2TU="
          },
          {
            "name": "Can't complain",
            "voters": [],
            "count": 0,
            "id": "f61LjJqD6KEefNsuDQrvFXAB1iufPN3U1ykIOxD8DRc="
          }
        ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Whereas when you vote, the webhook will receive full details of the selected option in the poll.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
 "id": "f61LjJqD6KEefNsuDQrvFXAB1iufPN3U1ykIOxD8DRc=",
 "name": "Can't complain",
 "count": 1,
 "voters": [
    "61399176983@s.whatsapp.net"
  ]
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way, you will be able to handle your customers' responses and respond appropriately. For example, responding with a pre-prepared answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Node.Js source code
&lt;/h2&gt;

&lt;p&gt;We have prepared a simple and easy to understand &lt;a href="https://github.com/Whapi-Cloud/whatsapp-api-send-poll-example"&gt;source code&lt;/a&gt; for you to implement in your survey response integration or bot:&lt;br&gt;
&lt;a href="https://github.com/Whapi-Cloud/whatsapp-api-send-poll-example"&gt;https://github.com/Whapi-Cloud/whatsapp-api-send-poll-example&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>whatsapp</category>
      <category>programming</category>
    </item>
    <item>
      <title>WhatsApp bot integration with Google Sheets to send out messages [Source code + Step-by-Step Guide]</title>
      <dc:creator>WhatsApp API for developers</dc:creator>
      <pubDate>Tue, 13 Feb 2024 09:39:38 +0000</pubDate>
      <link>https://forem.com/whapicloud/whatsapp-bot-integration-with-google-sheets-to-send-out-messages-source-code-l26</link>
      <guid>https://forem.com/whapicloud/whatsapp-bot-integration-with-google-sheets-to-send-out-messages-source-code-l26</guid>
      <description>&lt;p&gt;We are pleased to announce the source code release of our script designed to simplify WhatsApp integration with Google Sheets for efficient mailings. This script automatically sends text messages from specified Google Sheets cells to phone numbers also specified in the table cells. After sending the message, the script records the status of each sent message back to the table. Furthermore, if a response is received from the customer, the bot will record the first message received in a separate cell, providing a convenient way to track feedback.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Whapi-Cloud/googlesheets-sender"&gt;Google Sheets WhatsApp Sender&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This source code is open source for use in your current work or can serve as a great starting point for developing your own project. We believe it will become a powerful tool in your arsenal for implementing effective communications and marketing strategies via WhatsApp, using the power of Google Sheets to organize and automate your processes.&lt;/p&gt;

&lt;h2&gt;
  
  
  To use the script functionality you will need:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Api-token of the channel from Whapi.Cloud service;&lt;/li&gt;
&lt;li&gt;Link to Google SpreadSheet, with service account access;&lt;/li&gt;
&lt;li&gt;Key.js from Google Project;&lt;/li&gt;
&lt;li&gt;Set the Webhook address to which the bot will send responses.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Full step-by-step instructions are available in our knowledge base: &lt;a href="https://support.whapi.cloud/help-desk/source-code/whatsapp-api-google-sheets"&gt;https://support.whapi.cloud/help-desk/source-code/whatsapp-api-google-sheets&lt;/a&gt;&lt;/p&gt;

</description>
      <category>whatsapp</category>
      <category>node</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to send a post to WhatsApp Channel via API</title>
      <dc:creator>WhatsApp API for developers</dc:creator>
      <pubDate>Wed, 27 Dec 2023 09:40:22 +0000</pubDate>
      <link>https://forem.com/whapicloud/how-to-send-a-post-to-whatsapp-channel-4na6</link>
      <guid>https://forem.com/whapicloud/how-to-send-a-post-to-whatsapp-channel-4na6</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/IVxsndTXp-4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Our Cloud API supports &lt;a href="https://whapi.cloud/whatsapp-channels" rel="noopener noreferrer"&gt;WhatsApp Channels&lt;/a&gt;, a brand-new feature introduced by WhatsApp. It’s a unidirectional broadcast tool where administrators can send text, photos, videos, stickers, and polls. And users receive push notifications of updates from the channel like a private message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flr3s0y451e18ixweyqxa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flr3s0y451e18ixweyqxa.png" alt="Automate and integrate WhatsApp channels with our API" width="496" height="536"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To work with &lt;a href="https://whapi.cloud/features" rel="noopener noreferrer"&gt;our service&lt;/a&gt;, you need to have an account and connect any number to an available channel on the dashboard. In order to automate WhatsApp, you need to sync our API with your phone number. Here's how: navigate to your personal dashboard, select your channel, and get a QR code there.&lt;/p&gt;

&lt;p&gt;To send a message to the channel you need to know the channel ID.&lt;/p&gt;

&lt;p&gt;In order to find out the identifier use the following method: &lt;a href="https://whapi.readme.io/reference/getnewsletters" rel="noopener noreferrer"&gt;GET /newsletters&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import requests

url = "https://gate.whapi.cloud/newsletters?count=100"

headers = {
    "accept": "application/json",
    "authorization": "Bearer iBNBwpo21BDCsbdvVwShV4czcXPbBmcs"
}

response = requests.get(url, headers=headers)

print(response.text)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The channel ID looks like this: &lt;em&gt;120363171744447809@newsletter&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Once you know the channel ID, you can use the method to send any message. For example, a &lt;a href="https://whapi.readme.io/reference/sendmessagetext" rel="noopener noreferrer"&gt;text message&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import requests

url = "https://gate.whapi.cloud/messages/text"

payload = {
    "typing_time": 0,
    "to": "120363171744447809@newsletter",
    "body": "Hello, world!"
}
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "authorization": "Bearer iBNBwpo21BDCsbdvVwShV4czcXPbBmcs"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the &lt;code&gt;“to”&lt;/code&gt; parameter you insert the ID of the channel ( &lt;em&gt;120363171744447809@newsletter&lt;/em&gt; ) you want to send the message to. And in the &lt;code&gt;“body”&lt;/code&gt;, the text of the message.&lt;/p&gt;




&lt;p&gt;Remember, if you have any questions or issues along the way, our support team is always available to help. We value every user and strive to ensure that your experience with our API is as smooth and efficient as possible.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Ut53JhMyPCM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;You can write to the web chat widget on our main website, or in your personal account. Or write to us by e-mail: &lt;a href="mailto:care@whapi.cloud"&gt;care@whapi.cloud&lt;/a&gt;&lt;/p&gt;

</description>
      <category>api</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>python</category>
    </item>
  </channel>
</rss>
