I’m trying to programmaticlly create a Facebook Cu...
# support
b
I’m trying to programmaticlly create a Facebook Custom Audience destination. However, the API keeps returning a 400 status code with the message
{'error': 'No validation method found for definition FB_CUSTOM_AUDIENCE'}
. I modeled my JSON payload after what the API is returning for a similar destination created through the UI. Not sure what this “validation method” the error is referring to is. I searched through the codebase on github and didn’t find anything promsing.
Copy code
import requests
    FACEBOOK_TOKEN = '*****************'
    
    def create_destination(name, custom_audience_id):
        dest = {'config': {'audienceId': str(custom_audience_id),
                           'accessToken': FACEBOOK_TOKEN,
                           'maxUserCount': '100',
                           'userSchema': ['EMAIL'],
                           'isHashRequired': False,
                           'isRaw': False,
                           'disableFormat': False,
                           'skipVerify': False,
                           'type': 'NA',
                           'subType': 'NA'},
                'name': name,
                'type': 'FB_CUSTOM_AUDIENCE',
                'enabled': True,
                }

        headers = {'Authorization': 'Bearer *******************'}
        url = 'https://api.rudderstack.com/v2/destinations'
        resp = requests.post(url, json=dest, headers=headers)
        return resp
Has anyone run into this before?
l
Hi Erik, not all destinations can be created programmatically using the /v2/destinations API, FB_CUSTOM_AUDIENCE being one of them.
g
@broad-island-80682 These destinations are supported via API terraform service. (Apologies for earlier.) • Active Campaign • Adobe Analytics • Amplitude • BigQuery • Customerio • Facebook Pixel • GCS • Google Ads • Google Analytics • Google Analytics 4 • Google Tag Manager • Mixpanel • Redis • Redshift • S3 Datalake • S3 • Sentry • Slack • Snowflake • Vwo • Webhook • Zendesk
b
Oh — bummer. Ok
If either of you can point me to the area of code where this would be implemented, I’d be happy to work on adding it and submit a PR.
l
Unfortunately the code for creating destinations is not open source. We will get back to you on when we plan to make this destination API ready.
These destinations are supported via API
Just to clarify, the list shared here is for the destinations supported by terraform. Via API, we support a larger set of destinations (about two third)
g
Thanks @limited-morning-82054 for pointing this out. @broad-island-80682 as mentioned above, apart from FB Custom Audience, is there any other destination you want to use and facing similar issue? If you can mention here, we can get those prioritised to be API ready alongside others.
b
@gentle-church-13189 The other ones that I have an immediate need for are: • Google Ads (including “Google Adwords Remarketing Lists”, Adwords Enhanced Conversions, and Offline Conversions). • Google Analytics • TikTok Ads/TokTok Ads Offline Events. Terraform would be nice, but I’d be fine with any level of API access for this. Thanks!
g
@broad-island-80682 Thanks for these. As of now, you can use API for Google Ads Offline Converssions, Google Analytics and tiktok ads offline events.