Skip to content

Snapchat Ads

Snapchat Ads is an advertising platform that enables businesses to create, manage, and analyze ad campaigns targeting Snapchat's user base.

Bruin supports Snapchat Ads as a source for Ingestr assets, and you can use it to ingest data from Snapchat Ads into your data warehouse.

In order to set up Snapchat Ads connection, you need to add a configuration item in the .bruin.yml file and asset file. You need refresh_token, client_id, client_secret, and optionally organization_id. For details on how to obtain these credentials, please refer here

Follow the steps below to correctly set up Snapchat Ads as a data source and run ingestion.

Step 1: Add a connection to .bruin.yml file

To connect to Snapchat Ads as a source, you need to add a configuration item to the connections section of the .bruin.yml file. This configuration must comply with the following schema:

yaml
connections:
  <destination_connection_details>
  snapchatads:
     - name: my-snapchatads
       refresh_token: "your_refresh_token"
       client_id: "your_client_id"
       client_secret: "your_client_secret"
       organization_id: "your_organization_id"
  • refresh_token (required): OAuth refresh token for Snapchat Ads API authentication.
  • client_id (required): OAuth client ID for your Snapchat Ads API app.
  • client_secret (required): OAuth client secret for your Snapchat Ads API app.
  • organization_id (optional): Organization ID. Required for most resources except organizations.

Step 2: Create an asset file for data ingestion

To ingest data from Snapchat Ads, you need to create an asset configuration file. This file defines the data flow from the source to the destination. Create a YAML file (e.g., snapchat_ads_ingestion.yml) inside the assets folder and add the following content:

yaml
name: public.snapchatads
type: ingestr
connection: postgres

parameters:
  source_connection: my-snapchatads
  source_table: 'campaigns'

  destination: postgres
  • name: The name of the asset.
  • type: Specifies the type of the asset. Set this to ingestr to use the ingestr data pipeline.
  • connection: This is the destination connection, which defines where the data should be stored. For example: postgres indicates that the ingested data will be stored in a Postgres database.
  • source_connection: The name of the Snapchat Ads connection defined in .bruin.yml.
  • source_table: The table in Snapchat Ads you want to ingest.

Available Source Tables

Organization-level Resources

These resources require only authentication credentials:

TablePKInc KeyInc StrategyDetails
organizationsidupdated_atmergeRetrieves all organizations for the authenticated user
fundingsourcesidupdated_atmergeRetrieves all funding sources for the organization (requires organization_id)
billingcentersidupdated_atmergeRetrieves all billing centers for the organization (requires organization_id)
adaccountsidupdated_atmergeRetrieves all ad accounts for the organization (requires organization_id)
transactions--replaceRetrieves all transactions for the organization (requires organization_id)
members--replaceRetrieves all members of the organization (requires organization_id)
roles--replaceRetrieves all roles for the organization (requires organization_id)

Ad Account-level Resources

These resources can fetch data for a specific ad account or all ad accounts in the organization. All of these resources support the table:ad_account_id format to fetch data for a specific ad account.

TablePKInc KeyInc StrategyDetails
campaignsidupdated_atmergeRetrieves all campaigns for ad account(s). Supports campaigns:ad_account_id
adsquadsidupdated_atmergeRetrieves all ad squads for ad account(s). Supports adsquads:ad_account_id
adsidupdated_atmergeRetrieves all ads for ad account(s). Supports ads:ad_account_id
invoicesidupdated_atmergeRetrieves all invoices for ad account(s). Supports invoices:ad_account_id
event_detailsidupdated_atmergeRetrieves all event details (pixel events) for ad account(s). Supports event_details:ad_account_id
creativesidupdated_atmergeRetrieves all creatives for ad account(s). Supports creatives:ad_account_id
segmentsidupdated_atmergeRetrieves all audience segments for ad account(s). Supports segments:ad_account_id

Step 3: Run asset to ingest data

bruin run assets/snapchat_ads_ingestion.yml

As a result of this command, Bruin will ingest data from the given Snapchat Ads table into your Postgres database.