Site icon JD Bots

Calling WhatsApp Business Cloud API from Postman | WhatsApp ChatGPT Bot | Part 2

Learn to call the WhatsApp Business Cloud API from Postman in Part 2 of our WhatsApp ChatGPT Bot series. Step-by-step guide to enhance your chatbot development.

Introduction

In Part 2 of our WhatsApp ChatGPT Bot series, we’ll delve into calling the WhatsApp Business Cloud API using Postman. This step-by-step guide will help you enhance your chatbot development skills, ensuring seamless integration and communication with WhatsApp. Whether you’re a developer aiming to refine your API interaction or a business owner looking to optimize customer engagement, this tutorial is designed to provide you with practical insights and hands-on experience. Let’s continue building your WhatsApp ChatGPT Bot and take it to the next level!

You can find all the parts for this series at WhatsApp ChatGPT using .NET C# | Beginner Friendly Series.

Prerequisites

Before starting with Part 2, ensure you have the following prerequisites in place:

  1. Completion of Part 1: Complete the steps in Part 1 to set up your WhatsApp Business app and send your first message.
  2. Meta Developer Account: Sign up for a Meta Developer account and have your WhatsApp Business app set up.
  3. Postman Installed: Download and install Postman on your system.
  4. WhatsApp Business Cloud API Access: Ensure you have access to the WhatsApp Business Cloud API.
  5. API Credentials: Have your API key, phone number ID, and WhatsApp Business account ID ready.
  6. Basic Understanding of APIs: Familiarity with API requests and responses.

Complete Video Tutorial

Step 1: Open up your Existing App

Go to Meta for Developers. Click on “My Apps”.

Open your existing app that we created in our last blog, named “MyFirstWAApp”.

On the left sidebar, under “WhatsApp,” click on “API Setup.”

Step 2: Setup the API

Select your “from” and “to” phone numbers and prepare the CURL operation.

Step 3: Calling WhatsApp Business Cloud API from Postman to Send a Text Message

  1. Open Postman: Launch Postman on your system.
  2. Create a New Request: Click on “New” and select “Request.”
  3. Set Request Type: Set the request type to “POST.”
  4. Enter the URI: Copy the URI from the API Setup page and paste it into the request URL field in Postman.
   https://graph.facebook.com/v19.0/YOUR_PHONE_NUMBER_ID/messages
  1. Add Headers:
  1. Set the Request Body:
   {
     "messaging_product": "whatsapp",
     "to": "RECIPIENT_PHONE_NUMBER",
     "type": "text",
     "template": {
        "name": "hello_world",
        "language": {
            "code": "en_US"
        }
    }
   }
  1. Send the Request: Click “Send” to execute the request and send the message.

Below is what your request looks like:

  {
    "messaging_product": "whatsapp",
    "to": "RECIPIENT_PHONE_NUMBER",
    "type": "template",
    "template": {
        "name": "hello_world",
        "language": {
            "code": "en_US"
        }
    }
  }

Send the request, and below is what the response looks like:

Check your WhatsApp to see if you received the message.

Conclusion

That’s it! You’ve successfully called the WhatsApp Business Cloud API from Postman to send your first WhatsApp message.


Exit mobile version