-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6744cb6
commit 9ccebdf
Showing
6 changed files
with
328 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const BASE_URL = | ||
'https://ads-api.twitter.com/12/accounts/:account_id/custom_audiences/:custom_audience_id/users'; | ||
'https://ads-api.twitter.com/12/accounts/:account_id/custom_audiences/:audience_id/users'; | ||
const MAX_PAYLOAD_SIZE_IN_BYTES = 4000000; | ||
const MAX_OPERATIONS = 2500; | ||
module.exports = { BASE_URL, MAX_PAYLOAD_SIZE_IN_BYTES, MAX_OPERATIONS }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export const authHeaderConstant = | ||
'"OAuth oauth_consumer_key="validConsumerKey", oauth_nonce="j8kZvaJQRTaLX8h460CgHNs6rCEArNOW", oauth_signature="uAu%2FGdA6qPGW88pjVd7%2FgnAlHtM%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1725014809", oauth_token="validAccessToken", oauth_version="1.0"'; | ||
|
||
export const destination = { | ||
config: { | ||
accountId: '1234', | ||
audienceId: 'dummyId', | ||
}, | ||
ID: 'xpixel-1234', | ||
}; | ||
|
||
export const generateMetadata = (jobId: number, userId?: string): any => { | ||
return { | ||
jobId, | ||
attemptNum: 1, | ||
userId: userId || 'default-userId', | ||
sourceId: 'default-sourceId', | ||
destinationId: 'default-destinationId', | ||
workspaceId: 'default-workspaceId', | ||
secret: { | ||
consumerKey: 'validConsumerKey', | ||
consumerSecret: 'validConsumerSecret', | ||
accessToken: 'validAccessToken', | ||
accessTokenSecret: 'validAccessTokenSecret', | ||
}, | ||
dontBatch: false, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,13 @@ | ||
import { getOAuthFields, batchEvents } from '../../../../../src/v0/destinations/x_audience/utils'; | ||
import { destination, authHeaderConstant, generateMetadata } from '../common'; | ||
|
||
const authHeaderConstant = | ||
'"OAuth oauth_consumer_key="validConsumerKey", oauth_nonce="j8kZvaJQRTaLX8h460CgHNs6rCEArNOW", oauth_signature="uAu%2FGdA6qPGW88pjVd7%2FgnAlHtM%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1725014809", oauth_token="validAccessToken", oauth_version="1.0"'; | ||
|
||
const destination = { | ||
config: { | ||
username: '[email protected]', | ||
password: 'password@123', | ||
accountToken: 'NPS-dummyToken12', | ||
accountId: '1234', | ||
audienceId: 'dummyId', | ||
}, | ||
ID: 'wootric-1234', | ||
}; | ||
const generateMetadata = (jobId: number, userId?: string): any => { | ||
return { | ||
jobId, | ||
attemptNum: 1, | ||
userId: userId || 'default-userId', | ||
sourceId: 'default-sourceId', | ||
destinationId: 'default-destinationId', | ||
workspaceId: 'default-workspaceId', | ||
secret: { | ||
consumerKey: 'validConsumerKey', | ||
consumerSecret: 'validConsumerSecret', | ||
accessToken: 'validAccessToken', | ||
accessTokenSecret: 'validAccessTokenSecret', | ||
}, | ||
dontBatch: false, | ||
}; | ||
const fields = { | ||
email: '[email protected],[email protected]', | ||
phone_number: '98765433232,21323', | ||
handle: '@abc,@xyz', | ||
twitter_id: 'tid1,tid2', | ||
partner_user_id: 'puid1,puid2', | ||
}; | ||
|
||
export const data = [ | ||
{ | ||
name: 'x_audience', | ||
|
@@ -47,16 +25,11 @@ export const data = [ | |
type: 'record', | ||
action: 'insert', | ||
fields: { | ||
email: '[email protected],[email protected]', | ||
phone_number: '98765433232,21323', | ||
handle: '@abc,@xyz', | ||
...fields, | ||
device_id: 'did123,did456', | ||
twitter_id: 'tid1,tid2', | ||
partner_user_id: 'puid1,puid2', | ||
effective_at: '2024-05-15T00:00:00Z', | ||
expires_at: '2025-05-15T00:00:00Z', | ||
}, | ||
channel: 'sources', | ||
context: {}, | ||
recordId: '1', | ||
}, | ||
|
@@ -145,13 +118,7 @@ export const data = [ | |
message: { | ||
type: 'record', | ||
action: 'delete', | ||
fields: { | ||
email: '[email protected],[email protected]', | ||
phone_number: '98765433232,21323', | ||
handle: '@abc,@xyz', | ||
twitter_id: 'tid1,tid2', | ||
partner_user_id: 'puid1,puid2', | ||
}, | ||
fields, | ||
channel: 'sources', | ||
context: {}, | ||
recordId: '1', | ||
|
@@ -219,7 +186,7 @@ export const data = [ | |
request: { | ||
body: [ | ||
{ | ||
destination: { ...destination, config: { ...destination.config, enableHash: true } }, | ||
destination, | ||
message: { | ||
type: 'identify', | ||
context: {}, | ||
|
Oops, something went wrong.