Lección 1 · Módulo 5: Omnichannel Integration: WhatsApp, Telegram and MCP
Setting up the official WhatsApp Business Cloud API and message templates
- Set up a Meta app with a WhatsApp test number
- Collect the three values every automation needs
- Create message templates and know when you must use them
Why this matters
Many small businesses answer every customer by hand on the free WhatsApp Business app, so the work grows with every message and nothing outside the phone can help. The official Cloud API opens a door for software, but it has its own rules: three identifiers to collect, a token that can expire overnight, and a 24-hour window that decides which messages you may send. This lesson sets up that door correctly so the routine messages can later go to an agent.
Key ideas
- The Cloud API is the software door. The Business app is for one person typing; the Cloud API lets your agent send and receive messages. Meta hosts it, so you run no WhatsApp servers.
- Three values unlock every automation. The phone number ID says which number sends, the WhatsApp Business Account ID (WABA ID) holds your templates, and the access token acts as a password for the API.
- The 24-hour window decides what you can send. A customer message opens a 24-hour window in which any reply is allowed. Each new customer message restarts the clock.
- Templates are pre-approved messages with blanks. Outside the window, only a template works. For example, a booking reminder might read "Hi {{1}}, your tasting is on {{2}} at {{3}}." The sender stores the template name and fills in the values, so the payload looks like this:
values = ["Mona", "Tuesday", "3 pm"]
print(values) # the customer sees: Hi Mona, your tasting is on Tuesday at 3 pm
- Temporary tokens are for testing only. The token on the setup page expires after 24 hours. Real work needs a system user with a token that does not expire.
Try it before you watch
A customer messaged your shop on Monday at 10:00. On Wednesday at 9:00 you want to send a follow-up with free text. Is that allowed, and what would you send instead?
Show answerHide answer
No. Monday's message opened a 24-hour window that closed on Tuesday at 10:00, so by Wednesday only an approved template can reach the customer. You would send a pre-approved utility template with placeholders. This shows that the window is measured from the customer's last message.
Words to know
- Cloud API: Meta's hosted service that lets software send and receive WhatsApp messages.
- Access token: a long secret string that proves your software is allowed to use the API.
- Phone number ID: Meta's ID for the number that sends messages; it is not the phone number itself.
- WABA ID: the WhatsApp Business Account ID, the account that holds your numbers and templates.
- Webhook: a web address you own that Meta calls whenever something happens, such as an incoming reply.
- Template category: the label Meta gives a template (marketing, utility or authentication), which affects its price and approval.
What to watch for
- Watch where the three values are copied from on the API setup page, and which one is the long ID rather than the phone number.
- Notice how the window clock restarts with each customer message, and why the follow-up on Friday needed a template.
- Pay attention to why the temporary token fails the next morning and what the system user fixes.
Apréndelo con tu tutor en la pizarra en vivo
Puntos clave del video
Your phone is not a platform
- Customers already live on WhatsApp
- Bookings, prices and invoices arrive as chats
- The Business app on a phone cannot talk to an agent
- The official door is the Cloud API
layout: full
parts:
app: {chip: Business app, sub: "One person, by hand", icon: smartphone}
api: {chip: Cloud API, sub: "Software can talk", icon: plug}
wa: {box: WhatsApp, holds: [app, api], icon: message-circle}
steps:
- at: "Meet Sara"
note: "Sara runs a cake shop"
- at: "her phone buzzes nonstop"
highlight: app
note: "Every evening, nonstop"
- at: "all on WhatsApp"
zoom_out: wa
note: "Prices, bookings, invoices"
- at: "depends on her thumbs"
highlight: app
note: "Every reply by hand"
- at: "an AI agent to answer"
highlight: app
note: "An agent should reply"
- at: "no door that software"
highlight: app
note: "No door for software"
- at: "official door is"
highlight: api
note: "The official door"
- at: "open that door properly"
highlight: api
note: "Open it properly" What you will learn
- Set up a Meta app with a WhatsApp test number
- Collect the three values every automation needs
- Create message templates and know when you must use them
layout: full
parts:
setup: {chip: Meta app, sub: "Test number, 15 min", icon: rocket}
values: {chip: Three values, sub: "Copy them safely", icon: key-round}
tpl: {chip: Templates, sub: "Approved messages", icon: file-text}
plan: {box: This lesson, holds: [setup, values, tpl], icon: list-checks}
steps:
- at: "Here's the plan"
zoom_out: plan
note: "Three goals"
- at: "set up a Meta developer app"
highlight: setup
note: "Meta app and test number"
- at: "fifteen minutes the first time"
highlight: setup
note: "About fifteen minutes"
- at: "collect the three values"
highlight: values
note: "Three values"
- at: "every automation tool"
highlight: values
note: "n8n, Make, your code"
- at: "learn about message templates"
highlight: tpl
note: "When templates apply"
- at: "the one rule that decides"
highlight: tpl
note: "One rule decides"
- at: "builds on solid ground"
highlight: plan
note: "Solid ground" App versus API
- Business app: one person replying by hand
- API: software sends and receives
- Cloud API is hosted by Meta, no servers to run
- Simplest start: a fresh number for the API
layout: full
parts:
app: {chip: Business app, sub: "One person, by hand", icon: smartphone}
api: {chip: API, sub: "Software sends, receives", icon: plug}
wb: {box: WhatsApp, holds: [app, api], icon: message-circle}
steps:
- at: "Let's compare the two ways"
zoom_out: wb
note: "Two ways to use WhatsApp"
- at: "On the left is the Business app"
highlight: app
note: "Left: the app"
- at: "nothing outside the phone"
highlight: app
note: "Nothing outside can read it"
- at: "On the right is the API"
highlight: api
note: "Right: the API"
- at: "Think of it as a service window"
highlight: api
note: "A service window"
- at: "The Cloud API is hosted by Meta"
highlight: api
note: "Hosted by Meta"
- at: "the simplest start is a fresh number"
highlight: api
note: "Use a fresh number"
- at: "coexistence option"
highlight: app
note: "Coexistence for existing numbers" The setup path
- Meta Business account (your company's profile)
- Developer app at developers.facebook.com
- Add the WhatsApp product to the app
- Use the free test number, add your phone as a recipient
- Send the hello world test message
layout: full
parts:
account: {chip: Business account, sub: "Your company profile", icon: building-2}
app: {box: Developer app, holds: [account], icon: code}
test: {chip: Test number, sub: "Free to start", icon: phone}
wa: {box: WhatsApp product, holds: [app, test], icon: message-circle}
steps:
- at: "one box at a time"
highlight: account
note: "One box at a time"
- at: "you need a Meta Business account"
highlight: account
note: "1. Business account"
- at: "go to developers.facebook.com"
zoom_out: app
note: "2. Create the developer app"
- at: "add the WhatsApp product"
zoom_out: wa
highlight: wa
note: "3. Add the WhatsApp product"
- at: "free test number straight away"
highlight: test
note: "4. Free test number"
- at: "add your own phone"
highlight: test
note: "5. Add your phone as recipient"
- at: "sample hello world message"
highlight: test
note: "6. Send hello world"
- at: "the pipe works"
highlight: wa
note: "The pipe works" Three values to copy
- Phone number ID: which number sends
- WhatsApp Business Account ID: where templates live
- Access token: your password for the API
- The temporary token expires after 24 hours
layout: full
parts:
pid: {chip: Phone number ID, sub: "Which number sends", icon: hash}
waba: {chip: WABA ID, sub: "Where templates live", icon: book-open}
tok: {chip: Access token, sub: "Your API password", icon: key-round}
setup: {box: API setup page, holds: [pid, waba, tok], icon: settings}
steps:
- at: "On the API setup page"
zoom_out: setup
note: "Three values"
- at: "Copy them somewhere safe"
note: "Store them safely"
- at: "phone number ID says which"
highlight: pid
note: "Which number sends"
- at: "often shortened to WABA ID"
highlight: waba
note: "Where templates live"
- at: "access token is like a password"
highlight: tok
note: "Your API password"
- at: "stops working after 24 hours"
highlight: tok
note: "Expires after 24 hours"
- at: "fix it for production later"
highlight: tok
note: "Fix it for production" How one message travels
- Your agent calls the Graph API
- WhatsApp delivers to the customer
- Replies come back through a webhook
layout: side
direction: TB
components:
agent: {kind: service, label: Your agent}
graph: {kind: api, label: Graph API}
wa: {kind: cloud, label: WhatsApp Cloud}
cust: {kind: user, label: Customer}
hook: {kind: function, label: Webhook}
links: [agent->graph, graph->wa, wa->cust, wa->hook, hook->agent]
steps:
- at: "five pieces work together"
show: all
- at: "calls Meta's Graph API"
flow: ["agent>graph: POST messages"]
- at: "passes it along to WhatsApp"
flow: ["graph>wa"]
- at: "delivers it to the customer"
flow: ["wa>cust: reminder"]
- at: "answers yes"
flow: ["cust>wa: YES"]
- at: "Replies travel the other way"
flow: ["wa>hook: event"]
- at: "notifies your webhook"
highlight: [hook]
- at: "hands the message to your agent"
flow: ["hook>agent"]
- at: "receiving through the webhook"
highlight: [hook]
note: "Next lesson: receiving" The 24-hour window
- A customer message opens a 24-hour window
- Inside it: free-form replies, any text or media
- Outside it: only approved templates
- Each new customer message resets the clock
layout: full
parts:
clock: {chip: 24-hour clock, sub: "Starts on each message", icon: clock}
free: {chip: Free text, sub: "Any reply, media, PDF", icon: message-square}
tpl: {chip: Template, sub: "Approved, pre-written", icon: file-text}
chat: {box: Customer chat, holds: [clock, free, tpl], icon: message-circle}
steps:
- at: "This is the rule"
highlight: clock
note: "The rule behind everything"
- at: "24-hour customer service window opens"
highlight: clock
note: "A window opens"
- at: "Inside that window your agent"
zoom_out: chat
highlight: free
note: "Inside: any reply"
- at: "Outside that window, you can't"
highlight: tpl
note: "Outside: templates only"
- at: "The only way to start or restart"
highlight: tpl
note: "Start or restart: template"
- at: "resets the clock"
highlight: clock
note: "Each message resets it"
- at: "no matter how friendly"
highlight: tpl
note: "Still a template" Message templates
- Pre-written messages Meta reviews before use
- Categories: marketing, utility, authentication
- Placeholders like {{1}} fill in per customer
- Utility = order updates, reminders, invoices
tree:
Message template:
Fixed text:
Placeholders:
Categories: [Marketing, Utility, Authentication]
direction: down
steps:
- at: "A message template is a pre-written message"
grow: Message template
note: "Pre-written, reviewed by Meta"
- at: "Think of a printed form with blanks"
highlight: "Fixed text"
note: "A form with blanks"
- at: "placeholders, written as one inside"
highlight: Placeholders
note: "Placeholders: {{1}}, {{2}}"
- at: "filled with each customer's name"
highlight: Placeholders
note: "Filled in per customer"
- at: "You create templates in WhatsApp Manager"
highlight: none
note: "Made in WhatsApp Manager"
- at: "pick a category"
grow: Categories
note: "Pick a category"
- at: "Marketing is for promotions"
highlight: Marketing
note: "Promotions"
- at: "Utility is for things"
highlight: Utility
note: "Expected messages"
- at: "Authentication is for one-time login codes"
highlight: Authentication
note: "One-time login codes"
- at: "Meta charges per template message"
highlight: none
note: "Priced per message"
- at: "Utility is usually cheaper"
highlight: Utility
note: "Usually cheaper"
- at: "Approval often takes minutes"
highlight: none
note: "Minutes, sometimes a day" Worked example: a booking reminder
import json
TEXT = ("Hi {{1}}, your cake tasting is on {{2}}"
" at {{3}}. Reply YES to confirm.")
values = ["Mona", "Tuesday", "3 pm"]
preview = TEXT
for i, v in enumerate(values, start=1):
preview = preview.replace("{{%d}}" % i, v)
payload = {
"messaging_product": "whatsapp",
"to": "201001234567",
"type": "template",
"template": {
"name": "tasting_reminder",
"language": {"code": "en_US"},
"components": [{"type": "body", "parameters": [
{"type": "text", "text": v} for v in values]}],
},
}
print("Customer sees:", preview)
print(json.dumps(payload["template"]["components"])) Common mistake: building on sand
- The temporary token dies overnight
- Fix: a system user with a permanent token
- Discounts hidden in utility templates get recategorised
- Free text to cold leads fails outside the window
layout: full
parts:
tok: {chip: Temporary token, sub: "Dies overnight", icon: key-round}
sys: {chip: System user, sub: "Token that never expires", icon: shield-check}
tpl: {chip: Utility template, sub: "No promotions inside", icon: file-text}
wf: {box: Your workflow, holds: [tok, sys, tpl], icon: workflow}
steps:
- at: "Here's the mistake"
zoom_out: wf
note: "The mistake most projects make"
- at: "builds a lovely workflow"
highlight: tok
note: "Works in testing"
- at: "it works all afternoon"
highlight: tok
note: "Works all afternoon"
- at: "the next morning every message fails"
highlight: tok
note: "Next morning: failures"
- at: "The fix is a system user"
highlight: sys
note: "A system user"
- at: "generate a token that doesn't expire"
highlight: sys
note: "Token that never expires"
- at: "Store it in your tool's credentials"
highlight: sys
note: "Keep it in credentials"
- at: "verify your business in Business Settings"
highlight: sys
note: "Verify your business"
- at: "Two more traps"
highlight: none
note: "Two more traps"
- at: "a discount into a utility template"
highlight: tpl
note: "No discounts in utility"
- at: "sending free text to a lead"
highlight: none
note: "Free text to cold leads fails" Recap
- The Cloud API is WhatsApp's door for software
- Keep three values: phone number ID, WABA ID, a system user token
- Outside the 24-hour window, only templates work
layout: full
parts:
api: {chip: Cloud API, sub: "Software's door", icon: plug}
vals: {chip: Three values, sub: "Phone ID, WABA, token", icon: key-round}
win: {chip: 24-hour window, sub: "Free replies inside", icon: clock}
root: {box: Sara's agent, holds: [api, vals, win], icon: bot}
steps:
- at: "Let's wrap up"
zoom_out: root
note: "Three takeaways"
- at: "the WhatsApp Business app on a phone"
note: "Phone app: for people"
- at: "the Cloud API is the door"
highlight: api
note: "The door for software"
- at: "hosted by Meta so you run no servers"
highlight: api
note: "Hosted by Meta"
- at: "every automation needs three values"
highlight: vals
note: "Three values"
- at: "for real work that token comes from a system user"
highlight: vals
note: "System user token"
- at: "opens a 24-hour window"
highlight: win
note: "24-hour window"
- at: "outside it, only approved templates"
highlight: win
note: "Outside: templates only"
- at: "Sara's laptop can do the talking"
note: "Laptop does the talking"
- at: "her phone can finally rest"
note: "Her phone can rest" Your exercise
- Create a developer app and add WhatsApp
- Send hello world from the test number to your phone
- Submit one utility template with two placeholders
- Note your three values in a password manager
layout: full
parts:
app: {chip: Developer app, sub: "Add WhatsApp, send hello", icon: code}
tpl: {chip: Utility template, sub: "Two placeholders", icon: file-text}
vals: {chip: Three values, sub: "Keep them safe", icon: key-round}
ex: {box: Your exercise, holds: [app, tpl, vals], icon: target}
steps:
- at: "Now it's your turn"
zoom_out: ex
note: "Your turn, one sitting"
- at: "Create a Meta developer app"
highlight: app
note: "Developer app"
- at: "add the WhatsApp product"
highlight: app
note: "Add WhatsApp"
- at: "send the hello world message"
highlight: app
note: "Hello world to your phone"
- at: "pick a business you know"
highlight: none
note: "A salon, tutor or shop"
- at: "submit one utility template"
highlight: tpl
note: "Utility template, two placeholders"
- at: "a booking reminder with a name"
highlight: tpl
note: "For example a booking reminder"
- at: "Write down your phone number ID"
highlight: vals
note: "Note the three values"
- at: "keep them in a password manager"
highlight: vals
note: "Password manager"
- at: "plug those values into an agent"
highlight: none
note: "Next lesson: the agent"
- at: "even sends invoices as files"
highlight: none
note: "Invoices as files" Transcripción
Your phone is not a platform. Meet Sara. She runs a small online cake shop, and every evening her phone buzzes nonstop. Customers ask about prices, book tasting appointments and chase their invoices, all on WhatsApp. She uses the free WhatsApp Business app, so every reply depends on her thumbs, and the pile of orders keeps growing. So what happens when she wants an AI agent to answer for her? The phone app has no door that software can walk through. The official door is the WhatsApp Business Cloud API, run by Meta. In this lesson we'll open that door properly, so the owner can finally hand the routine messages to an agent.
What you will learn. Here's the plan for the next few minutes. First, you'll set up a Meta developer app and get a free test number for WhatsApp, which takes about fifteen minutes the first time. Second, you'll collect the three values that every automation tool, from n8n to Make to your own code, will ask you for. Third, you'll learn about message templates: what they are, why Meta insists on them, and the one rule that decides when you can send a normal message and when you need a template. Get these right now, and the rest of this module builds on solid ground.
App versus API. Let's compare the two ways a business can use WhatsApp. On the left is the Business app on your phone. It's great for one person replying by hand, but nothing outside the phone can read or send messages through it. On the right is the API, which stands for application programming interface, where software sends and receives messages. Think of it as a service window: instead of a person tapping a screen, your software hands over a request and gets a reply. The Cloud API is hosted by Meta, so you don't run any WhatsApp servers yourself. Usually a number is used by one or the other, so the simplest start is a fresh number for the API. Meta now also offers a coexistence option for some existing app numbers.
The setup path. Let's walk the setup path slowly, one box at a time. First, you need a Meta Business account, which is simply your company's profile inside Meta. Next, go to developers.facebook.com, create an app, and pick the WhatsApp or Business option when Meta asks what the app is for. Inside that app, add the WhatsApp product. Meta then gives you a free test number straight away, so you can experiment before registering your real one. On the same screen, add your own phone as an allowed recipient; the test number can only message up to five verified numbers. Send yourself the sample hello world message, and if it lands on your phone, the pipe works.
Three values to copy. On the API setup page you'll find three values. Copy them somewhere safe, because every tool in this course asks for them. The phone number ID says which of your numbers is sending; note that it's a long ID, not the phone number itself. The WhatsApp Business Account ID, often shortened to WABA ID, is the account where your templates and numbers live. And the access token is like a password that proves your software is allowed to send. The token shown on that page is temporary and stops working after 24 hours. That's fine for testing today, and we'll fix it for production later in this lesson.
How one message travels. Here's the whole picture, and five pieces work together. Your agent, which could be an n8n workflow or a Python script, calls Meta's Graph API with a booking reminder. The Graph API passes it along to WhatsApp. WhatsApp delivers it to the customer's phone. Now the customer answers yes. Replies travel the other way: WhatsApp notifies your webhook, which is a web address you own that Meta pings whenever something happens, like a doorbell for your software. The webhook hands the message to your agent. Sending is this lesson; receiving through the webhook is the next one.
The 24-hour window. This is the rule that shapes everything. When a customer messages you, a 24-hour customer service window opens, like a clock starting on the wall. Inside that window your agent can send any reply it likes: free text, images, a PDF invoice. Outside that window, you can't send free-form messages anymore. The only way to start or restart a conversation is with a pre-approved message template. Every new message from the customer resets the clock. So if a lead asked about wedding cakes on Monday and you want to follow up on Friday, that follow-up must be a template, no matter how friendly your agent's reply would be.
Message templates. A message template is a pre-written message that Meta reviews before you're allowed to use it. Think of a printed form with blanks: the text is fixed, and placeholders, written as one inside double curly braces, two, three and so on, get filled with each customer's name, date or amount. You create templates in WhatsApp Manager and pick a category. Marketing is for promotions. Utility is for things the customer expects, like booking reminders, order updates and invoices. Authentication is for one-time login codes. Meta charges per template message, with prices that depend on category and country. Utility is usually cheaper than marketing, and a utility template sent while the 24-hour window is open costs nothing. Approval often takes minutes, sometimes a day.
Worked example: a booking reminder. Let's build a real utility template for Sara's shop: a tasting reminder with three placeholders, the name, the day and the time. The loop shows what the customer will actually see by swapping each numbered placeholder for its value. Below that is the payload, the package of data your agent sends to Meta. Notice you don't send the template text itself; you send its name, its language and the values in order. Run it, and the first line prints: Customer sees: Hi Mona, your cake tasting is on Tuesday at 3 pm. Reply YES to confirm. The second line is the list of values that n8n or your code sends with the template name.
Common mistake: building on sand. Here's the mistake that breaks most first projects. Someone builds a lovely workflow with the temporary token, it works all afternoon, and the next morning every message fails with an error. The fix is a system user: in Business Settings, create a system user, give it access to your app and WhatsApp account, and generate a token that doesn't expire. Store it in your tool's credentials, never in plain workflow text. To go live you'll also add your real number, a payment method and verify your business in Business Settings. Two more traps. Sneaking a discount into a utility template gets it recategorised as marketing or rejected. And sending free text to a lead who never wrote to you will simply fail.
Recap. Let's wrap up. First, the WhatsApp Business app on a phone is for people, while the Cloud API is the door your agent uses, hosted by Meta so you run no servers. Second, every automation needs three values: the phone number ID, the WhatsApp Business Account ID and an access token, and for real work that token comes from a system user so it never expires overnight. Third, a customer message opens a 24-hour window for free replies; outside it, only approved templates can reach people. With that, Sara's laptop can do the talking and her phone can finally rest.
Your exercise. Now it's your turn, and it's very doable in one sitting. Create a Meta developer app, add the WhatsApp product and send the hello world message from the test number to your own phone. Then pick a business you know, a salon, a tutor or a small shop, and submit one utility template with two placeholders, for example a booking reminder with a name and a time. Write down your phone number ID, your WhatsApp Business Account ID and your token, and keep them in a password manager. Next lesson, we'll plug those values into an agent that receives, replies and even sends invoices as files.
Explora las animaciones
Las animaciones del video, exactas y en vivo: reprodúcelas, pausa, arrastra el control deslizante o salta a un paso a tu propio ritmo.
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Responde todas las preguntas y luego comprueba. Apruebas con 70%; puedes intentarlo las veces que quieras.
Resumen de la lección
- Lectura
- Video visto
- Cuestionario aprobado (70%)
- The Cloud API is WhatsApp's door for software
- Keep three values: phone number ID, WABA ID, a system user token
- Outside the 24-hour window, only templates work