Files

132 lines
5.0 KiB
JSON

{
"schema": 1,
"id": "meta",
"name": "Meta Business",
"version": "1.0.0",
"description": "Read-only Meta ads insights, Instagram account and Facebook Page numbers, with a free daily snapshot that keeps more than Instagram's 30 days.",
"category": "data",
"icon": "megaphone",
"color": "#545e91",
"author": "gabrielvidal",
"skill": {
"dir": "skill",
"name": "meta"
},
"secrets": [
{
"key": "token",
"label": "System-user token",
"placeholder": "EAA...",
"help": "A read-only key from your Meta business portfolio. Stored write-only on the hub, never shown again. Meta checks it first: a key that could change anything (ads, posts, messages) is refused.",
"scope": "user",
"required": true
}
],
"settings": {
"subtitle": "Your ads, Instagram and Page numbers, read-only",
"instructions": "## Make a read-only key (about 10 minutes, once)\n\n1. **Open your business portfolio's settings**: business.facebook.com \u2192 \u2699 Settings, in the portfolio that owns your ad account and your Page.\n2. **Have an app in that portfolio**: Accounts \u2192 Apps. If there's none, create one at developers.facebook.com (type *Business*) and connect it to the portfolio.\n3. **Add a system user**: Users \u2192 System users \u2192 Add. Give it a name (ai-agent) and the role **Employee**, not Admin.\n4. **Give it your accounts, to look only**: on the system user, *Assign assets*: your ad account, your Facebook Page and your Instagram account, each with **view-only** rights (no *Manage*).\n5. **Generate a key**: *Generate new token*, pick the app, set the expiry to **Never**, and tick only these permissions: `ads_read`, `read_insights`, `pages_show_list`, `pages_read_engagement`, `instagram_basic`, `instagram_manage_insights`.\n6. **Copy the key and paste it above**. It starts with EAA. Meta shows it only once.\n\nThe key stays on the ai-agent server. A key that carries anything beyond reading (`ads_management`, `business_management`, `pages_manage_*`, publishing or messaging) is refused. Remove it here, or delete the system user in Meta, whenever you like.\n\nEvery morning around 07:00 the hub saves the last 7 days again (an ad's numbers keep moving for a week) plus that morning's posts and audience, so your conversations can read further back than Instagram's 30 days. Then just ask: \u00ab MAJ \u00bb, \u00ab how is the campaign doing? \u00bb, \u00ab followers this week \u00bb.\n\nMeta's help on system users: https://www.facebook.com/business/help/503306463479099",
"fields": [
{
"key": "timezone",
"label": "Timezone",
"type": "text",
"default": "Europe/Paris",
"help": "The time zone your days are counted in (an IANA name such as Europe/Paris)."
}
],
"testAction": "inspect",
"statusAction": "status"
},
"proxy": {
"baseUrl": "https://graph.facebook.com/v27.0",
"internal": false,
"auth": {
"in": "header",
"name": "Authorization",
"prefix": "Bearer ",
"secret": "token"
},
"allow": [
{
"method": "GET",
"path": "^me(/(adaccounts|accounts|permissions))?$"
},
{
"method": "GET",
"path": "^act_\\d{1,25}(/(insights|campaigns|adsets|ads|adcreatives))?$"
},
{
"method": "GET",
"path": "^\\d{1,25}(/(insights|media|stories|children|comments|published_posts|posts|video_reels|ads|adsets|adcreatives))?$"
},
{
"method": "GET",
"path": "^\\d{1,25}_\\d{1,25}(/(insights|comments))?$"
}
],
"denyParams": [
"access_token",
"method",
"appsecret_proof",
"batch",
"appsecret_time",
"callback",
"jsonp",
"suppress_http_code",
"transport",
"include_headers",
"debug",
"_method",
"redirect",
"pretty"
],
"scrubSecrets": true,
"maxBytes": 20971520,
"inspect": {
"method": "GET",
"path": "me/permissions",
"requireOnlyScopes": [
"ads_read",
"read_insights",
"pages_show_list",
"pages_read_engagement",
"instagram_basic",
"instagram_manage_insights",
"public_profile",
"pages_read_user_content",
"read_audience_network_insights",
"instagram_business_basic",
"instagram_business_manage_insights",
"attribution_read"
]
},
"stripResponseKeys": [
"access_token"
]
},
"storage": {
"maxMb": 100
},
"schedules": [
{
"id": "daily-snapshot",
"cron": "0 7 * * *",
"script": "jobs/snapshot.py",
"timeoutSec": 600,
"description": "Save the last 7 days again (28 on the first run) plus this morning's posts and audience"
}
],
"actions": {
"inspect": {
"script": "handlers/inspect.py",
"timeoutSec": 60,
"description": "Check the key with Meta and refresh what it reaches"
},
"status": {
"script": "handlers/status.py",
"timeoutSec": 20,
"description": "What the key reaches and the saved days"
}
}
}