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
feat: add branded content params to create_ad_creative (#84)
Yves Junqueira988a05b123d0
diff --git a/meta_ads_mcp/core/ads.py b/meta_ads_mcp/core/ads.pyindex 5d70158..1fe58b0 100644--- a/meta_ads_mcp/core/ads.py+++ b/meta_ads_mcp/core/ads.py@@ -1403,6 +1403,8 @@ async def create_ad_creative(reminder_data: Optional[Dict[str, Any]] = None,videos: Optional[List[Dict[str, Any]]] = None,images: Optional[List[Dict[str, Any]]] = None,+ facebook_branded_content: Optional[Dict[str, Any]] = None,+ instagram_branded_content: Optional[Dict[str, Any]] = None,) -> str:"""Create a new ad creative using an uploaded image hash, video ID, or an existing post.@@ -1580,6 +1582,16 @@ async def create_ad_creative(The ad set must use optimization_goal=REMINDERS_SET and the placementmust be restricted to Instagram feeds/stories. link_url is stillrecommended (the URL users visit after the reminder fires).+ facebook_branded_content: Branded content settings for Facebook partnership ads.+ Used when a brand sponsors a creator's content on Facebook.+ Format: {"sponsor_page_id": "<page_id>"} where sponsor_page_id is the+ Facebook Page ID of the sponsoring brand. Passed as a top-level field+ on the ad creative. The creator's page should be set as page_id.+ instagram_branded_content: Branded content settings for Instagram partnership ads.+ Used when a brand sponsors a creator's content on Instagram.+ Format: {"sponsor_id": "<instagram_user_id>"} where sponsor_id is the+ Instagram account ID of the sponsoring brand. Passed as a top-level+ field on the ad creative.Returns:JSON response with created creative details@@ -1647,6 +1659,22 @@ async def create_ad_creative(except (json.JSONDecodeError, TypeError):pass+ if isinstance(facebook_branded_content, str):+ try:+ _parsed = json.loads(facebook_branded_content)+ if isinstance(_parsed, dict):+ facebook_branded_content = _parsed+ except (json.JSONDecodeError, TypeError):+ pass++ if isinstance(instagram_branded_content, str):+ try:+ _parsed = json.loads(instagram_branded_content)+ if isinstance(_parsed, dict):+ instagram_branded_content = _parsed+ except (json.JSONDecodeError, TypeError):+ pass+for _param_name, _param_val in [('image_hashes', image_hashes),('messages', messages),@@ -2200,6 +2228,12 @@ async def create_ad_creative(if instagram_actor_id and "object_story_spec" in creative_data:creative_data["object_story_spec"]["instagram_user_id"] = instagram_actor_id+ # Branded/partnership content fields — top-level creative params.+ if facebook_branded_content:+ creative_data["facebook_branded_content"] = facebook_branded_content+ if instagram_branded_content:+ creative_data["instagram_branded_content"] = instagram_branded_content+# Make API request to create the creativedata = await make_api_request(endpoint, access_token, creative_data, method="POST")