BuildShip Logo
BuildShip Community

AI WhatsApp Bot

Create your own WhatsApp bot powered by GPT and Meta's WhatsApp Business API.

340

Report this template

Select the reason for reporting

Describe the issue in detail

Share template

Link to template

https://templates.buildship.com/template/Nmu4x1MCZNX8/

Inputs

Trigger Data

Editor
This is a static example using sample inputs. Remix the template to run it with your own values.

Output

Read me

📖 Read Me

Create a basic GPT-powered WhatsApp bot. These instructions provide a summary of the full documentation, which can be found here.

Prerequisites

Before you can create a chatbot on WhatsApp, you need to have the following:

  1. A Meta developer account. Sign up for a Meta Developer Account here.
  2. A business app. Learn how to create a business app here.
  3. A verified business on Facebook. Click here to learn how to verify your business.
  4. A registered WhatsApp business phone number.
  5. Access to the official WhatsApp Business API.

Bot Template

This flow handles Meta's webhook verification and powers a GPT-based WhatsApp bot. It uses the WhatsApp bot trigger with the Auto-Responder and GPT Text Generator nodes to send sarcastic replies. You can fully customize the responses to match your preferred tone.

Step 1: Get App ID and App Secret

On the Meta dashboard, go to your app and click App settings where you'll find your App ID and App Secret.

Step 2: Configuring the WhatsApp Bot trigger

Trigger Inputs:

  • Path: This field specifies the endpoint path for receiving webhook requests from the WhatsApp API. The default value is /whatsapp-bot.
  • App ID: (mentioned in previous step) This field requires entering the App ID. It is a unique identifier for your application, displayed on top of your Meta App Dashboard.
  • App Secret: (mentioned in previous step) This field requires entering the App Secret. It is a secret key used for authentication and securing communication with the WhatsApp Cloud API.
  • Verification Token: This can be any text you want to use, just take note of it as you'll need it later. Then ship 🚀 your workflow and copy the endpoint URL.

Step 3: Webhook verification in Meta

  1. To connect the WhatsApp API to BuildShip, you need to configure a webhook. In your Meta Developer Account, go to "WhatsApp" >> "Configuration" >> "Edit Webhook". Enter the endpoint URL you copied from step 1 as well as the verify token you saved earlier. Then click "Verify" and "Save".
  2. To receive all messaging events from WhatsApp in BuildShip, you need to subscribe to messaging on webhooks. Click "Manage" (Webhook fields) and subscribe to messages.
  3. Test setup with test message
    1.  Go to "WhatsApp" >> "API Setup"
    2. For the from number select the test number that Meta provides.
    3. For the to number select a number from the recipient phone number list or add your own if not listed.
    4. Click send message to test if you're receiving a message from WhatsApp. If it works, you'll receive a Hello World message from WhatsApp.

Step 4: Configuring the OpenAI Text Generator node

The OpenAI Text Generator node is used to generate automatic responses to incoming messages. You'll need to select your OpenAI API key or just select the "Use Credits" option.

Step 5: Configuring the Auto-Responder node

The Auto-Responder node is used to send the generated response to the incoming message. You'll be required to add the an Access Token. You can use the temporary access token provided by Meta for testing purposes.

In the Meta dashboard, you can get this by going to WhatsApp >> API Setup >> Temporary access token.

Note: This access token is temporary and will expire after 24 hours. See creating a permanent token for a permanent token.

Step 5: Testing the bot

First, ship 🚀 your workflow.

If everything is set up correctly, you can now test the bot by sending a message to the test WhatsApp phone number which you can obtain in the Meta dashboard from WhatsApp >> API setup.

Then you should receive an automatic response generated by OpenAI ✅.

If you don't receive a response, check the workflow for any errors, and make sure you followed all the steps correctly.

🔗 Resources

Any additional information like demo links or YouTube tutorials.