← 返回
未分类 Key

Meta Ads Api

Manage Meta ad campaigns by reading, creating, updating campaigns, ad sets, ads, creatives, and retrieving insights via the Marketing API.
通过 Marketing API 管理 Meta 广告系列,包括读取、创建、更新广告系列、广告组、广告、创意,并获取洞察数据。
otman-ai otman-ai 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 342
下载
💾 0
安装
1
版本
#latest

概述

Meta Ads API Skill (Full)

Overview

This skill enables an agent to read, create, and manage Meta (Facebook/Instagram) ad campaigns via the Marketing API.


Base Configuration

API Base URL

https://graph.facebook.com/v19.0/

Required Inputs

  • access_token
  • ad_account_id (format: act_)

Authentication

Method

Use access token in query or header:

Authorization: Bearer <ACCESS_TOKEN>

or

?access_token=<ACCESS_TOKEN>

Permissions Required

| Permission | Purpose |

| -------------- | ----------------------------- |

| ads_read | Read campaigns, ads, insights |

| ads_management | Create & update campaigns |


Core Entities

  • Campaign → Top-level objective
  • Ad Set → Budget + targeting
  • Ad → Creative (image/video + copy)

READ OPERATIONS (Primary)

1. Get Campaigns

Endpoint

GET /act_<AD_ACCOUNT_ID>/campaigns

Example

GET /act_<ID>/campaigns?fields=id,name,status,objective

2. Get Ad Sets

GET /act_<ID>/adsets?fields=id,name,campaign_id,status,daily_budget

3. Get Ads

GET /act_<ID>/ads?fields=id,name,adset_id,status

4. Campaign Insights

GET /<CAMPAIGN_ID>/insights?fields=impressions,clicks,spend,ctr,cpc

5. Account Insights

GET /act_<ID>/insights?fields=impressions,clicks,spend&date_preset=last_7d

6. Time Range Filtering

time_range={'since':'2024-01-01','until':'2024-01-31'}

7. Status Filtering

effective_status=['ACTIVE']

8. Levels

level=campaign | adset | ad

Pagination

Responses include:

paging.next

Agent Rule

  • Follow paging.next until exhausted
  • Stop at safe limit (e.g., 10 pages)

WRITE OPERATIONS

9. Create Campaign

POST /act_<ID>/campaigns

Payload:

name=My Campaign
objective=CONVERSIONS
status=PAUSED
special_ad_categories=[]

10. Create Ad Set

POST /act_<ID>/adsets

Payload:

name=Ad Set 1
daily_budget=1000
billing_event=IMPRESSIONS
optimization_goal=REACH
campaign_id=<CAMPAIGN_ID>
targeting={"geo_locations":{"countries":["MA"]}}
status=PAUSED

11. Create Ad Creative

POST /act_<ID>/adcreatives

Payload:

name=Creative 1
object_story_spec={"page_id":"<PAGE_ID>","link_data":{"message":"Hello","link":"https://example.com"}}

12. Create Ad

POST /act_<ID>/ads

Payload:

name=Ad 1
adset_id=<ADSET_ID>
creative={"creative_id":"<CREATIVE_ID>"}
status=PAUSED

13. Update Campaign Status

POST /<CAMPAIGN_ID>?status=PAUSED

INSIGHTS METRICS

Common fields:

  • impressions
  • clicks
  • spend
  • ctr
  • cpc
  • conversions (if configured)

ERROR HANDLING

| Code | Meaning |

| ---- | --------------------- |

| 190 | Invalid/expired token |

| 200 | Permission denied |

| 100 | Invalid parameter |


RATE LIMITS

  • Respect HTTP 429
  • Retry with exponential backoff
  • Batch requests when possible

AGENT RULES (IMPORTANT)

Safety

  • Always create campaigns as PAUSED
  • Never expose access tokens
  • Validate all IDs before use

Efficiency

  • Cache campaign lists
  • Avoid duplicate API calls
  • Use insights endpoints instead of raw data when possible

Reliability

  • Retry failed requests (max 3)
  • Log all API responses
  • Detect empty responses

ANALYTICS LOGIC (Agent Intelligence)

Detect Poor Performance

  • High spend + low CTR → flag
  • High CPC → recommend pause

Detect Winners

  • High CTR + low CPC → scale budget

Example Rule

IF spend > 50 AND ctr < 0.5%
THEN mark campaign as underperforming

SAMPLE REQUEST FLOW

  1. Fetch campaigns
  2. Fetch insights
  3. Analyze metrics
  4. Decide action
  5. Update campaign (pause/scale)

BEST PRACTICES

  • Use long-lived tokens
  • Prefer system users (Business Manager)
  • Monitor token expiration
  • Use versioned API (v19.0+)

NOTES

  • Insights are delayed (not real-time)
  • Conversion tracking requires Pixel or CAPI
  • Some features require app review

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 22:08 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Google Drive

otman-ai
通过 Google Drive API 和 OAuth 认证访问和管理 Google Drive 文件、文件夹、元数据、上传、下载和分享。
★ 0 📥 478

Monday

otman-ai
通过 Maton Gateway 调用 Monday.com API,使用 GraphQL 与 OAuth 管理看板、项、列、群组、用户和工作区。
★ 0 📥 418
design-media

tiktok-carousel

otman-ai
生成6张TikTok轮播图(含图文),通过Postiz API创建草稿帖子,并输出供审核和发布的文案。
★ 0 📥 2,160