Skip to content

Commit

Permalink
feat: tiktok_offline_events added support for all Standard events (#3094
Browse files Browse the repository at this point in the history
)

* feat: tiktok_offline_events added support for all Standard  events

* chore: comments addressed

* Update src/v0/destinations/tiktok_ads_offline_events/config.js

Co-authored-by: Dilip Kola <[email protected]>

---------

Co-authored-by: Dilip Kola <[email protected]>
  • Loading branch information
anantjain45823 and koladilip authored Feb 15, 2024
1 parent 08d1bf0 commit b5cdccb
Show file tree
Hide file tree
Showing 2 changed files with 260 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/v0/destinations/tiktok_ads_offline_events/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,24 @@ const CONFIG_CATEGORIES = {
const PARTNER_NAME = 'RudderStack';

const EVENT_NAME_MAPPING = {
'addpaymentinfo': 'AddPaymentInfo',
'addtocart': 'AddToCart',
'addtowishlist': 'AddToWishlist',
'checkout started': 'InitiateCheckout',
'checkout step completed': 'CompletePayment',
contact: 'Contact',
submitform: 'SubmitForm',
subscribe: 'Subscribe',
'clickbutton': 'ClickButton',
'completeregistration': 'CompleteRegistration',
'contact': 'Contact',
'download': 'Download',
'order completed': 'PlaceAnOrder',
'payment info entered': 'AddPaymentInfo',
'product added': 'AddToCart',
'product added to wishlist': 'AddToWishlist',
'search': 'Search',
'submitform': 'SubmitForm',
'subscribe': 'Subscribe',
'viewcontent': 'ViewContent',
};

const MAPPING_CONFIG = getMappingConfig(CONFIG_CATEGORIES, __dirname);

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,4 +614,248 @@ export const data = [
},
},
},
{
name: 'tiktok_ads_offline_events',
description: 'Test 7 -> `search` standard tiktok Event through event mapping from UI',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
destination: {
Config: {
accessToken: 'dummyAccessToken',
hashUserProperties: true,
eventsToStandard: [
{
from: 'custom event',
to: 'Search',
},
],
},
},
message: {
type: 'track',
event: 'custom event',
sentAt: '2023-03-22T00:02:33.802Z',
traits: {
email: [
'efaaf5c8803af4fbf305d7a110c832673d89ed40983770329092fd04b0ba7900',
'078d6c8e19f24093368d1712d7801970467f59216f7ccc087bf81b91e0e1f68f',
],
phone: [
'c4994d14e724936f1169147dddf1673a09af69b55cc54bc695dbe246bd093b05',
'078d6c8e19f24093368d1712d7801970467f59216f7ccc087bf81b91e0e1f68f',
],
},
userId: '60241286212',
channel: 'sources',
context: {
sources: {
job_id: '2N4WuoNQpGYmCPASUvnV86QyhY4/Syncher',
version: 'v1.20.0',
job_run_id: 'cgd4a063b2fn2e1j0q90',
task_run_id: 'cgd4a063b2fn2e1j0qa0',
},
},
recordId: '16322',
rudderId: '5b4ed73f-69aa-4198-88d1-3d4d509acbf1',
messageId: 'cgd4b663b2fn2e1j8th0',
timestamp: '2023-03-22T00:02:33.170Z',
properties: {
phone: 'c4994d14e724936f1169147dddf1673a09af69b55cc54bc695dbe246bd093b05',
value: 32.839999999999996,
emails:
'["efaaf5c8803af4fbf305d7a110c832673d89ed40983770329092fd04b0ba7900","078d6c8e19f24093368d1712d7801970467f59216f7ccc087bf81b91e0e1f68f","","","","","","","",""]',
eventId: '8965fb56-090f-47a5-aa7f-bbab22d9ec90',
currency: 'USD',
order_id: 60241286212,
eventSetId: '7211223771099742210',
event_name: 'CompletePayment',
},
receivedAt: '2023-03-22T00:02:33.171Z',
request_ip: '10.7.78.187',
anonymousId: '60241286212',
originalTimestamp: '2023-03-22T00:02:33.802Z',
},
},
],
},
},
output: {
response: {
status: 200,
body: [
{
output: {
version: '1',
type: 'REST',
method: 'POST',
endpoint: 'https://business-api.tiktok.com/open_api/v1.3/offline/track/',
headers: {
'Access-Token': 'dummyAccessToken',
'Content-Type': 'application/json',
},
params: {},
body: {
JSON: {
event_set_id: '7211223771099742210',
event_id: '8965fb56-090f-47a5-aa7f-bbab22d9ec90',
timestamp: '2023-03-22T00:02:33.170Z',
properties: {
order_id: 60241286212,
currency: 'USD',
value: 32.839999999999996,
},
event: 'Search',
partner_name: 'RudderStack',
context: {
user: {
emails: [
'4dc75b075057df6f6b729e74a9feed1244dcf8ceb7903eaba13203f3268ae4b9',
'77b639edeb3cd6c801ea05176b8acbfa38d5f38490b764cd0c80756d0cf9ec68',
],
phone_numbers: [
'28b7b205c2936d2ded022d2587fb2677a76e560e921b3ad615b739b0238baa5d',
'77b639edeb3cd6c801ea05176b8acbfa38d5f38490b764cd0c80756d0cf9ec68',
],
},
},
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
event_set_id: '7211223771099742210',
userId: '',
},
statusCode: 200,
},
],
},
},
},
{
name: 'tiktok_ads_offline_events',
description:
'Test 8 -> `PlaceAnOrder` standard tiktok Event through event `order completed` in payload',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
destination: {
Config: {
accessToken: 'dummyAccessToken',
hashUserProperties: true,
eventsToStandard: [],
},
},
message: {
type: 'track',
event: 'order completed',
sentAt: '2023-03-22T00:02:33.802Z',
traits: {
email: [
'efaaf5c8803af4fbf305d7a110c832673d89ed40983770329092fd04b0ba7900',
'078d6c8e19f24093368d1712d7801970467f59216f7ccc087bf81b91e0e1f68f',
],
phone: [
'c4994d14e724936f1169147dddf1673a09af69b55cc54bc695dbe246bd093b05',
'078d6c8e19f24093368d1712d7801970467f59216f7ccc087bf81b91e0e1f68f',
],
},
userId: '60241286212',
channel: 'sources',
context: {
sources: {
job_id: '2N4WuoNQpGYmCPASUvnV86QyhY4/Syncher',
version: 'v1.20.0',
job_run_id: 'cgd4a063b2fn2e1j0q90',
task_run_id: 'cgd4a063b2fn2e1j0qa0',
},
},
recordId: '16322',
rudderId: '5b4ed73f-69aa-4198-88d1-3d4d509acbf1',
messageId: 'cgd4b663b2fn2e1j8th0',
timestamp: '2023-03-22T00:02:33.170Z',
properties: {
phone: 'c4994d14e724936f1169147dddf1673a09af69b55cc54bc695dbe246bd093b05',
value: 32.839999999999996,
emails:
'["efaaf5c8803af4fbf305d7a110c832673d89ed40983770329092fd04b0ba7900","078d6c8e19f24093368d1712d7801970467f59216f7ccc087bf81b91e0e1f68f","","","","","","","",""]',
eventId: '8965fb56-090f-47a5-aa7f-bbab22d9ec90',
currency: 'USD',
order_id: 60241286212,
eventSetId: '7211223771099742210',
event_name: 'CompletePayment',
},
receivedAt: '2023-03-22T00:02:33.171Z',
request_ip: '10.7.78.187',
anonymousId: '60241286212',
originalTimestamp: '2023-03-22T00:02:33.802Z',
},
},
],
},
},
output: {
response: {
status: 200,
body: [
{
output: {
version: '1',
type: 'REST',
method: 'POST',
endpoint: 'https://business-api.tiktok.com/open_api/v1.3/offline/track/',
headers: {
'Access-Token': 'dummyAccessToken',
'Content-Type': 'application/json',
},
params: {},
body: {
JSON: {
event_set_id: '7211223771099742210',
event_id: '8965fb56-090f-47a5-aa7f-bbab22d9ec90',
timestamp: '2023-03-22T00:02:33.170Z',
properties: {
order_id: 60241286212,
currency: 'USD',
value: 32.839999999999996,
},
event: 'PlaceAnOrder',
partner_name: 'RudderStack',
context: {
user: {
emails: [
'4dc75b075057df6f6b729e74a9feed1244dcf8ceb7903eaba13203f3268ae4b9',
'77b639edeb3cd6c801ea05176b8acbfa38d5f38490b764cd0c80756d0cf9ec68',
],
phone_numbers: [
'28b7b205c2936d2ded022d2587fb2677a76e560e921b3ad615b739b0238baa5d',
'77b639edeb3cd6c801ea05176b8acbfa38d5f38490b764cd0c80756d0cf9ec68',
],
},
},
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
event_set_id: '7211223771099742210',
userId: '',
},
statusCode: 200,
},
],
},
},
},
];

0 comments on commit b5cdccb

Please sign in to comment.