The Facebook connector allows you view adverts, list generated leads from ads as well as create and update custom audiences.
Before being able to use the Facebook connector, authentication will need to be created. To do so, add the Facebook connector to the workflow and hit the New Authentication button found in the input panel.
The next windows provides you the opportunity to name the authentication as well as displaying the scopes that will be requested. Once you have named the authentication and all the scopes are ticked, press the button
You will be then redirected to a Facebook login page. Login to your account and continue.
Facebook will then ask you to grant permissions for the scopes selected in the previous screen. Press the OK button.
After being redirected back to the workflow, the authentication has been successfully created and the Facebook connector can now be used.
It's important to note that due to Facebook's authentication system, tray.io has to ask users who have created an authentication on the platform to re-authenticate regularly. tray.io will send an email to the owner of the authentication warning that the authentication will expire soon. To re-authenticate, a link will be provided that will take you to the authentication page.
Click on the URL and it will take you to this page:
From here, follow the same steps that were discussed in the Authenticating with Facebook section.
It is important to note that if re-authentication does not occur, the connector will fail after the authentication expires and workflows will be affected by this.
It is important to note that some operations within the connector are dependant on certain permissions that the signed in Facebook user has. For example, to use the
List leads from ad operation, you will need to be page admin to access the lead data of an ad (https://www.facebook.com/business/help/766393076839635). If operations are not returning data you're expecting, check using the facebook documentation that permissions are set up correctly.
This example will walkthrough how to list leads from a given ad. The first step is to add the Facebook connector to the workflow.
To list leads from an ad, the id of the ad we want to query needs to be provided. To find this ID, the operation list ads in ad account can be used. This will return data about all ads that belong to an ad account.
To use this operation, select the
List ads in ad account operation in the input panel.
An ad account then needs to be selected, this dictates what ads are listed.
The ID of the advertisement can the be collected from the result set manually, or JSONPaths can be used to get the data straight from the operation. Below the connector snake is used to retrieve the JSONPath:
The input for the
List leads from ad operation now looks like the following:
The workflow is ready to be ran. Below you can see that the workflow ran successfully and leads have been listed from a given ad.
This example will walkthrough how to create a custom audience. The first step is to add the Facebook connector to the workflow.
Create custom audience operation then needs to be selected.
The first steps that will be taken will be to provide some information about the custom audience. This includes the ad account that this audience will belong to, a name for the audience, a useful description about the audience and the customer file source.
The next step is provide a population for this custom audience. This is done by adding audience member objects to the array audience members.
Below you can see an example of on audience member object.
It is important to understand that if you did not want to include the same fields in every audience member object, you have to provide an empty string in the field you wish to leave out. An example below shows how in the next audience member, the
Birth year attribute wants to be left out. Using the tooltip, an empty string can be set. This will prevent any errors occurring when the workflow is ran.
Now the custom audience has been defined, the workflow is ready to be ran. As can be seen in the image below, the workflow ran successfully and a custom audience has been created in Facebook.
The Facebook leads ad trigger allows a user to receive a notification whenever a lead has been generated on a page. This trigger uses the same authentication as the core connector so you do not need to worry about creating another authentication to use the trigger. If you have not set up a authentication then please refer to the
Authenticating with Facebook section found in this doc. Below is a guide on how to use this trigger:
1. Select the Facebook leads ad trigger from the selection when creating a workflow
2. Once an authentication has been created or selected, the operation
Subscribe to Lead Gen Ads needs to be selected.
3. To use the trigger, a Facebook page that is managed by the user needs to be selected. A drop down is provided showing those pages that can be used.
4. Once the page has been selected, we can enable and save the trigger
Notifications sent by Facebook contain only the ID of the lead that was created. To get all associated data about the new Lead, the core connector will need to be used in the step after. The
Get Lead operation retrieves all information about a Lead from a given ID.