@segment/action-destinations 3.73.0 → 3.74.1-alpha.1

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 (63) hide show
  1. package/dist/destinations/gainsight-px-cloud-action/index.js +30 -36
  2. package/dist/destinations/gainsight-px-cloud-action/index.js.map +1 -1
  3. package/dist/destinations/gainsight-px-cloud-action/regional-endpoints.js +3 -3
  4. package/dist/destinations/gainsight-px-cloud-action/regional-endpoints.js.map +1 -1
  5. package/dist/destinations/gainsight-px-cloud-action/sendEvent/generated-types.d.ts +5 -0
  6. package/dist/destinations/gainsight-px-cloud-action/{groupIdentify → sendEvent}/generated-types.js +0 -0
  7. package/dist/destinations/gainsight-px-cloud-action/sendEvent/generated-types.js.map +1 -0
  8. package/dist/destinations/gainsight-px-cloud-action/{identifyUser → sendEvent}/index.d.ts +0 -0
  9. package/dist/destinations/gainsight-px-cloud-action/{groupIdentify → sendEvent}/index.js +5 -5
  10. package/dist/destinations/gainsight-px-cloud-action/sendEvent/index.js.map +1 -0
  11. package/dist/destinations/snap-conversions-api/index.js +1 -1
  12. package/dist/destinations/talon-one/t1-properties.js +10 -4
  13. package/dist/destinations/talon-one/t1-properties.js.map +1 -1
  14. package/dist/destinations/talon-one/trackEvent/index.js +10 -2
  15. package/dist/destinations/talon-one/trackEvent/index.js.map +1 -1
  16. package/dist/destinations/talon-one/updateCustomerProfile/index.js +1 -1
  17. package/dist/destinations/talon-one/updateCustomerProfile/index.js.map +1 -1
  18. package/package.json +2 -2
  19. package/dist/destinations/gainsight-px-cloud-action/groupIdentify/generated-types.d.ts +0 -2
  20. package/dist/destinations/gainsight-px-cloud-action/groupIdentify/generated-types.js.map +0 -1
  21. package/dist/destinations/gainsight-px-cloud-action/groupIdentify/index.d.ts +0 -5
  22. package/dist/destinations/gainsight-px-cloud-action/groupIdentify/index.js.map +0 -1
  23. package/dist/destinations/gainsight-px-cloud-action/identifyUser/generated-types.d.ts +0 -2
  24. package/dist/destinations/gainsight-px-cloud-action/identifyUser/generated-types.js +0 -3
  25. package/dist/destinations/gainsight-px-cloud-action/identifyUser/generated-types.js.map +0 -1
  26. package/dist/destinations/gainsight-px-cloud-action/identifyUser/index.js +0 -17
  27. package/dist/destinations/gainsight-px-cloud-action/identifyUser/index.js.map +0 -1
  28. package/dist/destinations/gainsight-px-cloud-action/trackEvent/generated-types.d.ts +0 -2
  29. package/dist/destinations/gainsight-px-cloud-action/trackEvent/generated-types.js +0 -3
  30. package/dist/destinations/gainsight-px-cloud-action/trackEvent/generated-types.js.map +0 -1
  31. package/dist/destinations/gainsight-px-cloud-action/trackEvent/index.d.ts +0 -5
  32. package/dist/destinations/gainsight-px-cloud-action/trackEvent/index.js +0 -17
  33. package/dist/destinations/gainsight-px-cloud-action/trackEvent/index.js.map +0 -1
  34. package/dist/destinations/gainsight-px-cloud-action/trackPageView/generated-types.d.ts +0 -2
  35. package/dist/destinations/gainsight-px-cloud-action/trackPageView/generated-types.js +0 -3
  36. package/dist/destinations/gainsight-px-cloud-action/trackPageView/generated-types.js.map +0 -1
  37. package/dist/destinations/gainsight-px-cloud-action/trackPageView/index.d.ts +0 -5
  38. package/dist/destinations/gainsight-px-cloud-action/trackPageView/index.js +0 -17
  39. package/dist/destinations/gainsight-px-cloud-action/trackPageView/index.js.map +0 -1
  40. package/dist/destinations/personas-messaging-sendgrid/generated-types.d.ts +0 -8
  41. package/dist/destinations/personas-messaging-sendgrid/generated-types.js +0 -3
  42. package/dist/destinations/personas-messaging-sendgrid/generated-types.js.map +0 -1
  43. package/dist/destinations/personas-messaging-sendgrid/index.d.ts +0 -4
  44. package/dist/destinations/personas-messaging-sendgrid/index.js +0 -59
  45. package/dist/destinations/personas-messaging-sendgrid/index.js.map +0 -1
  46. package/dist/destinations/personas-messaging-sendgrid/sendEmail/generated-types.d.ts +0 -26
  47. package/dist/destinations/personas-messaging-sendgrid/sendEmail/generated-types.js +0 -3
  48. package/dist/destinations/personas-messaging-sendgrid/sendEmail/generated-types.js.map +0 -1
  49. package/dist/destinations/personas-messaging-sendgrid/sendEmail/index.d.ts +0 -5
  50. package/dist/destinations/personas-messaging-sendgrid/sendEmail/index.js +0 -310
  51. package/dist/destinations/personas-messaging-sendgrid/sendEmail/index.js.map +0 -1
  52. package/dist/destinations/personas-messaging-twilio/generated-types.d.ts +0 -11
  53. package/dist/destinations/personas-messaging-twilio/generated-types.js +0 -3
  54. package/dist/destinations/personas-messaging-twilio/generated-types.js.map +0 -1
  55. package/dist/destinations/personas-messaging-twilio/index.d.ts +0 -4
  56. package/dist/destinations/personas-messaging-twilio/index.js +0 -150
  57. package/dist/destinations/personas-messaging-twilio/index.js.map +0 -1
  58. package/dist/destinations/personas-messaging-twilio/sendSms/generated-types.d.ts +0 -16
  59. package/dist/destinations/personas-messaging-twilio/sendSms/generated-types.js +0 -3
  60. package/dist/destinations/personas-messaging-twilio/sendSms/generated-types.js.map +0 -1
  61. package/dist/destinations/personas-messaging-twilio/sendSms/index.d.ts +0 -5
  62. package/dist/destinations/personas-messaging-twilio/sendSms/index.js +0 -166
  63. package/dist/destinations/personas-messaging-twilio/sendSms/index.js.map +0 -1
@@ -1,166 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const liquidjs_1 = require("liquidjs");
4
- const actions_core_1 = require("@segment/actions-core");
5
- const Liquid = new liquidjs_1.Liquid();
6
- const getProfileApiEndpoint = (environment) => {
7
- return `https://profiles.segment.${environment === 'production' ? 'com' : 'build'}`;
8
- };
9
- const fetchProfileTraits = async (request, settings, profileId) => {
10
- const endpoint = getProfileApiEndpoint(settings.profileApiEnvironment);
11
- const response = await request(`${endpoint}/v1/spaces/${settings.spaceId}/collections/users/profiles/user_id:${profileId}/traits?limit=200`, {
12
- headers: {
13
- authorization: `Basic ${Buffer.from(settings.profileApiAccessToken + ':').toString('base64')}`,
14
- 'content-type': 'application/json'
15
- }
16
- });
17
- const body = await response.json();
18
- return body.traits;
19
- };
20
- const EXTERNAL_ID_KEY = 'phone';
21
- const DEFAULT_CONNECTION_OVERRIDES = 'rp=all&rc=5';
22
- const action = {
23
- title: 'Send SMS',
24
- description: 'Send SMS using Twilio',
25
- defaultSubscription: 'type = "track" and event = "Audience Entered"',
26
- fields: {
27
- userId: {
28
- label: 'User ID',
29
- description: 'User ID in Segment',
30
- type: 'string',
31
- required: true,
32
- default: { '@path': '$.userId' }
33
- },
34
- toNumber: {
35
- label: 'Test Number',
36
- description: 'Number to send SMS to when testing',
37
- type: 'string'
38
- },
39
- from: {
40
- label: 'From',
41
- description: 'The Twilio Phone Number, Short Code, or Messaging Service to send SMS from.',
42
- type: 'string',
43
- required: true
44
- },
45
- body: {
46
- label: 'Message',
47
- description: 'Message to send',
48
- type: 'text',
49
- required: true
50
- },
51
- customArgs: {
52
- label: 'Custom Arguments',
53
- description: 'Additional custom arguments that will be opaquely sent back on webhook events',
54
- type: 'object',
55
- required: false
56
- },
57
- connectionOverrides: {
58
- label: 'Connection Overrides',
59
- description: 'Connection overrides are configuration supported by twilio webhook services. Must be passed as fragments on the callback url',
60
- type: 'string',
61
- required: false
62
- },
63
- send: {
64
- label: 'Send Message',
65
- description: 'Whether or not the message should actually get sent.',
66
- type: 'boolean',
67
- required: false,
68
- default: false
69
- },
70
- externalIds: {
71
- label: 'External IDs',
72
- description: 'An array of user profile identity information.',
73
- type: 'object',
74
- multiple: true,
75
- properties: {
76
- id: {
77
- label: 'ID',
78
- description: 'A unique identifier for the collection.',
79
- type: 'string'
80
- },
81
- type: {
82
- label: 'type',
83
- description: 'The external ID contact type.',
84
- type: 'string'
85
- },
86
- subscriptionStatus: {
87
- label: 'ID',
88
- description: 'The subscription status for the identity.',
89
- type: 'string'
90
- }
91
- },
92
- default: {
93
- '@arrayPath': [
94
- '$.external_ids',
95
- {
96
- id: {
97
- '@path': '$.id'
98
- },
99
- type: {
100
- '@path': '$.type'
101
- },
102
- subscriptionStatus: {
103
- '@path': '$.isSubscribed'
104
- }
105
- }
106
- ]
107
- }
108
- }
109
- },
110
- perform: async (request, { settings, payload }) => {
111
- if (!payload.send) {
112
- return;
113
- }
114
- const externalId = payload.externalIds?.find(({ type }) => type === 'phone');
115
- if (!externalId?.subscriptionStatus ||
116
- ['unsubscribed', 'did not subscribed', 'false'].includes(externalId.subscriptionStatus)) {
117
- return;
118
- }
119
- else if (['subscribed', 'true'].includes(externalId.subscriptionStatus)) {
120
- const traits = await fetchProfileTraits(request, settings, payload.userId);
121
- const phone = payload.toNumber || externalId.id;
122
- if (!phone) {
123
- return;
124
- }
125
- const profile = {
126
- user_id: payload.userId,
127
- phone,
128
- traits
129
- };
130
- const token = Buffer.from(`${settings.twilioApiKeySID}:${settings.twilioApiKeySecret}`).toString('base64');
131
- const parsedBody = await Liquid.parseAndRender(payload.body, { profile });
132
- const body = new URLSearchParams({
133
- Body: parsedBody,
134
- From: payload.from,
135
- To: phone
136
- });
137
- const webhookUrl = settings.webhookUrl;
138
- const connectionOverrides = settings.connectionOverrides;
139
- const customArgs = {
140
- ...payload.customArgs,
141
- __segment_internal_external_id_key__: EXTERNAL_ID_KEY,
142
- __segment_internal_external_id_value__: phone
143
- };
144
- if (webhookUrl && customArgs) {
145
- const webhookUrlWithParams = new URL(webhookUrl);
146
- for (const key of Object.keys(customArgs)) {
147
- webhookUrlWithParams.searchParams.append(key, String(customArgs[key]));
148
- }
149
- webhookUrlWithParams.hash = connectionOverrides || DEFAULT_CONNECTION_OVERRIDES;
150
- body.append('StatusCallback', webhookUrlWithParams.toString());
151
- }
152
- return request(`https://api.twilio.com/2010-04-01/Accounts/${settings.twilioAccountSID}/Messages.json`, {
153
- method: 'POST',
154
- headers: {
155
- authorization: `Basic ${token}`
156
- },
157
- body
158
- });
159
- }
160
- else {
161
- throw new actions_core_1.IntegrationError(`Failed to recognize the subscriptionStatus in the payload: "${externalId.subscriptionStatus}".`, 'Invalid subscriptionStatus value', 400);
162
- }
163
- }
164
- };
165
- exports.default = action;
166
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/personas-messaging-twilio/sendSms/index.ts"],"names":[],"mappings":";;AAAA,uCAA6C;AAK7C,wDAAwD;AAExD,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAM,qBAAqB,GAAG,CAAC,WAAmB,EAAU,EAAE;IAC5D,OAAO,4BAA4B,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;AACrF,CAAC,CAAA;AAID,MAAM,kBAAkB,GAAG,KAAK,EAC9B,OAAkB,EAClB,QAAkB,EAClB,SAAiB,EACgB,EAAE;IACnC,MAAM,QAAQ,GAAG,qBAAqB,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAA;IACtE,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC5B,GAAG,QAAQ,cAAc,QAAQ,CAAC,OAAO,uCAAuC,SAAS,mBAAmB,EAC5G;QACE,OAAO,EAAE;YACP,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,qBAAqB,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAC9F,cAAc,EAAE,kBAAkB;SACnC;KACF,CACF,CAAA;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;IAClC,OAAO,IAAI,CAAC,MAAM,CAAA;AACpB,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,OAAO,CAAA;AAE/B,MAAM,4BAA4B,GAAG,aAAa,CAAA;AAClD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,uBAAuB;IACpC,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,MAAM,EAAE;YACN,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,I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