Skip to content
Fresh 2026

Workflows

End-to-end patterns across the Meta platform, rendered as diagrams.

OAuth login + long-lived token

sequenceDiagram
    participant U as User
    participant A as Your App
    participant FB as Meta OAuth
    participant G as Graph API
    U->>A: Click "Login with Facebook"
    A->>FB: Redirect to Login dialog (client_id, scope, redirect_uri)
    FB->>U: Prompt for permissions
    U->>FB: Approve
    FB->>A: Redirect back with code
    A->>FB: Exchange code for short-lived token
    FB->>A: Short-lived User Access Token
    A->>FB: Exchange for long-lived token (fb_exchange_token)
    FB->>A: Long-lived token (~60 days)
    A->>G: GET /me?fields=id,name (Bearer token)
    G->>A: User data

Marketing API, create a campaign

flowchart TD
    A[Ad Account act_ID] --> B[Create Campaign
objective + status] B --> C[Create Ad Set
budget, schedule, targeting, optimization_goal] C --> D[Create Ad Creative
page_id, link, image/video] D --> E[Create Ad
adset_id + creative] E --> F[Set status ACTIVE] F --> G[Poll Insights
spend, impressions, results] G --> H{Performing?} H -- Yes --> I[Scale budget] H -- No --> C

Webhooks, verification and delivery

sequenceDiagram
    participant M as Meta
    participant E as Your HTTPS Endpoint
    Note over M,E: One-time verification
    M->>E: GET ?hub.mode=subscribe&hub.challenge=X&hub.verify_token=T
    E->>M: 200 + echo hub.challenge (if token matches)
    Note over M,E: Ongoing delivery
    M->>E: POST event payload + X-Hub-Signature-256
    E->>E: Verify HMAC-SHA256 with App Secret
    E->>M: 200 OK (fast)
    E->>E: Process event asynchronously

Instagram content publishing

flowchart LR
    A[IG Business/Creator account] --> B[POST /media
image_url or video_url + caption] B --> C[Returns creation_id
container] C --> D{Media ready?} D -- processing --> D D -- FINISHED --> E[POST /media_publish
creation_id] E --> F[Published post]

App lifecycle: Development to Live

flowchart TD
    A[Create app in Dashboard] --> B[Add products + permissions]
    B --> C[Build & test in Development mode
with test users] C --> D[Business Verification
if required] D --> E[App Review
screencast + reviewer steps] E --> F{Approved?} F -- No --> C F -- Yes --> G[Switch app to Live mode] G --> H[Production traffic + rate limits apply]