@segment/action-destinations 3.127.3-staging.155 → 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 (120) 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/clevertap/userDelete/index.js +4 -4
  20. package/dist/destinations/clevertap/userDelete/index.js.map +1 -1
  21. package/dist/destinations/engage-messaging-twilio/index.js +1 -3
  22. package/dist/destinations/engage-messaging-twilio/index.js.map +1 -1
  23. package/dist/destinations/engage-messaging-twilio/sendSms/index.js +104 -2
  24. package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +1 -1
  25. package/dist/destinations/index.js +1 -1
  26. package/dist/destinations/index.js.map +1 -1
  27. package/dist/destinations/mixpanel/index.js +1 -1
  28. package/dist/destinations/mixpanel/mixpanel-properties.js.map +1 -1
  29. package/dist/destinations/mixpanel/trackEvent/functions.js +1 -1
  30. package/dist/destinations/mixpanel/trackEvent/functions.js.map +1 -1
  31. package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
  32. package/dist/destinations/mixpanel/trackPurchase/index.js.map +1 -1
  33. package/dist/destinations/mixpanel/utils.js +1 -1
  34. package/dist/destinations/mixpanel/utils.js.map +1 -1
  35. package/dist/destinations/pipedrive/createUpdateActivity/index.js +44 -17
  36. package/dist/destinations/pipedrive/createUpdateActivity/index.js.map +1 -1
  37. package/dist/destinations/pipedrive/createUpdateDeal/index.js +35 -11
  38. package/dist/destinations/pipedrive/createUpdateDeal/index.js.map +1 -1
  39. package/dist/destinations/pipedrive/createUpdateLead/generated-types.d.ts +3 -8
  40. package/dist/destinations/pipedrive/createUpdateLead/index.js +54 -27
  41. package/dist/destinations/pipedrive/createUpdateLead/index.js.map +1 -1
  42. package/dist/destinations/pipedrive/createUpdateNote/generated-types.d.ts +1 -1
  43. package/dist/destinations/pipedrive/createUpdateNote/index.js +22 -13
  44. package/dist/destinations/pipedrive/createUpdateNote/index.js.map +1 -1
  45. package/dist/destinations/pipedrive/createUpdateOrganization/index.js +8 -2
  46. package/dist/destinations/pipedrive/createUpdateOrganization/index.js.map +1 -1
  47. package/dist/destinations/pipedrive/createUpdatePerson/index.js +15 -3
  48. package/dist/destinations/pipedrive/createUpdatePerson/index.js.map +1 -1
  49. package/dist/destinations/pipedrive/index.d.ts +1 -1
  50. package/dist/destinations/pipedrive/index.js +22 -1
  51. package/dist/destinations/pipedrive/index.js.map +1 -1
  52. package/dist/destinations/pipedrive/pipedriveApi/leads.d.ts +5 -1
  53. package/dist/destinations/pipedrive/pipedriveApi/leads.js.map +1 -1
  54. package/dist/destinations/pipedrive/pipedriveApi/notes.d.ts +1 -1
  55. package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.d.ts +2 -1
  56. package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.js +7 -1
  57. package/dist/destinations/pipedrive/pipedriveApi/pipedrive-client.js.map +1 -1
  58. package/dist/destinations/salesforce/sf-properties.d.ts +0 -1
  59. package/dist/destinations/salesforce/sf-properties.js.map +1 -1
  60. package/dist/destinations/segment/segment-properties.js +2 -1
  61. package/dist/destinations/segment/segment-properties.js.map +1 -1
  62. package/dist/destinations/segment/sendTrack/generated-types.d.ts +1 -1
  63. package/package.json +2 -4
  64. package/dist/destinations/actions-bingads/functions.d.ts +0 -0
  65. package/dist/destinations/actions-bingads/functions.js +0 -2
  66. package/dist/destinations/actions-bingads/functions.js.map +0 -1
  67. package/dist/destinations/actions-bingads/generated-types.d.ts +0 -10
  68. package/dist/destinations/actions-bingads/generated-types.js +0 -3
  69. package/dist/destinations/actions-bingads/generated-types.js.map +0 -1
  70. package/dist/destinations/actions-bingads/index.d.ts +0 -4
  71. package/dist/destinations/actions-bingads/index.js +0 -77
  72. package/dist/destinations/actions-bingads/index.js.map +0 -1
  73. package/dist/destinations/actions-bingads/offlineConversions/formatter.d.ts +0 -8
  74. package/dist/destinations/actions-bingads/offlineConversions/formatter.js +0 -33
  75. package/dist/destinations/actions-bingads/offlineConversions/formatter.js.map +0 -1
  76. package/dist/destinations/actions-bingads/offlineConversions/generated-types.d.ts +0 -7
  77. package/dist/destinations/actions-bingads/offlineConversions/generated-types.js +0 -3
  78. package/dist/destinations/actions-bingads/offlineConversions/generated-types.js.map +0 -1
  79. package/dist/destinations/actions-bingads/offlineConversions/index.d.ts +0 -5
  80. package/dist/destinations/actions-bingads/offlineConversions/index.js +0 -131
  81. package/dist/destinations/actions-bingads/offlineConversions/index.js.map +0 -1
  82. package/dist/destinations/braze-cohorts/cohortChanges.d.ts +0 -10
  83. package/dist/destinations/braze-cohorts/cohortChanges.js +0 -3
  84. package/dist/destinations/braze-cohorts/cohortChanges.js.map +0 -1
  85. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.d.ts +0 -14
  86. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js +0 -65
  87. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js.map +0 -1
  88. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.d.ts +0 -23
  89. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.js +0 -3
  90. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.js.map +0 -1
  91. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.d.ts +0 -5
  92. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js +0 -122
  93. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js.map +0 -1
  94. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.d.ts +0 -14
  95. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js +0 -65
  96. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js.map +0 -1
  97. package/dist/destinations/engage-messaging-twilio/utils/message-sender.d.ts +0 -22
  98. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js +0 -97
  99. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js.map +0 -1
  100. package/dist/destinations/google-sheets-partner/constants.d.ts +0 -3
  101. package/dist/destinations/google-sheets-partner/constants.js +0 -7
  102. package/dist/destinations/google-sheets-partner/constants.js.map +0 -1
  103. package/dist/destinations/google-sheets-partner/generated-types.d.ts +0 -2
  104. package/dist/destinations/google-sheets-partner/generated-types.js +0 -3
  105. package/dist/destinations/google-sheets-partner/generated-types.js.map +0 -1
  106. package/dist/destinations/google-sheets-partner/googleapis/index.d.ts +0 -17
  107. package/dist/destinations/google-sheets-partner/googleapis/index.js +0 -34
  108. package/dist/destinations/google-sheets-partner/googleapis/index.js.map +0 -1
  109. package/dist/destinations/google-sheets-partner/index.d.ts +0 -4
  110. package/dist/destinations/google-sheets-partner/index.js +0 -43
  111. package/dist/destinations/google-sheets-partner/index.js.map +0 -1
  112. package/dist/destinations/google-sheets-partner/postSheet/generated-types.d.ts +0 -11
  113. package/dist/destinations/google-sheets-partner/postSheet/generated-types.js +0 -3
  114. package/dist/destinations/google-sheets-partner/postSheet/generated-types.js.map +0 -1
  115. package/dist/destinations/google-sheets-partner/postSheet/index.d.ts +0 -5
  116. package/dist/destinations/google-sheets-partner/postSheet/index.js +0 -79
  117. package/dist/destinations/google-sheets-partner/postSheet/index.js.map +0 -1
  118. package/dist/destinations/google-sheets-partner/postSheet/operations.d.ts +0 -10
  119. package/dist/destinations/google-sheets-partner/postSheet/operations.js +0 -96
  120. package/dist/destinations/google-sheets-partner/postSheet/operations.js.map +0 -1
@@ -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,+CA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C,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;AAE7B,MAAa,qBAAsB,SAAQ,8BAAsB;IAC/D,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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,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 {};
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MessageSender = void 0;
4
- const actions_core_1 = require("@segment/actions-core");
5
- var SendabilityStatus;
6
- (function (SendabilityStatus) {
7
- SendabilityStatus["NoSenderPhone"] = "no_sender_phone";
8
- SendabilityStatus["ShouldSend"] = "should_send";
9
- SendabilityStatus["DoNotSend"] = "do_not_send";
10
- SendabilityStatus["SendDisabled"] = "send_disabled";
11
- SendabilityStatus["InvalidSubscriptionStatus"] = "invalid_subscription_status";
12
- })(SendabilityStatus || (SendabilityStatus = {}));
13
- class MessageSender {
14
- constructor(request, payload, settings, statsClient, tags) {
15
- this.request = request;
16
- this.payload = payload;
17
- this.settings = settings;
18
- this.statsClient = statsClient;
19
- this.tags = tags;
20
- this.EXTERNAL_ID_KEY = 'phone';
21
- this.DEFAULT_HOSTNAME = 'api.twilio.com';
22
- this.DEFAULT_CONNECTION_OVERRIDES = 'rp=all&rc=5';
23
- this.send = async () => {
24
- const { phone, sendabilityStatus } = this.getSendabilityPayload();
25
- if (sendabilityStatus !== SendabilityStatus.ShouldSend || !phone) {
26
- return;
27
- }
28
- const body = await this.getBody(phone);
29
- const webhookUrlWithParams = this.getWebhookUrlWithParams(phone);
30
- if (webhookUrlWithParams)
31
- body.append('StatusCallback', webhookUrlWithParams);
32
- const twilioHostname = this.settings.twilioHostname ?? this.DEFAULT_HOSTNAME;
33
- const twilioToken = Buffer.from(`${this.settings.twilioApiKeySID}:${this.settings.twilioApiKeySecret}`).toString('base64');
34
- const response = await this.request(`https://${twilioHostname}/2010-04-01/Accounts/${this.settings.twilioAccountSID}/Messages.json`, {
35
- method: 'POST',
36
- headers: {
37
- authorization: `Basic ${twilioToken}`
38
- },
39
- body
40
- });
41
- this.tags?.push(`twilio_status_code:${response.status}`);
42
- this.statsClient?.incr('actions-personas-messaging-twilio.response', 1, this.tags);
43
- if (this.payload.eventOccurredTS != undefined) {
44
- this.statsClient?.histogram('actions-personas-messaging-twilio.eventDeliveryTS', Date.now() - new Date(this.payload.eventOccurredTS).getTime(), this.tags);
45
- }
46
- return response;
47
- };
48
- this.getSendabilityPayload = () => {
49
- const nonSendableStatuses = ['unsubscribed', 'did not subscribed', 'false'];
50
- const sendableStatuses = ['subscribed', 'true'];
51
- const externalId = this.payload.externalIds?.find(({ type }) => type === 'phone');
52
- let status;
53
- if (!this.payload.send) {
54
- this.statsClient?.incr('actions-personas-messaging-twilio.send-disabled', 1, this.tags);
55
- return { sendabilityStatus: SendabilityStatus.SendDisabled, phone: undefined };
56
- }
57
- if (!externalId?.subscriptionStatus || nonSendableStatuses.includes(externalId.subscriptionStatus)) {
58
- this.statsClient?.incr('actions-personas-messaging-twilio.notsubscribed', 1, this.tags);
59
- status = SendabilityStatus.DoNotSend;
60
- }
61
- else if (sendableStatuses.includes(externalId.subscriptionStatus)) {
62
- this.statsClient?.incr('actions-personas-messaging-twilio.subscribed', 1, this.tags);
63
- status = SendabilityStatus.ShouldSend;
64
- }
65
- else {
66
- this.statsClient?.incr('actions-personas-messaging-twilio.twilio-error', 1, this.tags);
67
- throw new actions_core_1.IntegrationError(`Failed to recognize the subscriptionStatus in the payload: "${externalId.subscriptionStatus}".`, 'Invalid subscriptionStatus value', 400);
68
- }
69
- const phone = this.payload.toNumber || externalId?.id;
70
- if (!phone) {
71
- status = SendabilityStatus.NoSenderPhone;
72
- }
73
- return { sendabilityStatus: status, phone };
74
- };
75
- this.getWebhookUrlWithParams = (phone) => {
76
- const webhookUrl = this.settings.webhookUrl;
77
- const connectionOverrides = this.settings.connectionOverrides;
78
- const customArgs = {
79
- ...this.payload.customArgs,
80
- space_id: this.settings.spaceId,
81
- __segment_internal_external_id_key__: this.EXTERNAL_ID_KEY,
82
- __segment_internal_external_id_value__: phone
83
- };
84
- if (webhookUrl && customArgs) {
85
- const webhookUrlWithParams = new URL(webhookUrl);
86
- for (const key of Object.keys(customArgs)) {
87
- webhookUrlWithParams.searchParams.append(key, String(customArgs[key]));
88
- }
89
- webhookUrlWithParams.hash = connectionOverrides || this.DEFAULT_CONNECTION_OVERRIDES;
90
- return webhookUrlWithParams.toString();
91
- }
92
- return null;
93
- };
94
- }
95
- }
96
- exports.MessageSender = MessageSender;
97
- //# sourceMappingURL=message-sender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"message-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/utils/message-sender.ts"],"names":[],"mappings":";;;AAIA,wDAAwD;AAGxD,IAAK,iBAMJ;AAND,WAAK,iBAAiB;IACpB,sDAAiC,CAAA;IACjC,+CAA0B,CAAA;IAC1B,8CAAyB,CAAA;IACzB,mDAA8B,CAAA;IAC9B,8EAAyD,CAAA;AAC3D,CAAC,EANI,iBAAiB,KAAjB,iBAAiB,QAMrB;AAWD,MAAsB,aAAa;IAKjC,YACW,OAAkB,EAClB,OAAmB,EACnB,QAAkB,EAClB,WAAoC,EACpC,IAAsC;QAJtC,YAAO,GAAP,OAAO,CAAW;QAClB,YAAO,GAAP,OAAO,CAAY;QACnB,aAAQ,GAAR,QAAQ,CAAU;QAClB,gBAAW,GAAX,WAAW,CAAyB;QACpC,SAAI,GAAJ,IAAI,CAAkC;QAThC,oBAAe,GAAG,OAAO,CAAA;QACzB,qBAAgB,GAAG,gBAAgB,CAAA;QACnC,iCAA4B,GAAG,aAAa,CAAA;QAY7D,SAAI,GAAG,KAAK,IAAI,EAAE;YAChB,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAA;YAEjE,IAAI,iBAAiB,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ApHD,sCAoHC"}
@@ -1,3 +0,0 @@
1
- export declare const CONSTANTS: {
2
- MAX_CELLS: number;
3
- };
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CONSTANTS = void 0;
4
- exports.CONSTANTS = {
5
- MAX_CELLS: 300000
6
- };
7
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/destinations/google-sheets-partner/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IAIvB,SAAS,EAAE,MAAM;CAClB,CAAA"}
@@ -1,2 +0,0 @@
1
- export interface Settings {
2
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generated-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/google-sheets-partner/generated-types.ts"],"names":[],"mappings":""}
@@ -1,17 +0,0 @@
1
- import { ModifiedResponse, RequestClient } from '@segment/actions-core';
2
- import type { MappingSettings } from '../postSheet/operations';
3
- export declare type GetResponse = {
4
- range: string;
5
- majorDimension: string;
6
- values: string[][];
7
- };
8
- export declare class GoogleSheets {
9
- request: RequestClient;
10
- constructor(request: RequestClient);
11
- get: (mappingSettings: MappingSettings, range: string) => Promise<ModifiedResponse<GetResponse>>;
12
- batchUpdate: (mappingSettings: MappingSettings, batchPayload: {
13
- range: string;
14
- values: string[][];
15
- }[]) => Promise<ModifiedResponse<unknown>>;
16
- append: (mappingSettings: MappingSettings, range: string, values: string[][]) => Promise<ModifiedResponse<unknown>>;
17
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleSheets = void 0;
4
- const API_VERSION = 'v4';
5
- class GoogleSheets {
6
- constructor(request) {
7
- this.get = async (mappingSettings, range) => {
8
- return this.request(`https://sheets.googleapis.com/${API_VERSION}/spreadsheets/${mappingSettings.spreadsheetId}/values/${mappingSettings.spreadsheetName}!${range}`, {
9
- method: 'get',
10
- skipResponseCloning: true
11
- });
12
- };
13
- this.batchUpdate = async (mappingSettings, batchPayload) => {
14
- return this.request(`https://sheets.googleapis.com/${API_VERSION}/spreadsheets/${mappingSettings.spreadsheetId}/values:batchUpdate`, {
15
- method: 'post',
16
- json: {
17
- valueInputOption: mappingSettings.dataFormat,
18
- data: batchPayload
19
- }
20
- });
21
- };
22
- this.append = async (mappingSettings, range, values) => {
23
- return this.request(`https://sheets.googleapis.com/${API_VERSION}/spreadsheets/${mappingSettings.spreadsheetId}/values/${mappingSettings.spreadsheetName}!${range}:append?valueInputOption=${mappingSettings.dataFormat}&insertDataOption=INSERT_ROWS`, {
24
- method: 'post',
25
- json: {
26
- values: values
27
- }
28
- });
29
- };
30
- this.request = request;
31
- }
32
- }
33
- exports.GoogleSheets = GoogleSheets;
34
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-sheets-partner/googleapis/index.ts"],"names":[],"mappings":";;;AAGA,MAAM,WAAW,GAAG,IAAI,CAAA;AAOxB,MAAa,YAAY;IAGvB,YAAY,OAAsB;QAIlC,QAAG,GAAG,KAAK,EAAE,eAAgC,EAAE,KAAa,EAA0C,EAAE;YACtG,OAAO,IAAI,CAAC,OAAO,CACjB,iCAAiC,WAAW,iBAAiB,eAAe,CAAC,aAAa,WAAW,eAAe,CAAC,eAAe,IAAI,KAAK,EAAE,EAC/I;gBACE,MAAM,EAAE,KAAK;gBACb,mBAAmB,EAAE,IAAI;aAC1B,CACF,CAAA;QACH,CAAC,CAAA;QAED,gBAAW,GAAG,KAAK,EAAE,eAAgC,EAAE,YAAqD,EAAE,EAAE;YAC9G,OAAO,IAAI,CAAC,OAAO,CACjB,iCAAiC,WAAW,iBAAiB,eAAe,CAAC,aAAa,qBAAqB,EAC/G;gBACE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,gBAAgB,EAAE,eAAe,CAAC,UAAU;oBAC5C,IAAI,EAAE,YAAY;iBACnB;aACF,CACF,CAAA;QACH,CAAC,CAAA;QAeD,WAAM,GAAG,KAAK,EAAE,eAAgC,EAAE,KAAa,EAAE,MAAkB,EAAE,EAAE;YACrF,OAAO,IAAI,CAAC,OAAO,CACjB,iCAAiC,WAAW,iBAAiB,eAAe,CAAC,aAAa,WAAW,eAAe,CAAC,eAAe,IAAI,KAAK,4BAA4B,eAAe,CAAC,UAAU,+BAA+B,EAClO;gBACE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,MAAM,EAAE,MAAM;iBACf;aACF,CACF,CAAA;QACH,CAAC,CAAA;QAjDC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CAiDF;AAtDD,oCAsDC"}
@@ -1,4 +0,0 @@
1
- import type { DestinationDefinition } from '@segment/actions-core';
2
- import type { Settings } from './generated-types';
3
- declare const destination: DestinationDefinition<Settings>;
4
- export default destination;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const postSheet_1 = __importDefault(require("./postSheet"));
7
- const destination = {
8
- name: 'Google Sheets (Partner Test)',
9
- slug: 'actions-google-sheets-partner',
10
- mode: 'cloud',
11
- authentication: {
12
- scheme: 'oauth-managed',
13
- fields: {},
14
- refreshAccessToken: async (request, { auth }) => {
15
- if (!auth.refreshTokenUrl) {
16
- console.log('Could not find refresh token Url');
17
- auth.refreshTokenUrl = 'https://www.googleapis.com/oauth2/v4/token';
18
- }
19
- const res = await request(auth.refreshTokenUrl, {
20
- method: 'POST',
21
- body: new URLSearchParams({
22
- refresh_token: auth.refreshToken,
23
- client_id: auth.clientId,
24
- client_secret: auth.clientSecret,
25
- grant_type: 'refresh_token'
26
- })
27
- });
28
- return { accessToken: res.data.access_token };
29
- }
30
- },
31
- extendRequest({ auth }) {
32
- return {
33
- headers: {
34
- authorization: `Bearer ${auth?.accessToken}`
35
- }
36
- };
37
- },
38
- actions: {
39
- postSheet: postSheet_1.default
40
- }
41
- };
42
- exports.default = destination;
43
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/google-sheets-partner/index.ts"],"names":[],"mappings":";;;;;AAGA,4DAAmC;AAQnC,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,EAAE;QAMV,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAC9C,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;gBACzB,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAA;gBAC/C,IAAI,CAAC,eAAe,GAAG,4CAA4C,CAAA;aACpE;YACD,MAAM,GAAG,GAAG,MAAM,OAAO,CAAuB,IAAI,CAAC,eAAe,EAAE;gBACpE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,eAAe,CAAC;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,SAAS,EAAE,IAAI,CAAC,QAAQ;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,UAAU,EAAE,eAAe;iBAC5B,CAAC;aACH,CAAC,CAAA;YAEF,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAA;QAC/C,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IAQD,OAAO,EAAE;QACP,SAAS,EAAT,mBAAS;KACV;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -1,11 +0,0 @@
1
- export interface Payload {
2
- record_identifier: string;
3
- operation_type: string;
4
- spreadsheet_id: string;
5
- spreadsheet_name: string;
6
- data_format: string;
7
- fields: {
8
- [k: string]: unknown;
9
- };
10
- enable_batching?: boolean;
11
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generated-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/google-sheets-partner/postSheet/generated-types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import { ActionDefinition } from '@segment/actions-core';
2
- import type { Settings } from '../generated-types';
3
- import type { Payload } from './generated-types';
4
- declare const action: ActionDefinition<Settings, Payload>;
5
- export default action;
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const operations_1 = require("./operations");
4
- const action = {
5
- title: 'Post Sheet',
6
- description: 'Write values to a Google Sheets spreadsheet.',
7
- defaultSubscription: 'event = "updated" or event = "new"',
8
- fields: {
9
- record_identifier: {
10
- label: 'Record Identifier',
11
- description: 'Property which uniquely identifies each row in the spreadsheet.',
12
- type: 'string',
13
- required: true,
14
- default: { '@path': '$.__segment_id' }
15
- },
16
- operation_type: {
17
- label: 'Operation Type',
18
- description: "Describes the nature of the operation being performed. Only supported values are 'new' and 'updated'.",
19
- type: 'hidden',
20
- required: true,
21
- default: { '@path': '$.event' }
22
- },
23
- spreadsheet_id: {
24
- label: 'Spreadsheet ID',
25
- description: 'The identifier of the spreadsheet. You can find this value in the URL of the spreadsheet. e.g. https://docs.google.com/spreadsheets/d/{SPREADSHEET_ID}/edit',
26
- type: 'string',
27
- required: true,
28
- default: ''
29
- },
30
- spreadsheet_name: {
31
- label: 'Spreadsheet Name',
32
- description: 'The name of the spreadsheet. You can find this value on the tab at the bottom of the spreadsheet. Please provide a valid name of a sheet that already exists.',
33
- type: 'string',
34
- required: true,
35
- default: 'Sheet1'
36
- },
37
- data_format: {
38
- label: 'Data Format',
39
- description: 'The way Google will interpret values. If you select raw, values will not be parsed and will be stored as-is. If you select user entered, values will be parsed as if you typed them into the UI. Numbers will stay as numbers, but strings may be converted to numbers, dates, etc. following the same rules that are applied when entering text into a cell via the Google Sheets UI.',
40
- type: 'string',
41
- required: true,
42
- default: 'RAW',
43
- choices: [
44
- { label: 'Raw', value: 'RAW' },
45
- { label: 'User Entered', value: 'USER_ENTERED' }
46
- ]
47
- },
48
- fields: {
49
- label: 'Fields',
50
- description: `
51
- The fields to write to the spreadsheet.
52
-
53
- On the left-hand side, input the name of the field as it will appear in the Google Sheet.
54
-
55
- On the right-hand side, select the field from your data model that maps to the given field in your sheet.
56
-
57
- ---
58
-
59
- `,
60
- type: 'object',
61
- required: true,
62
- defaultObjectUI: 'keyvalue:only'
63
- },
64
- enable_batching: {
65
- type: 'boolean',
66
- label: 'Batch Data to Google Sheets',
67
- description: 'Set as true to ensure Segment sends data to Google Sheets in batches. Please do not set to false.',
68
- default: true
69
- }
70
- },
71
- perform: (request, { payload }) => {
72
- return operations_1.processData(request, [payload]);
73
- },
74
- performBatch: (request, { payload }) => {
75
- return operations_1.processData(request, payload);
76
- }
77
- };
78
- exports.default = action;
79
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-sheets-partner/postSheet/index.ts"],"names":[],"mappings":";;AAIA,6CAA0C;AAE1C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,8CAA8C;IAC3D,mBAAmB,EAAE,oCAAoC;IAEzD,MAAM,EAAE;QACN,iBAAiB,EAAE;YACjB,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EAAE,iEAAiE;YA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AAE,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,CAAC;IACD,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACrC,OAAO,wBAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACtC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,10 +0,0 @@
1
- import type { Payload } from './generated-types';
2
- import { RequestClient } from '@segment/actions-core';
3
- export declare type MappingSettings = {
4
- spreadsheetId: string;
5
- spreadsheetName: string;
6
- dataFormat: string;
7
- columns: string[];
8
- };
9
- declare function processData(request: RequestClient, events: Payload[]): Promise<(import("@segment/actions-core").ModifiedResponse<unknown> | undefined)[]>;
10
- export { processData };