Skip

00/Business

WhatsApp Cloud API setup in Costa Rica: complete step-by-step guide 2026

How to integrate the official Meta WhatsApp Cloud API in Costa Rica: Business Manager, business verification, message templates, Next.js + Vercel webhook, USD 0.0085 per-message cost and common pitfalls.

Fecha
May 22nd, 2026
Tiempo de lectura
10 min read
Autor
By Jafeth JimΓ©nez

WhatsApp Cloud API is the official Meta endpoint for sending automated messages to WhatsApp users. It is not the WhatsApp Business mobile app β€” it is an HTTP API your server calls via code. In Costa Rica, setup from scratch takes 3–7 business days, costs USD 0.0085 per template message, and replaces the illegal scrapers (WhatsApp Web automation, baileys, whatsapp-web.js) that end up with your number banned. This guide is what we apply at every Sirius client integrating WhatsApp: clinics, restaurants, ecommerce, fintech.

πŸ’‘ TL;DR: Create Business Manager, verify business with cedula juridica, add a dedicated number, get UTILITY templates approved, ship a webhook on Next.js + Vercel. Cost: USD 0.0085/message in CR. Time: 3–7 days. Do not use scrapers β€” Meta bans numbers and violates the TOS.

Why Cloud API and not scrapers or WhatsApp Web

Before Cloud API, there were two popular ways to "automate WhatsApp": WhatsApp Web scraping with libraries like whatsapp-web.js or baileys, and gray services like early ChatAPI or Wati. Both are a bad idea today:

Approach Risk Real cost
WhatsApp Web scraper Number ban within weeks, violates Meta TOS USD 0 + your business
Gray API (unofficial) No SLA, can shut down overnight USD 50–200/month
WhatsApp Cloud API Official from Meta, supported, scalable USD 0.0085/msg
BSP (Twilio, 360dialog) Official via intermediary, human support USD 0.0085–0.013

Scrapers work until they stop working: Meta detects automated patterns and bans the number. We have seen clients lose the WhatsApp number used for the entire operation because the previous agency built a cheap scraper β€” recovering it is nearly impossible. Cloud API is free to configure, official, and backed by Meta's SLA. The only cost is USD 0.0085 per UTILITY template message in Costa Rica.

Prerequisites before you start

Before touching Business Manager, have ready: (1) your company's cedula juridica (in Costa Rica you download the digital certification from the Registro Nacional in 5 minutes), (2) a dedicated phone number NOT registered on regular WhatsApp or the WhatsApp Business app β€” a separate Kolbi prepaid SIM (~USD 2) works, or a Twilio/Vonage VoIP if you need an international number, (3) a corporate email (not a personal Gmail) to create Business Manager, (4) admin access to an HTTPS domain for the webhook (Next.js + Vercel gives you HTTPS automatically with a custom domain). Without these 4, do not start.

πŸ“Š If you are integrating WhatsApp as part of a larger project, use the interactive quote tool β€” 4 questions in 30 seconds, USD range for the full scope.

Cloud API direct vs Twilio vs 360dialog: when to use which

There are three official ways to use WhatsApp Cloud API:

Provider Cost per msg (CR) Setup Support When to use it
Cloud API direct USD 0.0085 (UTILITY) Free Meta email 80% of projects: you have technical team, want minimum cost
Twilio USD 0.005 + tier Free Human 24/7 You already use Twilio for SMS or need enterprise SLA
360dialog USD 0.0085 + setup USD 50 + USD 35/mo Human CET hours Multi-country in Europe, visual sending dashboard

Pragmatic recommendation: start with Cloud API direct. If after 6 months you need more control, human support, or advanced features (scheduled sends from a panel, A/B testing), migrating to Twilio or 360dialog takes 2–3 days. Starting with a BSP when you do not need one is paying overhead for nothing.

Message structure: session vs template (the 24-hour window)

This is the most critical concept of WhatsApp Cloud API and where 70% of developers get it wrong:

Session message (Service Conversation): when a user messages you first, a 24-hour window opens during which you can reply with any type of message (free text, images, audio, documents) without it being a template. This is free inside the window β€” perfect for conversational bots or customer support.

Template message: when YOU initiate the conversation, or reply after the 24-hour window, you must use a template pre-approved by Meta. This is what you pay for (USD 0.0085 UTILITY in CR). Templates have variables and are categorized:

  • UTILITY: reminders, confirmations, OTPs, status updates. USD 0.0085.
  • MARKETING: promotions, offers, launches. USD 0.0114.
  • AUTHENTICATION: exclusively 2FA codes. USD 0.0085.

If your app is 100% reactive (only replies when the user writes), you never use templates and everything is free. If your app sends scheduled notifications (appointments, alerts, reminders), you live in the template world.

Pre-approved templates: 3 real examples

These are real templates we have approved for clients. Copy them as a starting point and adjust to your case.

Template 1 β€” Booking confirmed (UTILITY)

Category: UTILITY Β· Language: Spanish (Costa Rica) or English Variables: {{1}} customer name, {{2}} service, {{3}} date and time, {{4}} location

Hi {{1}}, your booking for {{2}} is confirmed βœ…

Date: {{3}}
Location: {{4}}

If you need to cancel or reschedule, just reply to this chat.

Approves in minutes. Works for clinics, restaurants, beauty salons, repair shops. Learn more in our guide on the WhatsApp appointment system for clinics in Costa Rica.

Template 2 β€” Time reminder (UTILITY)

Category: UTILITY Β· Variables: {{1}} name, {{2}} service, {{3}} time remaining, {{4}} location

{{1}}, reminder for your {{2}} in {{3}}. πŸ“ {{4}}. If anything comes up, message us here.

Variant with buttons: add [Confirm] [Reschedule] [Cancel] and your webhook receives the callback with the button pressed.

Template 3 β€” Verification code (AUTHENTICATION)

Category: AUTHENTICATION Β· Variables: {{1}} code

{{1}} is your verification code. Do not share it with anyone. Expires in 10 minutes.

The AUTHENTICATION category was created by Meta to replace SMS-OTP. Similar cost (USD 0.0085) but with 98% open rate vs 90% for SMS. Moving from SMS to WhatsApp drops the signup-flow bounce rate by 25–40%.

Webhook server setup with Next.js + Vercel

The webhook is the piece that receives events from Meta: incoming messages, send status (sent β†’ delivered β†’ read), button clicks. Without a webhook, your app is blind.

Endpoint structure

In Next.js 14+ with App Router, create app/api/whatsapp/webhook/route.ts with two handlers:

import { NextRequest, NextResponse } from 'next/server'

const VERIFY_TOKEN = process.env.WHATSAPP_VERIFY_TOKEN!

export async function GET(req: NextRequest) {
  const params = req.nextUrl.searchParams
  if (params.get('hub.mode') === 'subscribe' && params.get('hub.verify_token') === VERIFY_TOKEN) {
    return new NextResponse(params.get('hub.challenge'), { status: 200 })
  }
  return new NextResponse('Forbidden', { status: 403 })
}

export async function POST(req: NextRequest) {
  const body = await req.json()
  processWebhookEvent(body).catch(console.error) // async β€” Meta expects 200 OK in < 5s
  return NextResponse.json({ status: 'ok' })
}

Inside processWebhookEvent you parse body.entry[0].changes[0].value to extract messages (messages[0].type === 'text' | 'button') or statuses (statuses[0].status === 'delivered' | 'read' | 'failed') and route them to your business logic.

Sender function

Create lib/whatsapp.ts to send templates. The base call is a POST to https://graph.facebook.com/v20.0/{PHONE_NUMBER_ID}/messages with Authorization: Bearer {TOKEN} and a body with messaging_product: 'whatsapp', the recipient, type: 'template', and the template object with name, language (es_CR or en_US) and components with parameters. It returns a message_id you use to correlate the webhook event.

Vercel deployment

  1. Push the code to a Git repo.
  2. Connect the repo in Vercel.
  3. In Vercel β†’ Project β†’ Settings β†’ Environment Variables add WHATSAPP_TOKEN, WHATSAPP_PHONE_NUMBER_ID, WHATSAPP_VERIFY_TOKEN.
  4. Set up a custom domain (automatic HTTPS).
  5. In Meta Business Manager β†’ WhatsApp β†’ Configuration β†’ Webhook β†’ URL: https://yourdomain.com/api/whatsapp/webhook. Verify Token: the same value as your env. Subscribe to messages and message_status.

Done. Your server now receives events in production. If you combine this with a transactional email system like Resend for fallbacks, you have full notification coverage.

Real costs in Costa Rica: the full math

Real volume for an average business using WhatsApp for operations:

Use case Messages/month Monthly cost
Medical clinic (appointments) 400 USD 3.40
Restaurant (reservations) 800 USD 6.80
Ecommerce (confirmations + OTP) 2,000 USD 17.00
Fintech (bulk OTPs) 10,000 USD 85.00
Multi-client operator 50,000 USD 425.00

Compare against SMS (USD 0.04–0.08 per message in Costa Rica): the same volume on SMS costs 5–10x more, with half the open rate and no interactive buttons.

Typical recurring infrastructure: Vercel Pro USD 20 + Resend USD 0–20 + Supabase USD 25 + WhatsApp messages USD 3–85 by volume = USD 50–150/month.

If you have a specific vertical (clinics, restaurants, hotels), check our packages at /servicios/clinics and /servicios/restaurants β€” they include the full WhatsApp Cloud API setup.

Common errors and how to avoid them

These are the mistakes we see in every project. Read them twice.

1. Number blocked due to accelerated warm-up

By week 2 your quality rating drops to "Low" and Meta permanently throttles you to 250 conversations/day because you started sending 1,000 messages/day from day 1 to users without clear opt-in (block ratio >1%). Solution: start with 50–100 conversations/day during the first week, only to active customers who messaged YOU first. Ramp gradually: 250 β†’ 500 β†’ 1,000 β†’ 5,000 over 4–6 weeks, holding "High" for 24 straight hours with real traffic so Meta opens the next tier.

2. Templates rejected for promotional language

UTILITY template rejected with the reason "Promotional content in UTILITY category" because you used words like "offer", "discount", "do not miss". UTILITY must be strictly transactional. Solution: if you need to promote, use the MARKETING category (USD 0.0114, requires explicit opt-in) and save UTILITY for reminders and confirmations. "Your appointment is tomorrow" β†’ UTILITY. "Take 20% off" β†’ MARKETING.

3. Webhook returns 500 and Meta stops sending events

You stop receiving messages after a deploy because your handler runs synchronous operations (DB queries, API calls) before responding to Meta, which expects 200 OK in under 5 seconds. Solution: respond 200 OK immediately and process the event in the background β€” use Vercel waitUntil or a queue (Upstash, Inngest, BullMQ). The pattern processWebhookEvent(body).catch(console.error); return NextResponse.json({ ok: true }) (no await) fixes it.

4. Template variables rejected for lack of context

Template rejected for "Insufficient context in variables" because you registered it as {{1}} {{2}} {{3}} with no text between variables. Solution: each variable needs textual context: "Hi {{1}}, your appointment for {{2}} is on {{3}}". Fill in the sample data fields with realistic values β€” Meta uses them to validate.

5. Migrating from a scraper to Cloud API with the same number

You want to move your current number to Cloud API and Meta says "Number already registered" because the scraper left active sessions or the number is tied to the WhatsApp Business app. Solution: close all sessions (Settings β†’ Linked devices β†’ Log out all), uninstall the app, and from Business Manager β†’ Add phone number select "Migrate". Meta asks for an SMS code β€” takes 5–10 minutes.

Summary

WhatsApp Cloud API is the only serious way to integrate WhatsApp in production in Costa Rica. It is official, scalable, cheap (USD 0.0085 per message), and replaces the gray scrapers that end with your number banned.

Item Detail
Setup time 3–7 business days
Configuration cost Free
Cost per UTILITY message in CR USD 0.0085
Cost per MARKETING message in CR USD 0.0114
Initial tier 250 conversations/day
Typical stack Next.js + Vercel + Supabase
Template approval 1 minute to 24 hours
Business verification 24–72 hours with cedula juridica
Common blocks Accelerated warm-up, wrong-category templates

The technical keys: Cloud API direct > BSP for 80% of cases in Costa Rica; dedicated number (not your regular WhatsApp one); UTILITY templates for transactional, MARKETING for promotions; webhook responds 200 OK in under 5 seconds; gradual tier warm-up over 4–6 weeks; HTTPS mandatory (Vercel gives it for free).

If you are coming from a scraper, migrate now β€” do not wait until Meta bans your number. If you are starting from scratch, follow the 7 HowTo steps above in order and you will be in production in 5–7 days. For the conversational side, see WhatsApp with AI: bot vs human. For full project pricing with WhatsApp included, read how much software costs in Costa Rica. For the glossary entry, see WhatsApp Cloud API.

πŸ’‘ For an exact range on your WhatsApp Cloud API project, use the interactive quote tool β€” 4 questions in 30 seconds, USD range + listed scope.

πŸ“ž To talk directly: WhatsApp +506 8433 7752 or admin@siriusx.net. Monday to Friday 8am–5pm, Saturday 8am–12pm, Costa Rica time.


Related posts

Jafeth JimΓ©nez

By

Jafeth JimΓ©nez

Founder Β· SEO & developer

Co-founder and owner of Sirius. Leads SEO strategy and ships code on every project the agency delivers. Works with clients in Costa Rica and the region.

03/Step by step

How to set up WhatsApp Cloud API in Costa Rica in 7 steps

Full technical guide to integrate the official Meta endpoint into your system, from Business Manager to a webhook in production.

  1. Step 01

    Create the Meta Business Manager and register your company

    Go to business.facebook.com, create an account with your corporate email (not personal), add the business with the exact legal name that appears on the cedula juridica from the Costa Rica Registro Nacional. Upload documents for business verification: a current personeria juridica certificate (under 3 months old) and a public utility bill (ICE, AyA) under the company or a representative name. Meta responds in 24–72 hours. Without business verification you are capped at 250 conversations/day.

  2. Step 02

    Get a dedicated phone number and add it to WhatsApp Business

    Buy a number you do not use on regular WhatsApp: a separate Kolbi prepaid SIM (~USD 2) or a Twilio/Vonage VoIP number if you need international. In Business Manager β†’ WhatsApp Manager β†’ Phone Numbers β†’ Add Phone Number. Meta sends you an SMS code or call to verify. Set a commercial display name that matches your brand β€” this is the name customers see in their chats.

  3. Step 03

    Generate the permanent System User Token

    In Business Settings β†’ Users β†’ System Users β†’ Add. Create a System User with Admin role, give it access to the WhatsApp Business Account, and generate a token with the whatsapp_business_messaging and whatsapp_business_management scopes. Check "Never expires". Save the token in an environment variable (.env.local in Next.js, encrypted secrets in Vercel) β€” NEVER commit it to the repo. This token is what your server uses to call the API.

  4. Step 04

    Create and submit your initial templates for approval

    In WhatsApp Manager β†’ Message Templates β†’ Create. Start with 3 UTILITY templates: action confirmation, time reminder, and status notification. Golden rules: variables with context ("Hi {{1}}, your appointment..." instead of "{{1}} {{2}}"), UTILITY (not MARKETING) if transactional, language "Spanish (Costa Rica)" if your audience is local. Approval: 1 minute to 24 hours. If rejected, read the reason in the panel and adjust β€” typical rejections are promotional language or orphan variables.

  5. Step 05

    Build the webhook in Next.js and deploy it to Vercel

    Create an API route at app/api/whatsapp/webhook/route.ts with two handlers: GET for Meta initial verification (responds with hub.challenge) and POST to receive events. Deploy to Vercel β€” the HTTPS domain is mandatory. In Business Manager configure the Callback URL pointing to https://yourdomain.com/api/whatsapp/webhook and the Verify Token (a string you choose, stored in env). Subscribe to webhook fields: messages, message_status. Meta validates the endpoint immediately.

  6. Step 06

    Implement the HTTP sender and log the first conversation

    Create a lib/whatsapp.ts module with a sendTemplate({ to, template, components }) function that POSTs to https://graph.facebook.com/v20.0/{PHONE_NUMBER_ID}/messages with the Bearer token. Test by sending a template to your own number from a local script or a protected API route. Verify the webhook receives the "delivered" and "read" events when you read the message on your WhatsApp. If it works end-to-end, you are ready for production.

  7. Step 07

    Warm up the tier and monitor the quality rating

    Meta starts your number at the 250 conversations/day tier. To climb to 1000 β†’ 10000 β†’ unlimited, you must hold a "High" quality rating for 24 hours with real traffic. Start by sending only to users who explicitly opted in (your active customer list, not purchased databases). Monitor the Insights panel: if it drops to "Medium" or "Low", check which templates have a high block ratio and pause them. After 2–4 weeks you will have unlimited tier if everything goes well.

04/Frequently asked

What people ask us about this.

How much does WhatsApp Cloud API cost in Costa Rica?

WhatsApp Cloud API is free to sign up and configure. Cost is paid per template message initiated by the business: USD 0.0085 per UTILITY conversation (reminders, OTPs, confirmations) and USD 0.0114 per MARKETING conversation in Costa Rica. The first 1,000 conversations per unique user per month are free. Messages within the service window (24 hours after a customer message) are also free. A business sending 1,000 reminders/month pays about USD 8.50.

What is the difference between WhatsApp Cloud API and WhatsApp Business app?

WhatsApp Business app is a mobile app to answer messages manually from a single phone β€” it does not support automated bulk sending or system integrations. WhatsApp Cloud API is an HTTP endpoint from Meta that your server calls via code to send template messages, receive webhooks, and log conversations to a database. If you need to automate (appointments, OTPs, reminders, bots), the answer is Cloud API. Only one of the two can be used per phone number.

Do I need a dedicated phone number for WhatsApp Cloud API?

Yes, and it must meet three conditions: (1) not registered on the WhatsApp Business app nor regular WhatsApp, (2) able to receive SMS or call for initial verification, (3) ideally a number you will not use for calls β€” Cloud API uses it for messages. In Costa Rica you can use a separate Kolbi prepaid SIM (~USD 2) or a Twilio/Vonage VoIP number. If your current number is already on WhatsApp Business app, you migrate it from Business Manager (5-minute process).

When should I use Cloud API directly vs a BSP like Twilio or 360dialog?

Cloud API direct works when you already have a technical team and want to pay only Meta (USD 0.0085/msg). A BSP (Business Solution Provider) like Twilio (USD 0.005 + platform tier) or 360dialog (USD 0.0085 + setup ~USD 50) helps if you need enterprise SLA, human support, a sending dashboard, or already use Twilio for SMS. For 80% of Costa Rica projects we recommend Cloud API direct: zero middlemen, fewer recurring costs.

What are templates and why can Meta reject them?

Templates are messages with variables ({{1}}, {{2}}) that Meta approves before you can send them to users who did not message you in the last 24 hours. Categories are UTILITY (reminders, OTPs, transactional), MARKETING (offers), and AUTHENTICATION (2FA codes). Common rejection reasons: promotional language in a UTILITY template, variables without context ({{1}} with no surrounding text), requesting sensitive info (national ID, credit cards), suspicious links, typos. Approval takes from 1 minute to 24 hours.

How do I receive replies from my users on my server?

You configure a webhook in Meta Business Manager pointing to an HTTPS URL on your server (for example, a Next.js API route deployed on Vercel: https://mydomain.com/api/whatsapp/webhook). Meta sends a POST with the event structure (incoming message, send status, button click). Your webhook must respond 200 OK in under 5 seconds or Meta retries. This is the piece that triggers flows: when the user taps "Confirm," your webhook updates the appointment in the database.

Why did Meta block my number and how do I avoid it?

Blocks happen mainly for three reasons: (1) high per-user block ratio (>1% report as spam) β€” the quality rating drops to "Low" and Meta throttles your sends, (2) sending MARKETING templates outside hours or without opt-in, (3) volume ramping too fast without warm-up. To avoid this: start at the 250 conversations/day tier, ramp gradually (Meta opens tiers at 24/1000/10000/unlimited), use only UTILITY at first, and always request explicit opt-in. If blocked, you open a ticket in Business Manager β€” it takes 3–14 days.

How long does the full setup take from scratch?

From 3 to 7 business days: day 1 β€” create Business Manager and add your business (30 min), day 1–3 β€” business verification with cedula juridica (Meta responds in 24–72 hours), day 2 β€” add and verify the phone number (1 hour), day 2–3 β€” create initial templates and submit for review (approval 1–24 h), day 3–5 β€” develop and deploy the webhook (8–16 hours of code), day 5–7 β€” end-to-end testing with real numbers and tier warm-up. After that you are ready for production.

05/Direct contact

Talk to Sirius about this.

We're a software agency in Costa Rica. If what you read applies and you want to move forward, reach us through any of these:

Hours
Mon–Fri 8am – 5pm Β· Sat 8am – 12pm
Location
Pozos de Santa Ana, Santa Ana, San JosΓ©, CR

02/Tell us

Does any of this apply to you? .

If the note rang a bell and you have a project in mind, let's talk on WhatsApp. No forms.