
The **Remove Profiles from Custom Audience** node is one of the integration nodes from the [Facebook collection](/docs/automation/integration/facebook). The node allows you to build a workflow that removes selected customers from a Custom Audience. 

For example:
1. You have a Custom Audience of customers who abandoned a cart.
2. A customer makes a purchase.
3. You can use the node to remove the customer from that Custom Audience.


## Prerequisites
---
- [Generate the system user access token in Facebook](https://developers.facebook.com/docs/marketing-api/collaborative-ads/managed-partner-ads/api-guide/prerequisites/generate-access-token-system-user); as the `scope` value, select `ads_management`.
- [Create a Custom Audience in Facebook](https://www.facebook.com/business/help/170456843145568?id=2469097953376494). Save the ID o the Custom Audience in the notepad.

## Node configuration
---
1. Click the node. 
2. Click **Select connection**.  
3. From the dropdown list, select the connection.  
   If you haven't established a connection yet, see [Create a connection](/docs/automation/integration/facebook/send-custom-audience#create-a-connection).

### Create a connection
Generate an access token which allows you to send a request (send a segmentation of customers from Synerise to Facebook).  

1. At the bottom of the **Select connection** dropdown list, click **Add connection**.  
2. In the **Access token** field, enter the app access token.  
    
   <div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

   You can read more about access tokens in [Facebook documentation](https://developers.facebook.com/docs/marketing-api/conversions-api/get-started/#access-token).

   </div></div></div>
  
3. Click **Next**.  
4. In the **Connection name** field, enter the name for the access token you generated. 
5. Click **Apply**.  
        **Result**: A connection is created and selected. 

### Define the integration settings
In this part of the configuration process, you select the ID of the custom audience from which you want to remove customers, you define the API version of Facebook and select the type of customer ID based on which they will be identified.  

<figure><img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/docs/automation/_gfx/facebook-remove-profiles-custom-audience.png" class="medium" alt="A blank configuration form in Remove Profiles from Custom Audience"><figcaption>A blank configuration form in Remove Profiles from Custom Audience</figcaption></figure>  


<div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

Fields marked with the <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/snippet-icon.png" alt="Snippet icon" class="icon" > icon accept [snippets](/docs/assets/snippets) or [inserts](/developers/inserts). This integration allows usage of profile-related inserts.

</div></div></div>


1. In the **Graph API version** field, enter the currently used version of Facebook API.  
3. From the **Identifier type** dropdown list, select the ID of customers based on which they will be identified.  
    You can select either an email address or a phone number.  
4. In the **Identifier source** dropdown list, enter the Jinjava tag that corresponds to the identifier type you selected step before. It can be a `{{ customer.email }}` tag, for example.  
    
   <div class="admonition admonition-tip"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" /></svg></div><div class="admonition-body"><div class="admonition-content">

   You can read more about Jinjava tags in Automation Hub [here](/developers/inserts/automation).

   </div></div></div>

2. In the **Custom Audience Id** field, enter the ID of the Custom Audience.  
    You can source this information from the settings of the Custom Audience settings in Facebook.   
4. Confirm by clicking **Apply**.  
    **Result**: When the Remove Profiles from Custom Audience node is executed, a [`facebook.removeFromAudience` event](/docs/assets/events/event-reference/integration#facebookremovefromaudience) is generated on the activity list of the profile who is the actor in the workflow.

### Test integration
---

You can run a test request. If the request body contains a dynamic reference to a profile attribute and/or an event data from preceding nodes, then you can define the context using [test profile data](/docs/settings/configuration/test-profiles). 


<div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

Complete description of the feature is available in [Testing outgoing integrations](/docs/automation/test-requests-for-outgoing-integrations).

</div></div></div>



1. In the **Test integration** section, click **Send test request**.  
    **Result**: A test request builder opens. If:
    - a request body contains dynamic references, the request preview appears after you select the context of test profiles and events.
    - a request body contains static data, the preview of the body request appears immediately.
    <figure><img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/docs/automation/_gfx/test-request-builder-empty.png" class="large" alt="An empty test request builder"><figcaption>An empty test request builder</figcaption></figure>
2. If your request contains dynamic references (otherwise, the options aren't available):   
    - From the **Test profile** dropdown, select a test profile in the context of whom the test request will be performed.  
    - From the **Event context** dropdown list, you can select a particular occurrence of an event  whose values/information will be used for the test request.  
        1. Select a test profile.  
            **Result**: A history of test profile events appears.  
            <figure><img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/docs/automation/_gfx/event-stream-test-profile.png" class="large" alt="A stream of events of a test profile"><figcaption>A stream of events of a test profile</figcaption></figure> 
        2. From the list of events, select one whose data you want use as a context. If there is no event you can use, in the upper-right corner of the pop-up, click **Define own event** and provide the body of the event.
        3. Confirm by clicking **Apply**. 
3. Verify the request body. If there is something you want to change, come back to the node settings from previous steps.  
3. If the request body is ready to test, in the upper-right corner, click **Send request**.  
    **Result**: The response section appears and the **Update response event** button becomes active.  
4. Optionally, you can update response event with new parameters by clicking **Update response event** in the upper-right corner.

## Example of use
---

<figure><img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/docs/automation/_gfx/remove-profiles-from-CA.png" class="full" alt="The example workflow"><figcaption>The example workflow</figcaption></figure>

You can use this node in a workflow that removes customers with the "ABC" tag from the Custom Audience.

1. Start the workflow with the **Audience** node.  
2. In the configuration of the node:  
    1. Set the **Run trigger** option to **one time** and **Immediately**.  
    2. In the **Define audience** section, select **New audience**.
    3. Click **Define conditions**.  
    4. From the **Choose filter** dropdown list, select the name of the tag. In this example, it's **ABC**.
    5. From the **Choose operator** dropdown list, select **Is true**.  
    6. Click **Apply**.
3. Click **Apply**.
5. As the next node, select **Remove Profiles from Custom Audience**.
6. Configure the settings of the node according the [instruction above](/docs/automation/integration/facebook/remove-profiles-from-custom-audience#node-configuration).
7. As the final node, add **End**.
