snapchat_ads
The Snapchat Ads source reads organizations, ad accounts, the campaign hierarchy,
creatives, media, audience segments, and delivery stats from the
Snap Marketing API.
It uses an HTTP manifest
and targets API version v1. The connector is in preview. It has been checked
against Snap’s API docs and tested with mock responses, but has not yet been
tested against a live account.
Configuration
An Organization Admin creates the OAuth app in the Business Details section
of Snap Business Manager and sets a redirect
URI. Open the authorization URL with the
snapchat-marketing-api scope,
approve access, then exchange the returned code for tokens. See
Snap’s authentication guide
for the full flow. Filament exchanges the refresh token for a new access token
whenever it needs one.
Tokens carry the authorizing member’s permissions. That member needs access to
every ad account in each organization it can see, because a forbidden ad account
fails the resources that read it. An Organization Admin has that access. Invoices
also need the Organization Admin, Ad Account Admin, or Campaign Manager role. The
refresh token stops working when the member loses access, so authorize with an
account your team keeps. Connection testing lists the member’s organizations.
Dates use YYYY-MM-DD. Snap reads the window in each ad account’s time zone
and treats end_date as exclusive. Hourly stats resources accept at most 7 days
and daily stats resources at most 31 days. Snap rejects a longer window for
them. Stats reports have no span limit. One window applies to all of them, so
read hourly stats in their own pipeline when you want daily stats over a longer
window.
Resources
The default selection includes the entity resources and lifetime stats for ad accounts and campaigns. All other resources are opt-in.Accounts and campaigns
Stats
Organization and billing
Entity resources have one row per entity, keyed by
id. invoices is keyed by
invoice_id instead. Deleted campaigns, ad
squads, and ads are not requested. Targeting, placement, delivery status, and
other nested settings stay in JSON columns. ad_squads asks for placement_v2.
Lifetime stats have one row per entity, keyed by its ID. Snap serves lifetime
stats as finalized data only, about 48 to 72 hours behind. Daily stats have one
row per entity and day, and hourly stats have one row per entity and hour. Both
are keyed by the entity ID and start_time. Days and hours with no activity are
omitted. start_time and end_time are stored in UTC. For daily stats they
mark midnight in the ad account’s time zone, which ad_accounts.timezone
records.
campaign_stats_daily_report and ad_stats_daily_report run one
asynchronous report
per ad account, broken down by campaign or by ad at daily granularity. Each row
is one line of Snap’s CSV file, parsed into a JSON object in raw that maps
each column header to its value as a string, next to ad_account_id. Snap does
not document the file’s columns, so these rows have no typed metrics and no key. Use them with full replace, or prefer the typed
daily stats resources when a window of 31 days or less is enough.
Ad account stats report spend only. Campaign, ad squad, and ad stats request a
fixed set of delivery, video, attachment, lens, lead, coupon, reach, install, and
conversion metrics. Conversions cover the Snap Pixel standard events other than
visits, the five custom events, and conversion_purchases_value. Hourly stats leave out
the reach metrics uniques, frequency, attachment_uniques,
attachment_frequency, total_reach, and earned_reach, which Snap does not
serve by the hour. Every stats request sets a 28-day swipe attribution window, a
1-day view attribution window, and conversion-time reporting, which are Snap’s
defaults. Metrics that do not apply to an ad’s type are null.
Monetary values such as spend and daily_budget_micro are in micro-currency of
the ad account’s currency, where 1,000,000 equals one unit. Invoice amounts are in
cents. IDs are stored as strings. Optional fields are nullable, timestamps include
time zones, and the raw column keeps fields that aren’t mapped to their own
columns.
funding_sources includes card brand, the last four card digits, and expiry for
card funding sources. members includes member email addresses.
Modes
All resources support full reads. Use full upsert to refresh existing rows, or full replace to also remove rows Snap no longer returns. Incremental reads are not supported. Entity lists have no updated-since filter. Daily stats, hourly stats, and stats reports read the configured window on every run, because Snap requires an end time for daily and hourly data and the connector has no way to name the current day. For daily and hourly stats, move the window forward and use full upsert to build history. Rerun at least the last 3 days to pick up finalized delivery metrics. Stats request conversion-time reporting, so a conversion counts on the day it happens rather than on the day of the swipe or view it is attributed to. The attribution window does not by itself call for a longer rerun. The report resources have no key, so use full replace for them. Each run then overwrites the previous report window, and keeping report history needs storage outside this pipeline.Behavior
- Auth. Every request sends a bearer access token obtained from the refresh
token at
accounts.snapchat.com. - Pagination. Lists request 500 entities per page and follow
paging.next_linkuntil it is absent. Stats requests cover one entity each. - Fan-out. Stats make one request per selected entity. Ad squad and ad stats can take a long time on large accounts, hourly stats most of all. Stats reports make one job per ad account instead.
- Report jobs. Each report job is created once, then polled every 15
seconds until Snap marks it completed, for up to an hour. The CSV is
downloaded from
data-transfer.snapads.comwithout credentials. Any status other than started, running, or completed fails the read. An interrupted run resumes polling the jobs it already created. A run that stops while a job is being created cannot tell whether Snap created it, so the next run fails until the saved state is reset. Filament also lists the parent entities a selected child needs, even when the parent isn’t selected. - Rate limiting. Five requests per second, below Snap’s documented limit of 10 per token. Throttled requests are retried.
- Errors. A response that carries an
error_codefails the read. Snap rejects stats responses that are too large with errorE9001. A shorter window makes each response smaller. - Item status. Snap wraps each listed entity with its own
sub_request_status, which lands in thesub_request_statuscolumn. The connector does not check it, because Snap’s examples spell success as bothSUCCESSandsuccess. A failed item that still carries its entity is written as a row, so filter on that column if you need only successful items. A failed item without its entity fails the read.