Set up the Openflow Connector for Meta Ads¶
Note
This connector is subject to the Snowflake Connector Terms.
This topic describes the steps to set up the Openflow Connector for Meta Ads.
Prerequisites¶
- Ensure that you have reviewed About Openflow Connector for Meta Ads.
- Ensure that you have Set up Openflow - Snowflake Deployments or Set up Openflow - BYOC.
- If using Openflow - Snowflake Deployments, ensure that you’ve reviewed configuring required domains and have granted access to the required domains for the Meta Ads connector.
Get the credentials¶
As a Meta Ads administrator, perform the following actions in your Meta Ads account:
- Create a Meta App or ensure that you have access to one.
- Enable Marketing API in the App dashboard.
- Generate a long-lived token.
- Optional: Increase the rate limit by changing the app access type from
Standard accesstoAdvanced accessof the Ads Management Standard Access. Enable theads_readandads_managementpermissions.
Set up Snowflake account¶
As an Openflow administrator, perform the following tasks to set up your Snowflake account. With the
default SNOWFLAKE_MANAGED authentication strategy, the runtime’s execute-as role is the identity
the connector uses to access Snowflake, so you grant it the following privileges.
Note
If you’re deploying the connector in Openflow - BYOC Deployments and using the KEY_PAIR authentication
strategy instead of the recommended SNOWFLAKE_MANAGED, you’ll also grant this same execute-as
role to a service user rather than relying on the runtime’s managed token. See
Set up key-pair authentication for Openflow - BYOC Deployments
to create the service user.
Create database, schema, and warehouse¶
-
Create the destination database:
-
Create the destination schema:
-
Grant the required privileges to the runtime’s execute-as role:
-
Create a warehouse (or use an existing one) and grant usage privileges:
-
If any other Snowflake users require access to the tables ingested by the connector (for example, for custom processing in Snowflake), grant those users the execute-as role.
Set up the connector¶
As a data engineer, perform the following tasks to install and configure the connector:
Install the connector¶
- Create a database and schema in Snowflake for the connector to store ingested data. Grant required Database privileges to the execute-as role, as described in Set up Snowflake account.
To install the connector, do the following as a data engineer:
-
Navigate to the Connector library tab in Openflow.
-
On the Openflow connectors page, find the connector and select Install.
-
In the Select runtime dialog, select your runtime from the Available runtimes drop-down list and click Install.
Note
Before you install the connector, ensure that you have created a database and schema in Snowflake for the connector to store ingested data.
-
Authenticate to the deployment with your Snowflake account credentials and select Allow when prompted to allow the runtime application to access your Snowflake account. The connector installation process takes a few minutes to complete.
-
Authenticate to the runtime with your Snowflake account credentials.
The Openflow canvas appears with the connector process group added to it.
Configure the connector¶
- Right-click on the imported process group and select Parameters.
- Populate the required parameter values as described in Flow parameters.
Flow parameters¶
This section describes the flow parameters that you can configure based on the following parameter contexts:
- Meta Ads Source Parameters: Used to establish connection with MetaAds API.
- Meta Ads Destination Parameters: Used to establish connection with Snowflake.
- Meta Ads Ingestion Parameters: Used to define the configuration of data downloaded from Meta Ads.
Meta Ads Source Parameters¶
| Parameter | Description |
|---|---|
| Access Token | Token required to request Meta Ads Insights API |
Meta Ads Destination Parameters¶
| Parameter | Description | Required |
|---|---|---|
| Destination Database | The database where data will be persisted. It must already exist in Snowflake. The name is case-sensitive. For unquoted identifiers, provide the name in uppercase. | Yes |
| Destination Schema | The schema where data will be persisted, which must already exist in Snowflake. The name is case-sensitive. For unquoted identifiers, provide the name in uppercase. See the following examples:
| Yes |
| Snowflake Authentication Strategy | When using:
| Yes |
| Snowflake Account Identifier | When using:
| Yes |
| Snowflake Private Key | When using:
| No |
| Snowflake Private Key File | When using:
| No |
| Snowflake Private Key Password | When using:
| No |
| Snowflake Role | When using:
| Yes |
| Snowflake Username | When using:
| Yes |
| Snowflake Warehouse | Snowflake warehouse used to run queries. | Yes |
Meta Ads Ingestion Parameters¶
| Parameter | Description |
|---|---|
| Report Name | Name of the report to be used as a destination table name. The name must be unique within the destination schema. |
| Report Object Id | Identifier of the downloaded object from Meta Ads.
|
| Report Ingestion Strategy | Mode in which data is fetched, either snapshot or incremental |
| Meta Ads Version | Version of Meta Ads API used for downloading reports. Allowed value: v22.0. |
| Report Level | Presents the aggregation level of the result.
|
| Report Fields | Comma separated list of report fields |
| Report Breakdowns | Comma separated list of report breakdowns. Full list of available breakdowns can be found here. |
| Report Time Increment | Level of aggregation based on the day count
|
| Report Action Time | Time of action stats
|
| Report Click Attribution Window | Attribution window for the click action
|
| Report View Attribution Window | Attribution window for the view action
|
| Report Schedule | Schedule time for processor creating reports |
| Report Start Date | Start date from which the ingestion should happen. The date format is YYYY-MM-DD. |
Run the flow¶
- Right-click on the plane and select Enable all Controller Services.
- Right-click on the imported process group and select Start. The connector starts the data ingestion.
How to reset the connector¶
To fully reset connector to the initial state, do the following:
-
Ensure that there are no more flow files in the queues.
-
Stop all the processors.
-
Clear the state of the initial processor.
- Right click on the processor
Create Meta Ads Reportand select View State. - Select the option Clear State. This resets the state of the processor.
- Right click on the processor
-
Drop the destination table in Snowflake.