Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: wso2-extensions/esb-connector-facebookads
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.1
Choose a base ref
...
head repository: wso2-extensions/esb-connector-facebookads
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.2
Choose a head ref
  • 5 commits
  • 11 files changed
  • 2 contributors

Commits on Oct 9, 2024

  1. Update meta information

    arunans23 committed Oct 9, 2024
    Copy the full SHA
    1a08670 View commit details
  2. Merge pull request #4 from wso2-extensions/update-meta-info

    Update meta information
    arunans23 authored Oct 9, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1a4522a View commit details

Commits on Oct 16, 2024

  1. Copy the full SHA
    7d62194 View commit details

Commits on Oct 17, 2024

  1. Add audience management APIs

    aashikam committed Oct 17, 2024
    Copy the full SHA
    7d4ddf9 View commit details

Commits on Oct 21, 2024

  1. Merge pull request #5 from aashikam/users

    Add audience/user management APIs
    arunans23 authored Oct 21, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    84ca94e View commit details
7 changes: 5 additions & 2 deletions .connector-store/meta.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
{
"name": "Facebook Ads",
"owner": "WSO2",
"category": "Developer Tools",
"category": "Sales and Marketing",
"documentationUrl": "https://mi.docs.wso2.com/en/latest/reference/connectors/facebook-ads-connector/facebook-ads-overview/",
"description": "The Facebook Ads Connector allows you to access the Facebook Marketing API. This lets you create, update, and delete ad campaigns and ads.",
"status": "Active",
"releases": [
{
"tagName": "v1.0.1",
"tagName": "v1.0.2",
"products": [
"MI 4.3.0"
],
"isHidden": false
}
],
"labels": [
"marketing"
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

| Connector Version | Supported WSO2 MI Version |
|-------------------|---------------------------|
| 1.0.1 | MI 4.3.0 |
| 1.0.2 | MI 4.3.0 |


## Documentation
2 changes: 1 addition & 1 deletion gen_resources/config_fb.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"project": {
"groupId": "org.wso2.carbon.esb.connector",
"artifactId": "facebook.ads",
"version": "1.0.1-SNAPSHOT"
"version": "1.0.2-SNAPSHOT"
},
"iconFolderPath": "",
"mappers": {
159 changes: 158 additions & 1 deletion gen_resources/facebook_ads_open_api.yaml
Original file line number Diff line number Diff line change
@@ -16,11 +16,13 @@ tags:
description: A group of ads that share the same daily or lifetime budget, schedule, bid type, bid info, and targeting data.
- name: Ad
description: Contains information to display an ad and associate it with an ad set.
- name: Custom Audience
description: Manage custom audiences for ad targeting.
security:
- ApiKeyAuth: [ ]
paths:
/act_{ad_account_id}/adcreatives:
get:
get:
summary: Retrieve a list of ad creatives.
operationId: Get Ad Creatives
responses:
@@ -129,6 +131,57 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/CustomAudience'
/{custom_audience_id}/users:
post:
tags:
- "Custom Audience"
summary: Add users to a custom audience.
operationId: Add Users to Custom Audience
parameters:
- in: path
name: custom_audience_id
required: true
schema:
type: string
description: The ID of the custom audience.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CustomAudienceUsersAdd'
responses:
'200':
description: Users added to custom audience successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/CustomAudienceUsersResponse'
delete:
tags:
- "Custom Audience"
summary: Remove users from a custom audience.
operationId: Remove Users from Custom Audience
parameters:
- in: path
name: custom_audience_id
required: true
schema:
type: string
description: The ID of the custom audience.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CustomAudienceUsersRemove'
responses:
'200':
description: Users removed from custom audience successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/CustomAudienceUsersResponse'
/act_{ad_account_id}/campaigns:
get:
tags:
@@ -2366,6 +2419,110 @@ components:
lifetime_budget:
type: integer
description: Lifetime budget
# New schema for adding users to a custom audience
CustomAudienceUsersAdd:
type: object
properties:
payload:
$ref: '#/components/schemas/CustomAudiencePayload'
session:
$ref: '#/components/schemas/CustomAudienceSession'
data_processing_options:
type: array
items:
type: string
description: Data processing options.
data_processing_options_country:
type: integer
description: Data processing options country code.
data_processing_options_state:
type: integer
description: Data processing options state code.
required:
- payload
CustomAudienceUsersRemove:
type: object
properties:
payload:
$ref: '#/components/schemas/CustomAudiencePayload'
required:
- payload
CustomAudienceUsersReplace:
type: object
properties:
payload:
$ref: '#/components/schemas/CustomAudiencePayload'
session:
$ref: '#/components/schemas/CustomAudienceSession'
required:
- payload
- session
CustomAudiencePayload:
type: object
properties:
schema:
oneOf:
- type: string
- type: array
items:
type: string
description: The schema of the user data. Can be a single string or an array of strings for multi-key matching.
data:
type: array
items:
type: array
items:
type: string
description: The user data to be added or removed.
is_raw:
type: boolean
description: Indicates if the data is raw.
page_ids:
type: array
items:
type: string
description: List of page IDs when using PAGEUID.
required:
- schema
- data
CustomAudienceSession:
type: object
properties:
session_id:
type: integer
description: Identifier used to track the session.
batch_seq:
type: integer
description: Sequential number to identify the batch in the current session.
last_batch_flag:
type: boolean
description: Indicates if this is the last batch in the session.
estimated_num_total:
type: integer
description: Estimated total number of users to be uploaded in this session.
required:
- session_id
- batch_seq
CustomAudienceUsersResponse:
type: object
properties:
audience_id:
type: string
description: Audience identifier.
session_id:
type: integer
description: Session ID provided in the request.
num_received:
type: integer
description: Total number of users received in this session so far.
num_invalid_entries:
type: integer
description: Number of entries sent with incorrect hashing or invalid format.
invalid_entry_samples:
type: array
items:
type: string
description: Up to 100 samples of invalid entries found in the current request.
securitySchemes:
ApiKeyAuth:
type: apiKey
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@

<groupId>org.wso2.carbon.esb.connector</groupId>
<artifactId>facebook.ads</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>

<name>WSO2 Carbon - Facebook Ads Connector</name>
<url>http://wso2.org</url>
Original file line number Diff line number Diff line change
@@ -48,6 +48,7 @@ public class RestURLBuilder extends AbstractConnector {
put("summary", "summary");
put("objectCount", "object_count");
put("adAccountId", "ad_account_id");
put("customAudienceId", "custom_audience_id");
put("campaignId", "campaign_id");
put("beforeDate", "before_date");
put("updatedSince", "updated_since");
60 changes: 60 additions & 0 deletions src/main/resources/functions/addUsersToAudience.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!--
~ Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 LLC. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->

<!-- Generated on 16-Wed, 10, 2024 19:59:26+0530 -->

<template xmlns="http://ws.apache.org/ns/synapse" name="addUsersToAudience">
<!-- Path Parameter List -->
<parameter name="customAudienceId" description="The ID of the custom audience."/>
<!-- Request Body Parameter List -->
<parameter name="properties" description="Custom audience users properties."/>
<sequence>
<class name="org.wso2.carbon.facebook.ads.connector.RestURLBuilder">
<property name="operationPath" value="/{custom_audience_id}/users"/>
<property name="pathParameters" value="customAudienceId,"/>
</class>
<payloadFactory media-type="json" template-type="freemarker">
<format><![CDATA[
${args.arg1}
]]></format>
<args>
<arg evaluator="xml" expression="$func:properties"/>
</args>
</payloadFactory>
<property name="DISABLE_CHUNKING" scope="axis2" type="STRING" value="true"/>
<property name="messageType" value="application/json" scope="axis2"/>
<property name="ContentType" value="application/json" scope="axis2"/>
<header name="Accept" value="application/json" scope="transport" action="set"/>
<call>
<endpoint>
<http method="POST" uri-template="{uri.var.base}{+uri.var.urlPath}{+uri.var.urlQuery}"/>
</endpoint>
</call>
<!-- Remove custom header information -->
<header name="x-business-use-case-usage" scope="transport" action="remove"/>
<header name="facebook-api-version" scope="transport" action="remove"/>
<header name="Strict-Transport-Security" scope="transport" action="remove"/>
<header name="x-fb-request-id" scope="transport" action="remove"/>
<header name="x-fb-trace-id" scope="transport" action="remove"/>
<header name="x-fb-rev" scope="transport" action="remove"/>
<header name="X-FB-Debug" scope="transport" action="remove"/>
<header name="x-fb-server-load" scope="transport" action="remove"/>
<header name="X-FB-Connection-Quality" scope="transport" action="remove"/>
<header name="Alt-Svc" scope="transport" action="remove"/>
</sequence>
</template>
8 changes: 8 additions & 0 deletions src/main/resources/functions/component.xml
Original file line number Diff line number Diff line change
@@ -93,5 +93,13 @@
<file>updateCustomAudience.xml</file>
<description>Updates a custom audience.</description>
</component>
<component name="addUsersToAudience">
<file>addUsersToAudience.xml</file>
<description>Add users to your Custom Audience.</description>
</component>
<component name="removeUsersFromAudience">
<file>removeUsersFromAudience.xml</file>
<description>Remove users from your Custom Audience.</description>
</component>
</subComponents>
</component>
60 changes: 60 additions & 0 deletions src/main/resources/functions/removeUsersFromAudience.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!--
~ Copyright (c) 2024, WSO2 LLC. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 LLC. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->

<!-- Generated on 16-Wed, 10, 2024 19:59:26+0530 -->

<template xmlns="http://ws.apache.org/ns/synapse" name="removeUsersFromAudience">
<!-- Path Parameter List -->
<parameter name="customAudienceId" description="The ID of the custom audience."/>
<!-- Request Body Parameter List -->
<parameter name="properties" description="Custom audience users properties."/>
<sequence>
<class name="org.wso2.carbon.facebook.ads.connector.RestURLBuilder">
<property name="operationPath" value="/{custom_audience_id}/users"/>
<property name="pathParameters" value="customAudienceId,"/>
</class>
<payloadFactory media-type="json" template-type="freemarker">
<format><![CDATA[
${args.arg1}
]]></format>
<args>
<arg evaluator="xml" expression="$func:properties"/>
</args>
</payloadFactory>
<property name="DISABLE_CHUNKING" scope="axis2" type="STRING" value="true"/>
<property name="messageType" value="application/json" scope="axis2"/>
<property name="ContentType" value="application/json" scope="axis2"/>
<header name="Accept" value="application/json" scope="transport" action="set"/>
<call>
<endpoint>
<http method="DELETE" uri-template="{uri.var.base}{+uri.var.urlPath}{+uri.var.urlQuery}"/>
</endpoint>
</call>
<!-- Remove custom header information -->
<header name="x-business-use-case-usage" scope="transport" action="remove"/>
<header name="facebook-api-version" scope="transport" action="remove"/>
<header name="Strict-Transport-Security" scope="transport" action="remove"/>
<header name="x-fb-request-id" scope="transport" action="remove"/>
<header name="x-fb-trace-id" scope="transport" action="remove"/>
<header name="x-fb-rev" scope="transport" action="remove"/>
<header name="X-FB-Debug" scope="transport" action="remove"/>
<header name="x-fb-server-load" scope="transport" action="remove"/>
<header name="X-FB-Connection-Quality" scope="transport" action="remove"/>
<header name="Alt-Svc" scope="transport" action="remove"/>
</sequence>
</template>
Loading