WhatsApp Business Platform > Cloud API
This guide will help you send and receive your first message using Cloud API. You will also learn how to configure Webhooks for use with a sample app.
This guide is intended for people developing applications for themselves or their organization. If you are developing an application that will be used by other businesses, see Solution Providers.
You will need:
At this point, if you created a new app, you’ll be prompted to Add products to your app. Scroll down, and under WhatsApp, select Set up. Otherwise, select your app from the My Apps screen, and you can follow the same instructions again to add the WhatsApp product to your app.
If you have a Meta Business Account (MBA), you will be prompted to attach it when adding the WhatsApp product to your app. If you don’t have an MBA, you’ll be taken through some prompts that will help you create one. Once your MBA is attached to your application, you’ll be ready to start testing.
Adding the WhatsApp product to your app does a few things for you:
Add a valid WhatsApp number where you can send test messages.
In the left-hand menu of the App Dashboard, navigate to WhatsApp > API Setup. Under Send and receive messages, select the To field and choose Manage phone number list.
You can add any valid WhatsApp number as a recipient. The recipient number will receive a confirmation code in WhatsApp that can be used to verify the number.
Once you verify the recipient number, it should now be selected in the To field. Repeat this process if you’d like to add another recipient, up to 5 in total.
Send the pre-approved hello_world
template message to your chosen recipient number.
In the WhatsApp > API Setup panel:
Alternatively, you can copy the cURL command, then paste it into a new terminal window and run it.
Notice that the code indicates you are sending a template message (”type”:”template”
) and identifying a specific template to use (”name”:”hello_world”
).
With webhooks, you can receive real-time HTTP notifications of changes to specific objects. In WhatsApp, webhooks can notify you of many events in your app, like message delivery and read notifications, and even account changes.
Add a callback URL in order to see the contents of webhooks. Follow our Sample Callback URL for Webhooks Testing guide to clone our sample app, which accepts webhooks notifications and displays their JSON payloads on-screen.
Once your webhook is set up, resend the template message and then reply back to it. You should see 4 separate webhook notifications: The message send, delivered, and read notifications, and the incoming message contents.
With your test business number and test WhatsApp business account, you can begin to develop your application. When you use these test assets, you don’t pay to send messages as you work to develop your app.
Once you are ready to start sending messages to your customers, you can add a real business phone number in the API Setup panel and create a real WhatsApp Business Account.