SMS and WhatsApp
Connect WhatsApp (Meta) to your app
What is WhatsApp (Meta)?
WhatsApp’s business service, run by Meta, lets your app send and receive WhatsApp messages from a business number.
- What it costs
- Setting up is free and needs no card. Meta charges per message after a free monthly allowance (1,000 replies to customers per number); prices depend on the country.
- Time needed
- About 30 minutes for a first test, longer for a permanent setup. You need a Facebook account, your phone and your email.
- If you skip it
- Your app still works. Only the WhatsApp messages stay off until you connect it.
What you can build with WhatsApp (Meta)
How to get it, step by step
Create a Meta app with WhatsApp
- Sign in to Facebook, then open developers.facebook.com and press Get Started. Confirm the codes Meta sends to your phone and email.
- Open developers.facebook.com/apps and press Create App. Type an app name and your email.
- Choose Connect with customers through WhatsApp, then press Next.
- Pick your business portfolio, or create a new one. Press Next, then Create app.
- Press Start using the API. This opens the API Setup page.
- On API Setup, connect a Messaging account: choose one from the list, or press Create a WhatsApp Business account.
Get your phone number ID
- On the API Setup page, choose a number in the From list. Meta gives you a free test number to start with.
- The Phone number ID for that number is shown on the same page.
- To test, type your own WhatsApp number in To, then press Send message.
Get a permanent access code
- The Generate access token button on API Setup gives a code that stops working within hours — fine for a quick test, not for your app.
- For one that lasts, open Meta Business Settings (business.facebook.com/settings) and press System users, then Add. Give it a name and the Admin role.
- Select that system user and press Assign assets. Give it Full control of your app and of your WhatsApp account, then press Assign assets.
- Press Generate token, choose your app, tick whatsapp_business_messaging and whatsapp_business_management, and press Generate token.
- Copy it straight away and keep it safe.
Get the app secret
- In developers.facebook.com/apps, open your app.
- Go to Settings, then Basic.
- Find App Secret and reveal it. Meta may ask for your Facebook password.
Which value goes in which box
- Phone number ID
WHATSAPP_PHONE_NUMBER_IDNot secret - The long number shown as the Phone number ID. It is NOT the phone number itself.
- Permanent access code
WHATSAPP_ACCESS_TOKENKeep private - The long code from the last step. Meta calls it an “access token”: a long secret code that lets your app send messages as your business.
- App secret
WHATSAPP_APP_SECRETKeep private - The text shown as the App Secret. It lets your app check that messages really came from Meta.
Watch out for
- The test number can only message numbers you added on the API Setup page. Real customers need your own business number.
- The quick code from Generate access token expires within hours — if your app stops sending the next day, that is why. Use the permanent one.
- The access code and app secret are both secret. Keep it private, like a password.
- You can only send free-form messages within 24 hours of the customer writing to you; outside that, WhatsApp needs approved message templates.