Meta Ads (Facebook/Instagram) MCP server for Claude, ChatGPT, Perplexity & Cursor — the Meta node of Pipeboard’s 5-platform family (+ Google, TikTok, Snap, Reddit). Hosted remote MCP, badged Meta Business Partner, free plan — no self-hosting required.
Python advertisingai-agentschatgptclaudefacebook-adsinstagram-adsmcpmeta-adsmodel-context-protocolpipeboard
fix: migrate instagram_actor_id to instagram_user_id (Jan 2026 deprecation)
Yves Junqueiraee4d2e61a4ae
diff --git a/meta_ads_mcp/core/ads.py b/meta_ads_mcp/core/ads.pyindex 0ffa49d..218a8c5 100644--- a/meta_ads_mcp/core/ads.py+++ b/meta_ads_mcp/core/ads.py@@ -841,7 +841,8 @@ async def create_ad_creative(lead_gen_form_id: Lead generation form ID for lead generation campaigns. Required when usinglead generation CTAs like 'SIGN_UP', 'GET_OFFER', 'SUBSCRIBE', etc.instagram_actor_id: Optional Instagram account ID for Instagram placements.- Placed at the top level of the creative data for all creative types.+ Sent as instagram_user_id inside object_story_spec (Meta deprecated+ instagram_actor_id in Jan 2026).ad_formats: List of ad format strings for asset_feed_spec (e.g., ["AUTOMATIC_FORMAT"] forFlexible ads, ["SINGLE_IMAGE"] for single image, ["SINGLE_VIDEO"] for video).When optimization_type is "DEGREES_OF_FREEDOM" with image_hashes, defaults to@@ -1172,14 +1173,41 @@ async def create_ad_creative(if dynamic_creative_spec:creative_data["dynamic_creative_spec"] = dynamic_creative_spec- # instagram_actor_id is a top-level creative param (separate form field).- # Meta API v24 rejects it inside video_data (error_subcode 1443050).- if instagram_actor_id:- creative_data["instagram_actor_id"] = instagram_actor_id+ # instagram_actor_id → instagram_user_id migration (Jan 2026).+ # Meta deprecated instagram_actor_id; the replacement is instagram_user_id+ # inside object_story_spec (sibling of page_id and video_data/link_data).+ if instagram_actor_id and "object_story_spec" in creative_data:+ creative_data["object_story_spec"]["instagram_user_id"] = instagram_actor_id# Make API request to create the creativedata = await make_api_request(endpoint, access_token, creative_data, method="POST")+ # Check for instagram_actor_id / instagram_user_id permission errors.+ # This happens when the user's Meta access token lacks the instagram_basic+ # permission. Re-connecting the Facebook account refreshes the token.+ if instagram_actor_id and "error" in data:+ err_details = data.get("error", {}).get("details", {})+ inner_msg = ""+ if isinstance(err_details, dict):+ inner_err = err_details.get("error", {})+ if isinstance(inner_err, dict):+ inner_msg = inner_err.get("message", "")+ if "valid Instagram account id" in inner_msg or "instagram_actor_id" in inner_msg.lower():+ return json.dumps({+ "error": "Instagram account not authorized for advertising",+ "explanation": (+ "The Meta API rejected the Instagram account ID. This usually means "+ "your Facebook access token is missing the 'instagram_basic' permission, "+ "which is required to use Instagram placements in ad creatives."+ ),+ "fix": (+ "Reconnect your Facebook account at https://pipeboard.co/connections "+ "to refresh your access token with the required permissions."+ ),+ "instagram_actor_id": instagram_actor_id,+ "meta_error": inner_msg+ }, indent=2)+# If successful, get more details about the created creativeif "id" in data:creative_id = data["id"]diff --git a/tests/test_video_creatives.py b/tests/test_video_creatives.pyindex 6bb54f7..c4eb657 100644--- a/tests/test_video_creatives.py+++ b/tests/test_video_creatives.py@@ -147,10 +147,12 @@ async def test_video_creative_with_instagram_actor_id():creative_data = mock_api.call_args_list[1][0][2]video_data = creative_data["object_story_spec"]["video_data"]- # instagram_actor_id should be a top-level creative param (separate form field),- # NOT inside video_data (Meta API v24 rejects it there with error_subcode 1443050).+ # instagram_actor_id is sent as instagram_user_id inside object_story_spec+ # (Meta deprecated instagram_actor_id in Jan 2026).+ # It must NOT be inside video_data (error_subcode 1443050).assert "instagram_actor_id" not in video_data- assert creative_data["instagram_actor_id"] == "ig_555666"+ assert "instagram_user_id" not in video_data+ assert creative_data["object_story_spec"]["instagram_user_id"] == "ig_555666"@pytest.mark.asyncio