Skip to content

Commit

Permalink
Add audience management APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
aashikam committed Oct 17, 2024
1 parent 7d62194 commit 7d4ddf9
Show file tree
Hide file tree
Showing 11 changed files with 256 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .connector-store/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"status": "Active",
"releases": [
{
"tagName": "v1.0.1",
"tagName": "v1.0.2",
"products": [
"MI 4.3.0"
],
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gen_resources/config_fb.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion gen_resources/facebook_ads_open_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ security:
- ApiKeyAuth: [ ]
paths:
/act_{ad_account_id}/adcreatives:
get:
get:
summary: Retrieve a list of ad creatives.
operationId: Get Ad Creatives
responses:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
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
Expand Up @@ -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>
61 changes: 61 additions & 0 deletions src/main/resources/uischema/addUsersToAudience.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"connectorName": "facebookAds",
"operationName": "addUsersToAudience",
"title": "Add Users To Custom Audience",
"help": "This is Add Users to Custom Audience operation.",
"elements": [
{
"type": "attributeGroup",
"value": {
"groupName": "General",
"elements": [
{
"type": "attribute",
"value": {
"name": "configRef",
"displayName": "Connection",
"inputType": "connection",
"allowedConnectionTypes": [
"facebookAds"
],
"defaultType": "connection.facebookAds",
"defaultValue": "",
"required": "true",
"helpTip": "Connection to be used."
}
},
{
"type": "attributeGroup",
"value": {
"groupName": "Parameters",
"elements": [
{
"type": "attribute",
"value": {
"name": "customAudienceId",
"displayName": "Custom Audience Id",
"inputType": "stringOrExpression",
"defaultValue": "",
"required": "true",
"helpTip": "ID of the custom audience."
}
},
{
"type": "attribute",
"value": {
"name": "properties",
"displayName": "Properties",
"inputType": "stringOrExpression",
"defaultValue": "",
"required": "true",
"helpTip": "Custom audience users properties."
}
}
]
}
}
]
}
}
]
}
61 changes: 61 additions & 0 deletions src/main/resources/uischema/removeUsersFromAudience.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"connectorName": "facebookAds",
"operationName": "removeUsersFromAudience",
"title": "Remove Users From Custom Audience",
"help": "This is Remove Users from Custom Audience operation.",
"elements": [
{
"type": "attributeGroup",
"value": {
"groupName": "General",
"elements": [
{
"type": "attribute",
"value": {
"name": "configRef",
"displayName": "Connection",
"inputType": "connection",
"allowedConnectionTypes": [
"facebookAds"
],
"defaultType": "connection.facebookAds",
"defaultValue": "",
"required": "true",
"helpTip": "Connection to be used."
}
},
{
"type": "attributeGroup",
"value": {
"groupName": "Parameters",
"elements": [
{
"type": "attribute",
"value": {
"name": "customAudienceId",
"displayName": "Custom audience Id",
"inputType": "stringOrExpression",
"defaultValue": "",
"required": "true",
"helpTip": "ID of the ad set."
}
},
{
"type": "attribute",
"value": {
"name": "properties",
"displayName": "Properties",
"inputType": "stringOrExpression",
"defaultValue": "",
"required": "true",
"helpTip": "Custom audience users update properties."
}
}
]
}
}
]
}
}
]
}

0 comments on commit 7d4ddf9

Please sign in to comment.