Meta for Developers Integration Guide
Technology: meta-developers · Category: comms · Last reviewed: 2026-10-20
Source: https://tech-stack.codeamanilabs.org/guide/meta-developers
Insight:
Everything Meta lets you build — WhatsApp, Messenger, Instagram, Login, Marketing, Conversions API, and now the Ads MCP server — is one Graph API (
graph.facebook.com/v26.0) wearing different hats. Learn the fundamentals once (nodes/edges, the token taxonomy, App Review + Business Verification, webhook HMAC over raw bytes) and every product is familiar. Meta's docs moved todevelopers.facebook.com/documentation/...with.mdviews — good for agent grounding. For codeAmani's US-first work the high-value surfaces are Login, Instagram, and Conversions API (with US state privacy flags); for Kenya-targeted projects it's WhatsApp + Flows paired with M-Pesa.
███╗ ███╗███████╗████████╗ █████╗ ██████╗ ███████╗██╗ ██╗
████╗ ████║██╔════╝╚══██╔══╝██╔══██╗ ██╔══██╗██╔════╝██║ ██║
██╔████╔██║█████╗ ██║ ███████║ ██║ ██║█████╗ ██║ ██║
██║╚██╔╝██║██╔══╝ ██║ ██╔══██║ ██║ ██║██╔══╝ ╚██╗ ██╔╝
██║ ╚═╝ ██║███████╗ ██║ ██║ ██║ ██████╔╝███████╗ ╚████╔╝
╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═══╝
Meta for Developers Integration Guide
Focus — the whole Meta developer surface as one platform: Graph API fundamentals and versioning, app creation, the token/permission model, App Review + Business Verification, webhooks, Login, Instagram, Marketing API, Conversions API, the official Ads MCP server, and WhatsApp Flows / Embedded Signup — capped with a catalog of build ideas for the Kenyan community. WhatsApp messaging itself (sends, templates, pricing, messaging limits, Twilio-vs-Meta) lives in the focused
whatsapp-business-apiguide — this one only points there.
Overview
Meta for Developers is one platform
behind one base URL — https://graph.facebook.com/{version}/{node-or-edge}
(Instagram API with Instagram Login is the exception: graph.instagram.com).
Six things to internalize before you write code:
- Everything is the Graph API. Nodes/edges/fields, versioning, error codes, and rate-limit headers — learn once, reuse for every product.
- Pin
v26.0(current, released 2026-07-29). Graph versions live ~2 years. Marketing API versions are different — 90-day grace, and unversioned Marketing API calls fail. - Use cases are permanent. The modern app-creation flow attaches use cases; once added they cannot be removed. Pick carefully or create a second app.
- Tokens are a taxonomy. User tokens: 1–2 h (short) / ~60 days (long). System user tokens are the production credential for server automation. The App Secret never ships to a client.
- Webhook HMAC is the perimeter.
X-Hub-Signature-256: sha256=<HMAC-SHA256(raw body, App Secret)>. Verify over raw bytes, constant-time; Meta retries failures for up to 36 hours, so dedupe. - Going public = App Review + Business Verification. Anyone without a role on your app (or its business) needs approved permissions; Advanced Access requires Business Verification.
Official Documentation
Meta migrated most docs to developers.facebook.com/documentation/... (old
/docs/... URLs redirect). Most pages have a View as Markdown link — append
.md to the /documentation/ URL.
The platform map
| Family | Products |
|---|---|
| Core | Graph API, App Dashboard, use cases, Webhooks |
| Identity | Facebook Login, Facebook Login for Business, Business Login for Instagram |
| Social | Pages API, Instagram Platform, Threads API, Sharing |
| Business Messaging | WhatsApp Business Platform (→ whatsapp-business-api), WhatsApp Flows, Embedded Signup, Messenger, Instagram Messaging |
| Ads & Measurement | Marketing API, Conversions API, Catalog, Ads MCP server + CLI ("ads AI connectors") |
| SDKs | JS SDK, Android, iOS, Meta Business SDK (Node / Python / PHP / Java / Ruby) |
| AI models | Moved off this site — see "Llama & Meta AI models" below |
Versions & deprecation schedule
Source: versions table (checked 2026-10-20).
| Graph API | Released | Expires |
|---|---|---|
| v26.0 (current) | 2026-07-29 | TBD |
| v25.0 | 2026-02-18 | 2028-07-29 |
| v24.0 | 2025-10-08 | 2028-02-18 |
| v23.0 | 2025-05-29 | 2027-10-08 |
| v22.0 | 2025-01-21 | 2027-05-20 |
| v21.0 | 2024-10-02 | 2027-01-21 (next to go) |
| v20.0 | 2024-05-21 | expired 2026-09-24 |
- Unversioned Graph calls resolve to the oldest version your app can use — a silent footgun. Always pin.
- Marketing API: 90-day grace after each new version; deprecated-version calls
are auto-upgraded only for endpoints the next version didn't change (watch the
X-Ad-Api-Version-Warningheader). Unversioned calls fail. - v26.0 breaking changes worth knowing (most also apply to all versions on
2026-10-27): Commerce Order Management API (47 endpoints) removed with no
replacement; legacy protocol features gone (
pretty/debugignored,date_formaterrors,GET /?ids=errors, ETag/If-None-Match/304 removed); New-Pages-Experience Page fieldscurrent_location,genre,network,parking,start_inforemoved; Marketing API drops Instagram Explore placement, poll ads, and Messenger Stories placement, and HEC-F (housing/employment/credit & financial) ad sets must set an explicittargeting_automation.advantage_audience.
Setup — register, create an app, pick use cases
- Register at developers.facebook.com and open the App Dashboard.
- Create App → name + contact email → select use cases (incompatible ones grey out; use cases cannot be removed later, though compatible ones can be added). Legacy app types live under Other.
- Connect a business portfolio (required when the app accesses data you don't own/manage; you can do it any time during development).
- Note the App ID (public) and App Secret (server-only). In
Settings → Advanced → Security turn on Require App Secret so every server
call must carry
appsecret_proof. - Non-secret configuration (keep in config, not the vault):
| Setting | Example | Secret? |
|---|---|---|
META_GRAPH_VERSION |
v26.0 |
No |
META_APP_ID |
123456789012345 |
No (public) |
META_PIXEL_ID |
Pixel / dataset ID | No |
META_WEBHOOK_URL |
https://app.example.com/api/webhooks/meta |
No |
Real secrets (.env.local / Vercel env / Hazina only):
META_APP_SECRET=your-app-secret
META_SYSTEM_USER_TOKEN=EAAG...
META_VERIFY_TOKEN=random-long-string-you-choose
META_CAPI_ACCESS_TOKEN=EAAG...
Tokens & expiry
Source: Access Tokens for Meta Technologies
(updated 2025-11-25). Meta warns lifetimes "may change without warning or expire
early" — always handle error 190 (invalid/expired token).
| Token | Lifetime | Use |
|---|---|---|
| User (short-lived) | ~1–2 h (web login) | Client reads after login |
| User (long-lived) | ~60 days | Exchange server-side with the App Secret; mobile SDKs get these by default |
| Instagram User (Business Login for Instagram) | 1 h short → 60 days long, refreshable | graph.instagram.com calls |
| Page | Derived from a user token (long-lived user → long-lived Page token) | Act on a Page |
App (client_credentials) |
Doesn't time-expire | App settings, webhook subscriptions — server-only |
| Client token | n/a (not secret) | {app-id}|{client-token} for app-level calls from native apps |
| System user | Expiry chosen at generation (can be non-expiring) | Production server automation (Admin or Employee role) |
| Business integration token | Long | Per-customer token from Embedded Signup / Login for Business |
Apps with Marketing API access and system users get long-lived tokens that don't time-expire but can still be invalidated (password change, permission revoke). Store tokens in a variable-length column — token length changes.
App Review, Business Verification, Data Use Checkup
| Gate | When |
|---|---|
| App Review | Before anyone without a role on the app (or its business) can grant a permission / use a feature. Reviewers must be able to test every requested permission. |
| Business Verification | Required for Advanced Access and for apps that let other businesses access their own data (since 2023-02-01). Done by a Business admin in Business Manager. |
| Data Use Checkup | Annual, for apps live with a use case or with Advanced Access; an app admin certifies compliant data use to keep API access. |
| Data deletion | Every app must provide a data-deletion callback URL or instructions URL (Settings → Basic). |
Marketing API tier names changed in 2026: "Standard Access" → Limited Access, "Advanced Access" → Full Access; Full Access needs 500 calls in 15 days (was 1,500). Permission identifiers are unchanged.
Quickstart — a hardened Graph call (raw fetch, Node 20+)
The Graph API is plain HTTPS; fetch + appsecret_proof + a pinned version + the
error envelope is all you need. Full file: examples/graph-api-call.ts.
import { createHmac } from "node:crypto";
const proof = createHmac("sha256", process.env.META_APP_SECRET!)
.update(process.env.META_SYSTEM_USER_TOKEN!)
.digest("hex");
const url = new URL("https://graph.facebook.com/v26.0/me");
url.searchParams.set("fields", "id,name");
url.searchParams.set("appsecret_proof", proof);
const res = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.META_SYSTEM_USER_TOKEN}` },
});
Meta Business SDK. Python facebook_business is at 26.0.2. The npm
facebook-nodejs-business-sdk is still 24.0.1 (2025-11-21) even though the
GitHub repo is tagged v26.0.2 — use it for typed Marketing API objects, raw
fetch for everything else. The whatsapp npm SDK (0.0.5-Alpha, repo
archived) is no longer recommended — call the Cloud API with fetch as in
the whatsapp-business-api guide.
Key patterns
Webhooks — the universal push channel
One contract for Pages, Instagram, Messenger, WhatsApp, Leads, Ad Accounts, …
- GET verification: echo
hub.challengeiffhub.mode=subscribeandhub.verify_tokenmatches. - POST delivery: verify
X-Hub-Signature-256over the raw bytes keyed by the App Secret withtimingSafeEqual; ACK 200 fast, process async. - Batching & retries: up to 1,000 updates per batch (not guaranteed). Failed deliveries retry "immediately, then a few more times with decreasing frequency over the next 36 hours", then are dropped. Dedupe on event/message id.
- Payloads are arrays — walk every
entry[].changes[](orentry[].messaging[]for Messenger/IG);[0]-only silently drops events. - Optional mTLS: trust
meta-outbound-api-ca-2025-12.pemand check CNclient.webhooks.fbclientcerts.com. The older DigiCert-signed cert expired 2026-04-15.
Typed Next.js App Router receiver: examples/webhook-router.ts.
Rate limits
| Header / code | Meaning |
|---|---|
X-App-Usage |
call_count, total_time, total_cputime as % of the platform limit (200 × daily active users per rolling hour) |
X-Business-Use-Case-Usage |
Per-BUC usage + estimated_time_to_regain_access (minutes) for Pages, IG, Ads, WhatsApp mgmt, … |
4 / 17 / 32 / 613 |
App / user / Pages / custom rate limit |
80000–80014 |
BUC throttles (80002 Instagram, 80004 Ads Management, 80006 Messenger, 80008 WhatsApp Business Management) |
190 |
Invalid / expired access token |
Back off before any usage value reaches 100.
Instagram Platform — two configurations
| Instagram Login | Facebook Login | |
|---|---|---|
| Host | graph.instagram.com |
graph.facebook.com |
| Facebook Page | Not required | Required (IG account linked to a Page) |
| Permissions | instagram_business_basic, _content_publish, _manage_comments, _manage_messages |
instagram_basic, instagram_content_publish, instagram_manage_comments, instagram_manage_insights, instagram_manage_messages, pages_show_list, pages_read_engagement |
| Hashtag search, product tagging, partnership ads | No | Yes |
Both require an Instagram professional (business/creator) account — the legacy
Instagram Basic Display API is gone; don't build on it. Auth code valid 1 h;
short-lived token 1 h; long-lived token 60 days (refresh before expiry). DM
replies must fall inside the 24 h standard window (or the 7-day Human Agent window
via the human_agent tag).
Conversions API (server-side events)
POST https://graph.facebook.com/v26.0/{PIXEL_ID}/events with a data array
(≤ 1,000 events).
event_timeis Unix seconds, ≤ 7 days old — one stale event fails the whole request (offline/store events: 62 days).- Send
event_idon every event; a matching browser Pixel event with the sameevent_id+event_nameis deduplicated (first copy wins). - Hash
em,ph,fn,ln,db,ge,ct,st,zp,countrywith SHA-256 after normalizing (email: trim + lowercase; phone: digits with country code, no leading zeros).external_idhashing is recommended. Never hashclient_ip_address,client_user_agent,fbc,fbp. - Token: Events Manager → Settings → Generate access token (no App Review needed).
test_event_codeonly while testing — remove in production.- US state privacy → Limited Data Use (below). Example:
examples/conversions-api-event.ts.
Ads MCP server (official, beta)
Meta hosts an MCP server at https://mcp.facebook.com/ads ("ads AI connectors",
alongside a CLI). Auth: OAuth via Facebook Login for Business (no app needed
for the end-user path), a user access token, or an Employee-role system user
token (Admin-role system user tokens are rejected). Minimum permissions:
ads_mcp_management + ads_read (or ads_management).
# Claude Code, with your own Meta app (add the "Create & manage ads with ads MCP server" use case)
claude mcp add --transport http --client-id <META_APP_ID> meta-ads https://mcp.facebook.com/ads
Set a matching redirect URL in your app's Login for Business settings. Treat write
scopes (ads_management) as spend authority — grant read-only for analysis agents.
WhatsApp Flows & Embedded Signup (owned here)
- Flows render multi-screen native forms inside a WhatsApp chat. Static Flows
post collected data to your webhook on
complete; dynamic Flows add an encrypted data endpoint. Published Flows can only be deprecated. Seeexamples/booking-flow.json(Flow JSON7.3). - Embedded Signup — a Meta-hosted popup (Facebook Login for Business) that creates/links a customer's portfolio + WABA + number and returns a code your server exchanges for a per-customer business token.
For sending messages, templates, pricing, and messaging limits →
whatsapp-business-api.
Llama & Meta AI models
Meta's model developer surface has moved off developers.facebook.com:
llama.com/docs now redirects to dev.meta.ai, which lists the Meta Model API
("OpenAI SDK compatible") for the proprietary Muse model family (Muse Spark,
etc.) and Muse Code — and no Llama API product and no public pricing.
Third-party reports say Meta's hosted Llama API was retired in mid-2026; no Meta
announcement was found, so treat that as unverified (see NOTES.md).
codeAmani stance (per AI_WORKFLOWS.md, Claude primary):
- Open Llama weights (Llama 4 Scout/Maverick, Llama 3.x) remain available — use
them via Hugging Face or a third-party host (see
../hugging-face/). - Don't build on the hosted Llama API (
llama-api-clientnpm 0.3.0, last published 2025-10) — its future is unclear. - Muse / Meta Model API: out of scope until Meta publishes stable docs + pricing.
US privacy notes (codeAmani is US-first)
- Conversions API / Pixel Limited Data Use (LDU). Send
data_processing_options: ["LDU"]with country/state0(Meta geolocates) or explicit codes (California = country1, state1000). Send[]for users who haven't opted out. Wire it to your "Do Not Sell/Share" (CCPA/CPRA) state. - No sensitive data in events. Never put health, financial-account, or children's data into Pixel/CAPI events, URL params, or custom data (FTC Health Breach Notification Rule territory; HIPAA for covered entities — see the DoseVault rules in memory). Hash PII exactly as specified; hashing is not anonymization.
- Special Ad Categories (HEC-F) — housing, employment, credit/financial ads have
restricted targeting; v26.0 requires an explicit
advantage_audienceflag. - Platform obligations: privacy policy URL, data-deletion callback/instructions URL, annual Data Use Checkup, honor deletion requests; bot disclosure for automated chat is required by law in California (Instagram/Messenger policy).
- Minimize retention. Webhook payloads can't be re-queried — store only what you need, encrypted at rest, with a deletion path keyed by user id / PSID / IGSID.
Build ideas for Kenyan businesses (Kenya-targeted projects only)
WhatsApp is the default channel in East Africa, so the highest-leverage builds pair
a WhatsApp/Flows surface with M-Pesa (see MPESA_PATTERNS.md /
daraja-api). Full catalog in
reference/build-ideas-kenya.md:
- Duka order bot — catalog Flow → cart → M-Pesa STK Push → utility confirmation.
- Boda / delivery dispatch — inbound location → rider assignment → status templates.
- Clinic / salon booking — booking Flow → Neon → reminder templates.
- Sacco / chama assistant — balances, authentication-template OTPs, document statements.
- School fees & comms — fee-balance templates + paybill link + opt-out broadcasts.
- Agri price & advisory — daily price templates + a produce-listing Flow.
codeAmani notes
- Secrets server-side only. App Secret, system user tokens, CAPI tokens, and
Flow private keys never reach a client.
.env.local/ Vercel env / Hazina (seeENV_MASTER.md). Rungitleaksbefore any push. - Webhook verification is non-negotiable — HMAC-SHA256 over the raw body with
timingSafeEqual, same discipline as Stripe/Clerk webhooks (SECURITY.md). - Always send
appsecret_proofand enable Require App Secret — a leaked bare token is then useless. - Version hygiene. One config constant pinned to
v26.0. v21.0 dies 2027-01-21; the protocol cleanup hits every version 2026-10-27 — grep forpretty,ids=,date_format, ETag usage. - Phone format. WhatsApp
toand CAPIphboth use digits with country code, no+(254712345678,15551234567). Daraja uses the same254…shape; Twilio wantswhatsapp:+…— normalize per API. - AI routing. The reply brain (Claude primary,
AI_WORKFLOWS.md) runs in the async webhook worker, never in the 200-ACK path. Meta-hosted models are not a codeAmani routing target (see "Llama & Meta AI models"). - Payments. US-first → Stripe (default rail). Meta's own on-platform checkout (Commerce Order Management) is gone as of v26. Kenya-targeted WhatsApp commerce → M-Pesa/Daraja.
- Ads MCP for agents: read-only (
ads_read) by default; spend authority (ads_management) only with explicit human approval.
Official docs:
- https://developers.facebook.com/docs/
- https://developers.facebook.com/docs/graph-api/
- https://developers.facebook.com/docs/graph-api/changelog/versions
- https://developers.facebook.com/docs/facebook-login/guides/access-tokens
- https://developers.facebook.com/docs/graph-api/webhooks/getting-started
- https://developers.facebook.com/docs/instagram-platform/overview
- https://developers.facebook.com/documentation/ads-commerce/marketing-api/overview/versioning
- https://developers.facebook.com/documentation/ads-commerce/conversions-api/get-started
- https://developers.facebook.com/documentation/ads-commerce/ads-ai-connectors/ads-mcp-server/ads-mcp-server-get-started
- https://developers.facebook.com/docs/whatsapp/flows