@segment/action-destinations 3.127.3-staging.143 → 3.128.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/dist/destinations/actable-predictive/index.js +1 -1
  2. package/dist/destinations/actable-predictive/index.js.map +1 -1
  3. package/dist/destinations/actable-predictive/sendCustomEvent/index.js +13 -13
  4. package/dist/destinations/actable-predictive/sendCustomEvent/index.js.map +1 -1
  5. package/dist/destinations/actable-predictive/sendEmailEvent/index.js +20 -20
  6. package/dist/destinations/actable-predictive/sendEmailEvent/index.js.map +1 -1
  7. package/dist/destinations/actable-predictive/sendTransactionEvent/index.js +28 -28
  8. package/dist/destinations/actable-predictive/sendTransactionEvent/index.js.map +1 -1
  9. package/dist/destinations/actable-predictive/sendWebEvent/index.js +25 -25
  10. package/dist/destinations/actable-predictive/sendWebEvent/index.js.map +1 -1
  11. package/dist/destinations/braze/trackEvent/generated-types.d.ts +1 -0
  12. package/dist/destinations/braze/trackEvent/index.js +11 -35
  13. package/dist/destinations/braze/trackEvent/index.js.map +1 -1
  14. package/dist/destinations/braze/trackPurchase/index.js +2 -43
  15. package/dist/destinations/braze/trackPurchase/index.js.map +1 -1
  16. package/dist/destinations/braze/utils.d.ts +6 -0
  17. package/dist/destinations/braze/utils.js +81 -0
  18. package/dist/destinations/braze/utils.js.map +1 -0
  19. package/dist/destinations/braze-cohorts/syncAudiences/index.js +3 -3
  20. package/dist/destinations/braze-cohorts/syncAudiences/index.js.map +1 -1
  21. package/dist/destinations/clevertap/userDelete/index.js +4 -4
  22. package/dist/destinations/clevertap/userDelete/index.js.map +1 -1
  23. package/dist/destinations/customerio/createUpdateObject/generated-types.d.ts +1 -1
  24. package/dist/destinations/customerio/createUpdateObject/index.js +5 -5
  25. package/dist/destinations/customerio/createUpdateObject/index.js.map +1 -1
  26. package/dist/destinations/customerio/createUpdatePerson/index.js +2 -2
  27. package/dist/destinations/customerio/createUpdatePerson/index.js.map +1 -1
  28. package/dist/destinations/engage-messaging-twilio/index.js +1 -3
  29. package/dist/destinations/engage-messaging-twilio/index.js.map +1 -1
  30. package/dist/destinations/engage-messaging-twilio/sendSms/index.js +104 -2
  31. package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +1 -1
  32. package/dist/destinations/google-enhanced-conversions/index.js +1 -1
  33. package/dist/destinations/google-enhanced-conversions/index.js.map +1 -1
  34. package/dist/destinations/heap/constants.d.ts +1 -1
  35. package/dist/destinations/heap/constants.js +2 -2
  36. package/dist/destinations/heap/constants.js.map +1 -1
  37. package/dist/destinations/heap/trackEvent/generated-types.d.ts +1 -1
  38. package/dist/destinations/heap/trackEvent/index.js +13 -10
  39. package/dist/destinations/heap/trackEvent/index.js.map +1 -1
  40. package/dist/destinations/index.js +1 -1
  41. package/dist/destinations/index.js.map +1 -1
  42. package/dist/destinations/mixpanel/index.js +1 -1
  43. package/dist/destinations/mixpanel/mixpanel-properties.js.map +1 -1
  44. package/dist/destinations/mixpanel/trackEvent/functions.js +1 -1
  45. package/dist/destinations/mixpanel/trackEvent/functions.js.map +1 -1
  46. package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
  47. package/dist/destinations/mixpanel/trackPurchase/index.js.map +1 -1
  48. package/dist/destinations/mixpanel/utils.js +1 -1
  49. package/dist/destinations/mixpanel/utils.js.map +1 -1
  50. package/dist/destinations/pipedrive/createUpdateActivity/index.js +44 -17
  51. package/dist/destinations/pipedrive/createUpdateActivity/index.js.map +1 -1
  52. package/dist/destinations/pipedrive/createUpdateDeal/index.js +35 -11
  53. package/dist/destinations/pipedrive/createUpdateDeal/index.js.map +1 -1
  54. package/dist/destinations/pipedrive/createUpdateLead/generated-types.d.ts +3 -8
  55. package/dist/destinations/pipedrive/createUpdateLead/index.js +54 -27
  56. package/dist/destinations/pipedrive/createUpdateLead/index.js.map +1 -1
  57. package/dist/destinations/pipedrive/createUpdateNote/generated-types.d.ts +1 -1
  58. package/dist/destinations/pipedrive/createUpdateNote/index.js +22 -13
  59. package/dist/destinations/pipedrive/createUpdateNote/index.js.map +1 -1
  60. package/dist/destinations/pipedrive/createUpdateOrganization/index.js +8 -2
  61. package/dist/destinations/pipedrive/createUpdateOrganization/index.js.map +1 -1
  62. package/dist/destinations/pipedrive/createUpdatePerson/index.js +15 -3
  63. package/dist/destinations/pipedrive/createUpdatePerson/index.js.map +1 -1
  64. package/dist/destinations/pipedrive/index.d.ts +1 -1
  65. package/dist/destinations/pipedrive/index.js +22 -1
  66. package/dist/destinations/pipedrive/index.js.map +1 -1
  67. package/dist/destinations/pipedrive/pipedriveApi/leads.d.ts +5 -1
  68. package/dist/destinations/pipedrive/pipedriveApi/leads.js.map +1 -1
  69. package/dist/destinations/pipedrive/pipedriveApi/notes.d.ts +1 -1
  70. package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.d.ts +2 -1
  71. package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.js +7 -1
  72. package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.js.map +1 -1
  73. package/dist/destinations/salesforce/sf-properties.d.ts +0 -1
  74. package/dist/destinations/salesforce/sf-properties.js.map +1 -1
  75. package/dist/destinations/saleswings/api.d.ts +35 -0
  76. package/dist/destinations/saleswings/api.js +19 -0
  77. package/dist/destinations/saleswings/api.js.map +1 -0
  78. package/dist/destinations/saleswings/common.d.ts +5 -0
  79. package/dist/destinations/saleswings/common.js +37 -0
  80. package/dist/destinations/saleswings/common.js.map +1 -0
  81. package/dist/destinations/saleswings/converter.d.ts +12 -0
  82. package/dist/destinations/saleswings/converter.js +34 -0
  83. package/dist/destinations/saleswings/converter.js.map +1 -0
  84. package/dist/destinations/saleswings/fields.d.ts +12 -0
  85. package/dist/destinations/saleswings/fields.js +102 -0
  86. package/dist/destinations/saleswings/fields.js.map +1 -0
  87. package/dist/destinations/{google-sheets-partner → saleswings}/generated-types.d.ts +1 -0
  88. package/dist/destinations/{actions-bingads → saleswings}/generated-types.js +0 -0
  89. package/dist/destinations/saleswings/generated-types.js.map +1 -0
  90. package/dist/destinations/{actions-bingads → saleswings}/index.d.ts +1 -1
  91. package/dist/destinations/saleswings/index.js +67 -0
  92. package/dist/destinations/saleswings/index.js.map +1 -0
  93. package/dist/destinations/saleswings/submitIdentifyEvent/generated-types.d.ts +14 -0
  94. package/dist/destinations/{actions-bingads/offlineConversions → saleswings/submitIdentifyEvent}/generated-types.js +0 -0
  95. package/dist/destinations/saleswings/submitIdentifyEvent/generated-types.js.map +1 -0
  96. package/dist/destinations/{actions-bingads/offlineConversions → saleswings/submitIdentifyEvent}/index.d.ts +0 -0
  97. package/dist/destinations/saleswings/submitIdentifyEvent/index.js +39 -0
  98. package/dist/destinations/saleswings/submitIdentifyEvent/index.js.map +1 -0
  99. package/dist/destinations/saleswings/submitPageEvent/generated-types.d.ts +8 -0
  100. package/dist/destinations/{engage-messaging-twilio/sendWhatsApp → saleswings/submitPageEvent}/generated-types.js +0 -0
  101. package/dist/destinations/saleswings/submitPageEvent/generated-types.js.map +1 -0
  102. package/dist/destinations/{engage-messaging-twilio/sendWhatsApp → saleswings/submitPageEvent}/index.d.ts +0 -0
  103. package/dist/destinations/saleswings/submitPageEvent/index.js +35 -0
  104. package/dist/destinations/saleswings/submitPageEvent/index.js.map +1 -0
  105. package/dist/destinations/saleswings/submitScreenEvent/generated-types.d.ts +14 -0
  106. package/dist/destinations/{google-sheets-partner → saleswings/submitScreenEvent}/generated-types.js +0 -0
  107. package/dist/destinations/saleswings/submitScreenEvent/generated-types.js.map +1 -0
  108. package/dist/destinations/{google-sheets-partner/postSheet → saleswings/submitScreenEvent}/index.d.ts +1 -1
  109. package/dist/destinations/saleswings/submitScreenEvent/index.js +42 -0
  110. package/dist/destinations/saleswings/submitScreenEvent/index.js.map +1 -0
  111. package/dist/destinations/saleswings/submitTrackEvent/generated-types.d.ts +14 -0
  112. package/dist/destinations/{google-sheets-partner/postSheet → saleswings/submitTrackEvent}/generated-types.js +0 -0
  113. package/dist/destinations/saleswings/submitTrackEvent/generated-types.js.map +1 -0
  114. package/dist/destinations/saleswings/submitTrackEvent/index.d.ts +5 -0
  115. package/dist/destinations/saleswings/submitTrackEvent/index.js +42 -0
  116. package/dist/destinations/saleswings/submitTrackEvent/index.js.map +1 -0
  117. package/dist/destinations/saleswings/testing.d.ts +10 -0
  118. package/dist/destinations/saleswings/testing.js +55 -0
  119. package/dist/destinations/saleswings/testing.js.map +1 -0
  120. package/dist/destinations/segment/segment-properties.js +2 -1
  121. package/dist/destinations/segment/segment-properties.js.map +1 -1
  122. package/dist/destinations/segment/sendTrack/generated-types.d.ts +1 -1
  123. package/package.json +2 -4
  124. package/dist/destinations/actions-bingads/functions.d.ts +0 -0
  125. package/dist/destinations/actions-bingads/functions.js +0 -2
  126. package/dist/destinations/actions-bingads/functions.js.map +0 -1
  127. package/dist/destinations/actions-bingads/generated-types.d.ts +0 -10
  128. package/dist/destinations/actions-bingads/generated-types.js.map +0 -1
  129. package/dist/destinations/actions-bingads/index.js +0 -77
  130. package/dist/destinations/actions-bingads/index.js.map +0 -1
  131. package/dist/destinations/actions-bingads/offlineConversions/formatter.d.ts +0 -8
  132. package/dist/destinations/actions-bingads/offlineConversions/formatter.js +0 -33
  133. package/dist/destinations/actions-bingads/offlineConversions/formatter.js.map +0 -1
  134. package/dist/destinations/actions-bingads/offlineConversions/generated-types.d.ts +0 -7
  135. package/dist/destinations/actions-bingads/offlineConversions/generated-types.js.map +0 -1
  136. package/dist/destinations/actions-bingads/offlineConversions/index.js +0 -131
  137. package/dist/destinations/actions-bingads/offlineConversions/index.js.map +0 -1
  138. package/dist/destinations/braze-cohorts/cohortChanges.d.ts +0 -10
  139. package/dist/destinations/braze-cohorts/cohortChanges.js +0 -3
  140. package/dist/destinations/braze-cohorts/cohortChanges.js.map +0 -1
  141. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.d.ts +0 -14
  142. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js +0 -65
  143. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js.map +0 -1
  144. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.d.ts +0 -23
  145. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.js.map +0 -1
  146. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js +0 -122
  147. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js.map +0 -1
  148. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.d.ts +0 -14
  149. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js +0 -65
  150. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js.map +0 -1
  151. package/dist/destinations/engage-messaging-twilio/utils/message-sender.d.ts +0 -22
  152. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js +0 -97
  153. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js.map +0 -1
  154. package/dist/destinations/google-sheets-partner/constants.d.ts +0 -3
  155. package/dist/destinations/google-sheets-partner/constants.js +0 -7
  156. package/dist/destinations/google-sheets-partner/constants.js.map +0 -1
  157. package/dist/destinations/google-sheets-partner/generated-types.js.map +0 -1
  158. package/dist/destinations/google-sheets-partner/googleapis/index.d.ts +0 -17
  159. package/dist/destinations/google-sheets-partner/googleapis/index.js +0 -34
  160. package/dist/destinations/google-sheets-partner/googleapis/index.js.map +0 -1
  161. package/dist/destinations/google-sheets-partner/index.d.ts +0 -4
  162. package/dist/destinations/google-sheets-partner/index.js +0 -43
  163. package/dist/destinations/google-sheets-partner/index.js.map +0 -1
  164. package/dist/destinations/google-sheets-partner/postSheet/generated-types.d.ts +0 -11
  165. package/dist/destinations/google-sheets-partner/postSheet/generated-types.js.map +0 -1
  166. package/dist/destinations/google-sheets-partner/postSheet/index.js +0 -79
  167. package/dist/destinations/google-sheets-partner/postSheet/index.js.map +0 -1
  168. package/dist/destinations/google-sheets-partner/postSheet/operations.d.ts +0 -10
  169. package/dist/destinations/google-sheets-partner/postSheet/operations.js +0 -96
  170. package/dist/destinations/google-sheets-partner/postSheet/operations.js.map +0 -1
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAccessToken = void 0;
4
- const actions_core_1 = require("@segment/actions-core");
5
- function getAccessToken(mapping) {
6
- const endpoint = 'https://login.microsoftonline.com/common/oauth2/v2.0/token';
7
- const uspCoded = new URLSearchParams({
8
- client_id: mapping.client_id,
9
- refresh_token: mapping.refresh_token,
10
- scope: mapping.scope,
11
- redirect_uri: mapping.redirect_uri,
12
- grant_type: 'refresh_token',
13
- client_secret: mapping.client_secret
14
- });
15
- try {
16
- return actions_core_1.fetch(endpoint, {
17
- method: 'post',
18
- headers: {
19
- 'Content-Type': 'application/x-www-form-urlencoded'
20
- },
21
- body: uspCoded
22
- })
23
- .then((response) => response.json())
24
- .then((data) => {
25
- return data;
26
- });
27
- }
28
- catch (error) {
29
- console.log(error.message);
30
- }
31
- }
32
- exports.getAccessToken = getAccessToken;
33
- //# sourceMappingURL=formatter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../src/destinations/actions-bingads/offlineConversions/formatter.ts"],"names":[],"mappings":";;;AAAA,wDAA6C;AAE7C,SAAgB,cAAc,CAAC,OAO9B;IACC,MAAM,QAAQ,GAAG,4DAA4D,CAAA;IAG7E,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC;QACnC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,UAAU,EAAE,eAAe;QAC3B,aAAa,EAAE,OAAO,CAAC,aAAa;KACrC,CAAC,CAAA;IAEF,IAAI;QACF,OAAO,oBAAK,CAAC,QAAQ,EAAE;YACrB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,mCAAmC;aACpD;YACD,IAAI,EAAE,QAAQ;SACf,CAAC;aACC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;aACnC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACb,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;KAGL;IAAC,OAAO,KAAK,EAAE;QAEd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;KAC3B;AACH,CAAC;AAtCD,wCAsCC"}
@@ -1,7 +0,0 @@
1
- export interface Payload {
2
- ConversionCurrencyCode: string;
3
- ConversionName: string;
4
- ConversionTime: string;
5
- ConversionValue: string;
6
- MicrosoftClickId: string;
7
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/actions-bingads/offlineConversions/generated-types.ts"],"names":[],"mappings":""}
@@ -1,131 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const formatter_1 = require("./formatter");
4
- let authenticationToken = 'XXXXXXXX';
5
- const action = {
6
- title: 'Offline Conversions',
7
- description: 'TODO',
8
- fields: {
9
- ConversionCurrencyCode: {
10
- label: 'Conversion Currency Code',
11
- description: 'Conversion Currency Code',
12
- type: 'string',
13
- required: true,
14
- default: {
15
- '@path': '$.properties.conversionCurrency'
16
- }
17
- },
18
- ConversionName: {
19
- label: 'Conversion Name',
20
- description: 'Conversion Name',
21
- type: 'string',
22
- required: true,
23
- default: {
24
- '@path': '$.properties.conversionName'
25
- }
26
- },
27
- ConversionTime: {
28
- label: 'Conversion Time',
29
- description: 'Conversion Time',
30
- type: 'string',
31
- required: true,
32
- default: {
33
- '@path': '$.properties.conversionTime'
34
- }
35
- },
36
- ConversionValue: {
37
- label: 'Conversion Value',
38
- description: 'Conversion Value',
39
- type: 'string',
40
- required: true,
41
- default: {
42
- '@path': '$.properties.conversionValue'
43
- }
44
- },
45
- MicrosoftClickId: {
46
- label: 'Microsoft Click Id',
47
- description: 'Microsoft Click Id',
48
- type: 'string',
49
- required: true,
50
- default: {
51
- '@path': '$.properties.msCId'
52
- }
53
- }
54
- },
55
- perform: async (request, data) => {
56
- const response_data = await formatter_1.getAccessToken({
57
- client_id: data.settings.client_id,
58
- scope: data.settings.scope,
59
- redirect_uri: data.settings.redirect_uri,
60
- grant_type: 'refresh_token',
61
- client_secret: data.settings.client_secret,
62
- refresh_token: data.settings.refreshToken
63
- });
64
- authenticationToken = response_data.access_token;
65
- console.log('Access Token retrieved using Refresh Token ');
66
- let conversionTime = data.payload.ConversionTime;
67
- if (conversionTime.includes('UTC')) {
68
- const val2 = conversionTime.replace(' UTC', '');
69
- conversionTime = val2.replace(' ', 'T');
70
- }
71
- const conversionCurrency = data.payload.ConversionCurrencyCode;
72
- const msCId = data.payload.MicrosoftClickId;
73
- const conversionValue = data.payload.ConversionValue;
74
- const conversionName = data.payload.ConversionName;
75
- console.log('Conversion Goal: ', conversionName);
76
- const endpoint = 'https://campaign.api.bingads.microsoft.com/Api/Advertiser/CampaignManagement/V13/CampaignManagementService.svc?singleWsdl';
77
- const sr = '<s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" ' +
78
- 'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">' +
79
- '<s:Header xmlns="https://bingads.microsoft.com/CampaignManagement/v13">' +
80
- '<Action mustUnderstand="1">ApplyOfflineConversions</Action>' +
81
- '<AuthenticationToken i:nil="false">' +
82
- authenticationToken +
83
- '</AuthenticationToken>' +
84
- '<CustomerAccountId i:nil="false">' +
85
- data.settings.customer_account_id +
86
- '</CustomerAccountId>' +
87
- '<CustomerId i:nil="false">' +
88
- data.settings.customer_id +
89
- '</CustomerId>' +
90
- '<DeveloperToken i:nil="false">' +
91
- data.settings.developer_token +
92
- '</DeveloperToken>' +
93
- '</s:Header>' +
94
- '<s:Body>' +
95
- '<ApplyOfflineConversionsRequest xmlns="https://bingads.microsoft.com/CampaignManagement/v13">' +
96
- '<OfflineConversions i:nil="false"><OfflineConversion><ConversionCurrencyCode i:nil="false">' +
97
- conversionCurrency +
98
- '</ConversionCurrencyCode>' +
99
- '<ConversionName i:nil="false">' +
100
- conversionName +
101
- '</ConversionName>' +
102
- '<ConversionTime>' +
103
- conversionTime +
104
- '</ConversionTime>' +
105
- '<ConversionValue i:nil="false">' +
106
- conversionValue +
107
- '</ConversionValue>' +
108
- '<MicrosoftClickId i:nil="false">' +
109
- msCId +
110
- '</MicrosoftClickId></OfflineConversion></OfflineConversions>' +
111
- '</ApplyOfflineConversionsRequest></s:Body></s:Envelope>';
112
- try {
113
- const response = await request(endpoint, {
114
- method: 'post',
115
- headers: {
116
- SOAPAction: 'ApplyOfflineConversions',
117
- 'Content-Type': 'text/xml;charset=utf-8'
118
- },
119
- body: sr,
120
- redirect: 'follow'
121
- });
122
- console.log('***** Conversion Attributed successfully! *****');
123
- console.log(response);
124
- }
125
- catch (error) {
126
- console.log(error.message);
127
- }
128
- }
129
- };
130
- exports.default = action;
131
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/actions-bingads/offlineConversions/index.ts"],"names":[],"mappings":";;AAIA,2CAA4C;AAE5C,IAAI,mBAAmB,GAAG,UAAU,CAAA;AAEpC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE;QACN,sBAAsB,EAAE;YACtB,KAAK,EAAE,0BAA0B;YACjC,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,iCAAiC;aAC3C;SACF;QACD,cAAc,EAAE;YACd,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO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,QAAQ,EAAE,QAAQ;aACnB,CAAC,CAAA;YACF,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAA;YAC9D,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;SACtB;QAAC,OAAO,KAAK,EAAE;YAEd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;SAC3B;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,10 +0,0 @@
1
- export interface UserAlias {
2
- alias_name: string;
3
- alias_label: string;
4
- }
5
- export interface CohortChanges {
6
- user_ids: Array<string>;
7
- device_ids: Array<string>;
8
- aliases: Array<UserAlias>;
9
- should_remove?: boolean;
10
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=cohortChanges.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cohortChanges.js","sourceRoot":"","sources":["../../../src/destinations/braze-cohorts/cohortChanges.ts"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- import type { Settings } from '../generated-types';
2
- import type { Payload } from './generated-types';
3
- import { StatsClient, StatsContext } from '@segment/actions-core/src/destination-kit';
4
- import { MessageSender, RequestFn } from '../utils/message-sender';
5
- export declare class SmsMessageSender extends MessageSender<Payload> {
6
- readonly request: RequestFn;
7
- readonly payload: Payload;
8
- readonly settings: Settings;
9
- readonly statsClient: StatsClient | undefined;
10
- readonly tags: StatsContext['tags'] | undefined;
11
- constructor(request: RequestFn, payload: Payload, settings: Settings, statsClient: StatsClient | undefined, tags: StatsContext['tags'] | undefined);
12
- getBody: (phone: string) => Promise<URLSearchParams>;
13
- private getProfileTraits;
14
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SmsMessageSender = void 0;
4
- const liquidjs_1 = require("liquidjs");
5
- const actions_core_1 = require("@segment/actions-core");
6
- const message_sender_1 = require("../utils/message-sender");
7
- const Liquid = new liquidjs_1.Liquid();
8
- class SmsMessageSender extends message_sender_1.MessageSender {
9
- constructor(request, payload, settings, statsClient, tags) {
10
- super(request, payload, settings, statsClient, tags);
11
- this.request = request;
12
- this.payload = payload;
13
- this.settings = settings;
14
- this.statsClient = statsClient;
15
- this.tags = tags;
16
- this.getBody = async (phone) => {
17
- let traits;
18
- if (this.payload.traitEnrichment) {
19
- traits = this.payload?.traits ? this.payload?.traits : {};
20
- }
21
- else {
22
- traits = await this.getProfileTraits();
23
- }
24
- const profile = {
25
- user_id: this.payload.userId,
26
- phone,
27
- traits
28
- };
29
- let parsedBody;
30
- try {
31
- parsedBody = await Liquid.parseAndRender(this.payload.body, { profile });
32
- }
33
- catch (error) {
34
- throw new actions_core_1.IntegrationError(`Unable to parse templating in SMS`, `SMS templating parse failure`, 400);
35
- }
36
- const body = new URLSearchParams({
37
- Body: parsedBody,
38
- From: this.payload.from,
39
- To: phone
40
- });
41
- return body;
42
- };
43
- this.getProfileTraits = async () => {
44
- try {
45
- const endpoint = `https://profiles.segment.${this.settings.profileApiEnvironment === 'production' ? 'com' : 'build'}`;
46
- const response = await this.request(`${endpoint}/v1/spaces/${this.settings.spaceId}/collections/users/profiles/user_id:${encodeURIComponent(this.payload.userId)}/traits?limit=200`, {
47
- headers: {
48
- authorization: `Basic ${Buffer.from(this.settings.profileApiAccessToken + ':').toString('base64')}`,
49
- 'content-type': 'application/json'
50
- }
51
- });
52
- this.tags?.push(`profile_status_code:${response.status}`);
53
- this.statsClient?.incr('actions-personas-messaging-twilio.profile_invoked', 1, this.tags);
54
- const body = await response.json();
55
- return body.traits;
56
- }
57
- catch (error) {
58
- this.statsClient?.incr('actions-personas-messaging-twilio.profile_error', 1, this.tags);
59
- throw new actions_core_1.IntegrationError('Unable to get profile traits for SMS message', 'SMS trait fetch failure', 500);
60
- }
61
- };
62
- }
63
- }
64
- exports.SmsMessageSender = SmsMessageSender;
65
- //# sourceMappingURL=sms-sender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sms-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendSms/sms-sender.ts"],"names":[],"mappings":";;;AACA,uCAA6C;AAG7C,wDAAwD;AAExD,4DAAkE;AAElE,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAa,gBAAiB,SAAQ,8BAAsB;IAC1D,YACW,OAAkB,EAClB,OAAgB,EAChB,QAAkB,EAClB,WAAoC,EACpC,IAAsC;QAE/C,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,CAAA;QAN3C,YAAO,GAAP,OAAO,CAAW;QAClB,YAAO,GAAP,OAAO,CAAS;QAChB,aAAQ,GAAR,QAAQ,CAAU;QAClB,gBAAW,GAAX,WAAW,CAAyB;QACpC,SAAI,GAAJ,IAAI,CAAkC;QAKjD,YAAO,GAAG,KAAK,EAAE,KAAa,EAAE,EAAE;YAGhC,IAAI,MAAM,CAAA;YACV,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE;gBAChC,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;aAC1D;iBAAM;gBACL,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAA;aACvC;YAED,MAAM,OAAO,GAAG;gBACd,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;gBAC5B,KAAK;gBACL,MAAM;aACP,CAAA;YAED,IAAI,UAAU,CAAA;YAEd,IAAI;gBACF,UAAU,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;aACzE;YAAC,OAAO,KAAc,EAAE;gBACvB,MAAM,IAAI,+BAAgB,CAAC,mCAAmC,EAAE,8BAA8B,EA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,IAAI,+BAAgB,CAAC,8CAA8C,EAAE,yBAAyB,EAAE,GAAG,CAAC,CAAA;aAC3G;QACH,CAAC,CAAA;IA3DD,CAAC;CA4DF;AArED,4CAqEC"}
@@ -1,23 +0,0 @@
1
- export interface Payload {
2
- contentSid: string;
3
- contentVariables?: {
4
- [k: string]: unknown;
5
- };
6
- toNumber?: string;
7
- from: string;
8
- customArgs?: {
9
- [k: string]: unknown;
10
- };
11
- connectionOverrides?: string;
12
- send?: boolean;
13
- traitEnrichment?: boolean;
14
- externalIds?: {
15
- id?: string;
16
- type?: string;
17
- subscriptionStatus?: string;
18
- }[];
19
- traits?: {
20
- [k: string]: unknown;
21
- };
22
- eventOccurredTS?: string;
23
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.ts"],"names":[],"mappings":""}
@@ -1,122 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const whatsapp_sender_1 = require("./whatsapp-sender");
4
- const action = {
5
- title: 'Send WhatsApp',
6
- description: 'Send WhatsApp using Twilio',
7
- defaultSubscription: 'type = "track" and event = "Audience Entered"',
8
- fields: {
9
- contentSid: {
10
- label: 'WhatsApp template Content Sid',
11
- description: 'The template you sending through WhatsApp',
12
- type: 'string',
13
- required: true
14
- },
15
- contentVariables: {
16
- label: 'WhatsApp template variables',
17
- description: 'Content personalization variables/merge tags for your WhatsApp message',
18
- type: 'object',
19
- required: false
20
- },
21
- toNumber: {
22
- label: 'Test Number',
23
- description: 'Number to send WhatsApp to when testing',
24
- type: 'string'
25
- },
26
- from: {
27
- label: 'From',
28
- description: 'The Twilio Phone Number, Short Code, or Messaging Service to send WhatsApp from.',
29
- type: 'string',
30
- required: true
31
- },
32
- customArgs: {
33
- label: 'Custom Arguments',
34
- description: 'Additional custom arguments that will be opaquely sent back on webhook events',
35
- type: 'object',
36
- required: false
37
- },
38
- connectionOverrides: {
39
- label: 'Connection Overrides',
40
- description: 'Connection overrides are configuration supported by twilio webhook services. Must be passed as fragments on the callback url',
41
- type: 'string',
42
- required: false
43
- },
44
- send: {
45
- label: 'Send Message',
46
- description: 'Whether or not the message should actually get sent.',
47
- type: 'boolean',
48
- required: false,
49
- default: false
50
- },
51
- traitEnrichment: {
52
- label: 'Trait Enrich',
53
- description: 'Whether or not trait enrich from event (i.e without profile api call)',
54
- type: 'boolean',
55
- required: false,
56
- default: true
57
- },
58
- externalIds: {
59
- label: 'External IDs',
60
- description: 'An array of user profile identity information.',
61
- type: 'object',
62
- multiple: true,
63
- properties: {
64
- id: {
65
- label: 'ID',
66
- description: 'A unique identifier for the collection.',
67
- type: 'string'
68
- },
69
- type: {
70
- label: 'type',
71
- description: 'The external ID contact type.',
72
- type: 'string'
73
- },
74
- subscriptionStatus: {
75
- label: 'ID',
76
- description: 'The subscription status for the identity.',
77
- type: 'string'
78
- }
79
- },
80
- default: {
81
- '@arrayPath': [
82
- '$.external_ids',
83
- {
84
- id: {
85
- '@path': '$.id'
86
- },
87
- type: {
88
- '@path': '$.type'
89
- },
90
- subscriptionStatus: {
91
- '@path': '$.isSubscribed'
92
- }
93
- }
94
- ]
95
- }
96
- },
97
- traits: {
98
- label: 'Traits',
99
- description: "A user profile's traits",
100
- type: 'object',
101
- required: false,
102
- default: { '@path': '$.properties' }
103
- },
104
- eventOccurredTS: {
105
- label: 'Event Timestamp',
106
- description: 'Time of when the actual event happened.',
107
- type: 'string',
108
- required: false,
109
- default: {
110
- '@path': '$.timestamp'
111
- }
112
- }
113
- },
114
- perform: async (request, { settings, payload, statsContext }) => {
115
- const statsClient = statsContext?.statsClient;
116
- const tags = statsContext?.tags;
117
- tags?.push(`space_id:${settings.spaceId}`, `projectid:${settings.sourceId}`);
118
- return new whatsapp_sender_1.WhatsAppMessageSender(request, payload, settings, statsClient, tags).send();
119
- }
120
- };
121
- exports.default = action;
122
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendWhatsApp/index.ts"],"names":[],"mappings":";;AAIA,uDAAyD;AAEzD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,4BAA4B;IACzC,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,+BAA+B;YACtC,WAAW,EAAE,2CAA2C;YACxD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,6BAA6B;YACpC,WAAW,EAAE,wEAAwE;YACrF,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,yCAAyC;YACtD,IAAI,EAAE,QAAQ;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,kFAAkF;YAC/F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,+EAA+E;YAC5F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,mBAAmB,EAAE;YACnB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,8HAA8H;YAChI,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,sDAAsD;YACnE,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,KAAK;SACf;QACD,eAAe,EAAE;YACf,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,uEAAuE;YACpF,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,IAAI;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B,IAAI,EAAE,IAAI,CAAC,YAAY,QAAQ,CAAC,OAAO,EAAE,EAAE,aAAa,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;QAE5E,OAAO,IAAI,uCAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;IACxF,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,14 +0,0 @@
1
- import type { Settings } from '../generated-types';
2
- import type { Payload } from './generated-types';
3
- import { RequestFn, MessageSender } from '../utils/message-sender';
4
- import { StatsClient, StatsContext } from '@segment/actions-core/src/destination-kit';
5
- export declare class WhatsAppMessageSender extends MessageSender<Payload> {
6
- readonly request: RequestFn;
7
- readonly payload: Payload;
8
- readonly settings: Settings;
9
- readonly statsClient: StatsClient | undefined;
10
- readonly tags: StatsContext['tags'] | undefined;
11
- constructor(request: RequestFn, payload: Payload, settings: Settings, statsClient: StatsClient | undefined, tags: StatsContext['tags'] | undefined);
12
- getBody: (phone: string) => Promise<URLSearchParams>;
13
- private getVariables;
14
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WhatsAppMessageSender = void 0;
4
- const liquidjs_1 = require("liquidjs");
5
- const actions_core_1 = require("@segment/actions-core");
6
- const message_sender_1 = require("../utils/message-sender");
7
- const google_libphonenumber_1 = require("google-libphonenumber");
8
- const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
9
- const Liquid = new liquidjs_1.Liquid();
10
- class WhatsAppMessageSender extends message_sender_1.MessageSender {
11
- constructor(request, payload, settings, statsClient, tags) {
12
- super(request, payload, settings, statsClient, tags);
13
- this.request = request;
14
- this.payload = payload;
15
- this.settings = settings;
16
- this.statsClient = statsClient;
17
- this.tags = tags;
18
- this.getBody = async (phone) => {
19
- let parsedPhone;
20
- try {
21
- parsedPhone = phoneUtil.parse(phone, 'US');
22
- parsedPhone = phoneUtil.format(parsedPhone, google_libphonenumber_1.PhoneNumberFormat.E164);
23
- parsedPhone = `whatsapp:${parsedPhone}`;
24
- }
25
- catch (error) {
26
- this.tags?.push('type:invalid_phone_e164');
27
- this.statsClient?.incr('actions-personas-messaging-twilio.error', 1, this.tags);
28
- throw new actions_core_1.IntegrationError('The string supplied did not seem to be a phone number. Phone number must be able to be formatted to e164 for whatsapp.', `INVALID_PHONE`, 400);
29
- }
30
- if (!this.payload.contentSid) {
31
- throw new actions_core_1.IntegrationError('A valid whatsApp Content SID was not provided.', `INVALID_CONTENT_SID`, 400);
32
- }
33
- const params = {
34
- ContentSid: this.payload.contentSid,
35
- From: this.payload.from,
36
- To: parsedPhone
37
- };
38
- const contentVariables = await this.getVariables();
39
- if (contentVariables)
40
- params['ContentVariables'] = contentVariables;
41
- return new URLSearchParams(params);
42
- };
43
- this.getVariables = async () => {
44
- if (!this.payload.contentVariables || !this.payload.traits)
45
- return null;
46
- try {
47
- const profile = {
48
- profile: {
49
- traits: this.payload.traits
50
- }
51
- };
52
- const mapping = {};
53
- for (const [key, val] of Object.entries(this.payload.contentVariables)) {
54
- mapping[key] = await Liquid.parseAndRender(val, profile);
55
- }
56
- return JSON.stringify(mapping);
57
- }
58
- catch (error) {
59
- throw new actions_core_1.IntegrationError(`Unable to parse templating in content variables`, `Content variables templating parse failure`, 400);
60
- }
61
- };
62
- }
63
- }
64
- exports.WhatsAppMessageSender = WhatsAppMessageSender;
65
- //# sourceMappingURL=whatsapp-sender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"whatsapp-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.ts"],"names":[],"mappings":";;;AACA,uCAA6C;AAG7C,wDAAwD;AACxD,4DAAkE;AAClE,iEAA0E;AAG1E,MAAM,SAAS,GAAG,uCAAe,CAAC,WAAW,EAAE,CAAA;AAC/C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;A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M,gBAAgB,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA;YAElD,IAAI,gBAAgB;gBAAE,MAAM,CAAC,kBAAkB,CAAC,GAAG,gBAAgB,CAAA;YAEnE,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAA;QACpC,CAAC,CAAA;QAEO,iBAAY,GAAG,KAAK,IAA4B,EAAE;YACxD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAA;YAEvE,IAAI;gBACF,MAAM,OAAO,GAAG;oBACd,OAAO,EAAE;wBACP,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;qBAC5B;iBACF,CAAA;gBAED,MAAM,OAAO,GAA2B,EAAE,CAAA;gBAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE;oBACtE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,GAAa,EAAE,OAAO,CAAC,CAAA;iBACnE;gBAED,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;aAC/B;YAAC,OAAO,KAAc,EAAE;gBACvB,MAAM,IAAI,+BAAgB,CACxB,iDAAiD,EACjD,4CAA4C,EAC5C,GAAG,CACJ,CAAA;aACF;QACH,CAAC,CAAA;IA7DD,CAAC;CA8DF;AAvED,sDAuEC"}
@@ -1,22 +0,0 @@
1
- import type { RequestOptions } from '@segment/actions-core';
2
- import type { Settings } from '../generated-types';
3
- import type { Payload } from '../sendSms/generated-types';
4
- import { StatsClient, StatsContext } from '@segment/actions-core/src/destination-kit';
5
- export declare type RequestFn = (url: string, options?: RequestOptions) => Promise<Response>;
6
- declare type MinimalPayload = Pick<Payload, 'from' | 'toNumber' | 'customArgs' | 'externalIds' | 'traits' | 'send' | 'eventOccurredTS'>;
7
- export declare abstract class MessageSender<SmsPayload extends MinimalPayload> {
8
- readonly request: RequestFn;
9
- readonly payload: SmsPayload;
10
- readonly settings: Settings;
11
- readonly statsClient: StatsClient | undefined;
12
- readonly tags: StatsContext['tags'] | undefined;
13
- private readonly EXTERNAL_ID_KEY;
14
- private readonly DEFAULT_HOSTNAME;
15
- private readonly DEFAULT_CONNECTION_OVERRIDES;
16
- constructor(request: RequestFn, payload: SmsPayload, settings: Settings, statsClient: StatsClient | undefined, tags: StatsContext['tags'] | undefined);
17
- abstract getBody: (phone: string) => Promise<URLSearchParams>;
18
- send: () => Promise<Response | undefined>;
19
- private getSendabilityPayload;
20
- private getWebhookUrlWithParams;
21
- }
22
- export {};