Skip to content

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.

fix: remove hardcoded destination_type validation that rejected WHATSAPP

Yves Junqueirac82ad24a7901
diff --git a/meta_ads_mcp/core/adsets.py b/meta_ads_mcp/core/adsets.py
index 362a587..e543f6d 100644
--- a/meta_ads_mcp/core/adsets.py
+++ b/meta_ads_mcp/core/adsets.py
@@ -138,7 +138,9 @@ async def create_adset(
end_time: End time in ISO 8601 format
dsa_beneficiary: DSA beneficiary for European compliance
promoted_object: App config for APP_INSTALLS. Required: application_id, object_store_url.
- destination_type: Where users go after click (e.g., 'APP_STORE', 'ON_AD').
+ destination_type: Where users go after click. Common values: 'WEBSITE', 'WHATSAPP', 'MESSENGER',
+ 'INSTAGRAM_DIRECT', 'ON_AD', 'APP', 'FACEBOOK', 'SHOP_AUTOMATIC'.
+ Also supports multi-channel combos like 'MESSAGING_MESSENGER_WHATSAPP'.
is_dynamic_creative: Enable Dynamic Creative for this ad set.
access_token: Meta API access token (optional - will use cached token if not provided)
"""
@@ -202,15 +204,12 @@ async def create_adset(
"provided_url": store_url
}, indent=2)
- # Validate destination_type if provided
- if destination_type:
- valid_destination_types = ["APP_STORE", "DEEPLINK", "APP_INSTALL", "ON_AD"]
- if destination_type not in valid_destination_types:
- return json.dumps({
- "error": f"Invalid destination_type: {destination_type}",
- "valid_values": valid_destination_types
- }, indent=2)
-
+ # destination_type is passed through to Meta's API without client-side validation.
+ # Meta supports 23+ values (WHATSAPP, MESSENGER, INSTAGRAM_DIRECT, ON_AD, WEBSITE,
+ # APP, FACEBOOK, SHOP_AUTOMATIC, multi-channel MESSAGING_* combos, etc.)
+ # and may add more. Let Meta's API reject invalid values.
+ # See: facebook-python-business-sdk AdSet.DestinationType
+
# Basic targeting is required if not provided
if not targeting:
targeting = {
diff --git a/tests/test_mobile_app_adset_creation.py b/tests/test_mobile_app_adset_creation.py
index 839e3f5..871516c 100644
--- a/tests/test_mobile_app_adset_creation.py
+++ b/tests/test_mobile_app_adset_creation.py
@@ -253,27 +253,26 @@ class TestMobileAppAdsetCreation:
assert 'object_store_url' in result_data['error'].lower()
@pytest.mark.asyncio
- async def test_invalid_destination_type(
+ async def test_invalid_destination_type_passes_through_to_meta(
self, mock_api_request, mock_auth_manager, valid_mobile_app_params, ios_promoted_object
):
- """Test validation error for invalid destination_type value"""
-
+ """Test that invalid destination_type is passed through to Meta API (not rejected by middleware).
+
+ Client-side validation was removed because Meta supports 23+ destination_type values
+ and maintaining a hardcoded allowlist caused false rejections (e.g. WHATSAPP).
+ """
+
result = await create_adset(
**valid_mobile_app_params,
promoted_object=ios_promoted_object,
destination_type="INVALID_TYPE"
)
-
- result_data = json.loads(result)
-
- # Should return validation error - check for data wrapper format
- if "data" in result_data:
- error_data = json.loads(result_data["data"])
- assert 'error' in error_data
- assert 'destination_type' in error_data['error'].lower()
- else:
- assert 'error' in result_data
- assert 'destination_type' in result_data['error'].lower()
+
+ # The request should reach the Meta API (mock_api_request should be called)
+ # rather than being rejected by our middleware
+ call_args = mock_api_request.call_args
+ params = call_args[0][2]
+ assert params['destination_type'] == "INVALID_TYPE"
@pytest.mark.asyncio
async def test_app_installs_requires_promoted_object(