@segment/action-destinations 3.170.0 → 3.171.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 (118) hide show
  1. package/dist/destinations/adobe-target/adobeTarget_operations.js +3 -3
  2. package/dist/destinations/adobe-target/adobeTarget_operations.js.map +1 -1
  3. package/dist/destinations/ambee/generated-types.d.ts +7 -0
  4. package/dist/destinations/ambee/generated-types.js +3 -0
  5. package/dist/destinations/ambee/generated-types.js.map +1 -0
  6. package/dist/destinations/ambee/index.d.ts +4 -0
  7. package/dist/destinations/ambee/index.js +62 -0
  8. package/dist/destinations/ambee/index.js.map +1 -0
  9. package/dist/destinations/ambee/subscribeUserToCampaign/generated-types.d.ts +9 -0
  10. package/dist/destinations/ambee/subscribeUserToCampaign/generated-types.js +3 -0
  11. package/dist/destinations/ambee/subscribeUserToCampaign/generated-types.js.map +1 -0
  12. package/dist/destinations/ambee/subscribeUserToCampaign/index.d.ts +5 -0
  13. package/dist/destinations/ambee/subscribeUserToCampaign/index.js +88 -0
  14. package/dist/destinations/ambee/subscribeUserToCampaign/index.js.map +1 -0
  15. package/dist/destinations/emarsys/addToContactList/index.d.ts +1 -1
  16. package/dist/destinations/emarsys/addToContactList/index.js +4 -8
  17. package/dist/destinations/emarsys/addToContactList/index.js.map +1 -1
  18. package/dist/destinations/emarsys/emarsys-helper.js +0 -4
  19. package/dist/destinations/emarsys/emarsys-helper.js.map +1 -1
  20. package/dist/destinations/emarsys/removeFromContactList/index.d.ts +1 -1
  21. package/dist/destinations/emarsys/removeFromContactList/index.js +4 -8
  22. package/dist/destinations/emarsys/removeFromContactList/index.js.map +1 -1
  23. package/dist/destinations/emarsys/triggerEvent/index.d.ts +1 -1
  24. package/dist/destinations/emarsys/triggerEvent/index.js +7 -12
  25. package/dist/destinations/emarsys/triggerEvent/index.js.map +1 -1
  26. package/dist/destinations/emarsys/upsertContact/index.d.ts +1 -1
  27. package/dist/destinations/emarsys/upsertContact/index.js +6 -11
  28. package/dist/destinations/emarsys/upsertContact/index.js.map +1 -1
  29. package/dist/destinations/encharge/createUpdateObject/index.js +2 -2
  30. package/dist/destinations/encharge/createUpdateObject/index.js.map +1 -1
  31. package/dist/destinations/encharge/index.js +1 -1
  32. package/dist/destinations/encharge/index.js.map +1 -1
  33. package/dist/destinations/engage-messaging-twilio/index.js +3 -1
  34. package/dist/destinations/engage-messaging-twilio/index.js.map +1 -1
  35. package/dist/destinations/engage-messaging-twilio/sendMobilePush/generated-types.d.ts +31 -0
  36. package/dist/destinations/engage-messaging-twilio/sendMobilePush/generated-types.js +3 -0
  37. package/dist/destinations/engage-messaging-twilio/sendMobilePush/generated-types.js.map +1 -0
  38. package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.d.ts +5 -0
  39. package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js +202 -0
  40. package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js.map +1 -0
  41. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.d.ts +17 -0
  42. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js +173 -0
  43. package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js.map +1 -0
  44. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.d.ts +3 -5
  45. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js +27 -74
  46. package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js.map +1 -1
  47. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.d.ts +2 -2
  48. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js +4 -4
  49. package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js.map +1 -1
  50. package/dist/destinations/engage-messaging-twilio/utils/message-sender.d.ts +13 -11
  51. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js +122 -126
  52. package/dist/destinations/engage-messaging-twilio/utils/message-sender.js.map +1 -1
  53. package/dist/destinations/engage-messaging-twilio/utils/phone-message.d.ts +12 -0
  54. package/dist/destinations/engage-messaging-twilio/utils/phone-message.js +100 -0
  55. package/dist/destinations/engage-messaging-twilio/utils/phone-message.js.map +1 -0
  56. package/dist/destinations/engage-messaging-twilio/utils/test-utils.d.ts +34 -0
  57. package/dist/destinations/engage-messaging-twilio/utils/test-utils.js +35 -0
  58. package/dist/destinations/engage-messaging-twilio/utils/test-utils.js.map +1 -0
  59. package/dist/destinations/engage-messaging-twilio/utils/types.d.ts +39 -0
  60. package/dist/destinations/engage-messaging-twilio/utils/types.js +3 -0
  61. package/dist/destinations/engage-messaging-twilio/utils/types.js.map +1 -0
  62. package/dist/destinations/facebook-custom-audiences/generated-types.d.ts +3 -0
  63. package/dist/destinations/facebook-custom-audiences/generated-types.js +3 -0
  64. package/dist/destinations/facebook-custom-audiences/generated-types.js.map +1 -0
  65. package/dist/destinations/facebook-custom-audiences/index.d.ts +4 -0
  66. package/dist/destinations/facebook-custom-audiences/index.js +32 -0
  67. package/dist/destinations/facebook-custom-audiences/index.js.map +1 -0
  68. package/dist/destinations/facebook-custom-audiences/syncEngage/generated-types.d.ts +3 -0
  69. package/dist/destinations/facebook-custom-audiences/syncEngage/generated-types.js +3 -0
  70. package/dist/destinations/facebook-custom-audiences/syncEngage/generated-types.js.map +1 -0
  71. package/dist/destinations/facebook-custom-audiences/syncEngage/index.d.ts +5 -0
  72. package/dist/destinations/facebook-custom-audiences/syncEngage/index.js +18 -0
  73. package/dist/destinations/facebook-custom-audiences/syncEngage/index.js.map +1 -0
  74. package/dist/destinations/facebook-custom-audiences/syncRetl/generated-types.d.ts +3 -0
  75. package/dist/destinations/facebook-custom-audiences/syncRetl/generated-types.js +3 -0
  76. package/dist/destinations/facebook-custom-audiences/syncRetl/generated-types.js.map +1 -0
  77. package/dist/destinations/facebook-custom-audiences/syncRetl/index.d.ts +5 -0
  78. package/dist/destinations/facebook-custom-audiences/syncRetl/index.js +18 -0
  79. package/dist/destinations/facebook-custom-audiences/syncRetl/index.js.map +1 -0
  80. package/dist/destinations/index.js +3 -0
  81. package/dist/destinations/index.js.map +1 -1
  82. package/dist/destinations/pinterest-conversions/reportConversionEvent/index.js.map +1 -1
  83. package/dist/destinations/podscribe/page/generated-types.d.ts +3 -0
  84. package/dist/destinations/podscribe/page/index.js +10 -1
  85. package/dist/destinations/podscribe/page/index.js.map +1 -1
  86. package/dist/destinations/podscribe/track/generated-types.d.ts +3 -0
  87. package/dist/destinations/podscribe/track/index.js +10 -1
  88. package/dist/destinations/podscribe/track/index.js.map +1 -1
  89. package/dist/destinations/the-trade-desk-crm/generated-types.d.ts +2 -0
  90. package/dist/destinations/the-trade-desk-crm/index.js +15 -1
  91. package/dist/destinations/the-trade-desk-crm/index.js.map +1 -1
  92. package/dist/destinations/tiktok-audiences/functions.d.ts +1 -1
  93. package/dist/destinations/tiktok-audiences/functions.js +3 -0
  94. package/dist/destinations/tiktok-audiences/functions.js.map +1 -1
  95. package/dist/destinations/tiktok-conversions/reportWebEvent/index.js +1 -1
  96. package/dist/destinations/tiktok-conversions/reportWebEvent/index.js.map +1 -1
  97. package/dist/destinations/userpilot/generated-types.d.ts +4 -0
  98. package/dist/destinations/userpilot/generated-types.js +3 -0
  99. package/dist/destinations/userpilot/generated-types.js.map +1 -0
  100. package/dist/destinations/userpilot/identifyUser/generated-types.d.ts +7 -0
  101. package/dist/destinations/userpilot/identifyUser/generated-types.js +3 -0
  102. package/dist/destinations/userpilot/identifyUser/generated-types.js.map +1 -0
  103. package/dist/destinations/userpilot/identifyUser/index.d.ts +5 -0
  104. package/dist/destinations/userpilot/identifyUser/index.js +52 -0
  105. package/dist/destinations/userpilot/identifyUser/index.js.map +1 -0
  106. package/dist/destinations/userpilot/index.d.ts +4 -0
  107. package/dist/destinations/userpilot/index.js +70 -0
  108. package/dist/destinations/userpilot/index.js.map +1 -0
  109. package/dist/destinations/userpilot/request-utils.d.ts +13 -0
  110. package/dist/destinations/userpilot/request-utils.js +62 -0
  111. package/dist/destinations/userpilot/request-utils.js.map +1 -0
  112. package/dist/destinations/userpilot/trackEvent/generated-types.d.ts +7 -0
  113. package/dist/destinations/userpilot/trackEvent/generated-types.js +3 -0
  114. package/dist/destinations/userpilot/trackEvent/generated-types.js.map +1 -0
  115. package/dist/destinations/userpilot/trackEvent/index.d.ts +5 -0
  116. package/dist/destinations/userpilot/trackEvent/index.js +48 -0
  117. package/dist/destinations/userpilot/trackEvent/index.js.map +1 -0
  118. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"sms-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendSms/sms-sender.ts"],"names":[],"mappings":";;;AACA,uCAA6C;AAE7C,wDAAgF;AAChF,4DAAuD;AAEvD,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAiB7B,MAAa,gBAAiB,SAAQ,8BAAsB;IAA5D;;QAmEU,qBAAgB,GAAG,KAAK,IAAI,EAAE;YACpC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;gBACxB,IAAI,CAAC,QAAQ,CACX,sEAAsE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAC9F,CAAA;gBACD,MAAM,IAAI,+BAAgB,CACxB,kEAAkE,EAClE,oBAAoB,EACpB,GAAG,CACJ,CAAA;aACF;YACD,IAAI;gBACF,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE,OAAO,EAAE,qBAAqB,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAA;gBACvF,MAAM,UAAU,GAAG,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,kBAAkB,CAAA;gBACxF,MAAM,YAAY,GAAG,qBAAqB,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;gBAC7E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CACjC,WAAW,UAAU,IAAI,YAAY,cAAc,OAAO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IAAI,CAAC,CAAA;YACzF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAClC,OAAO,IAAI,CAAC,MAAM,CAAA;SACnB;QAAC,OAAO,KAAc,EAAE;YACvB,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,iDAAiD,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;YACvF,IAAI,CAAC,QAAQ,CAAC,oCAAoC,IAAI,CAAC,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAAC,CAAA;YACvF,MAAM,IAAI,+BAAgB,CAAC,8CAA8C,EAAE,yBAAyB,EAAE,GAAG,CAAC,CAAA;SAC3G;IACH,CAAC;CACF;AAhGD,4CAgGC"}
@@ -1,6 +1,6 @@
1
1
  import type { Payload } from './generated-types';
2
- import { MessageSender } from '../utils/message-sender';
3
- export declare class WhatsAppMessageSender extends MessageSender<Payload> {
2
+ import { PhoneMessage } from '../utils/phone-message';
3
+ export declare class WhatsAppMessageSender extends PhoneMessage<Payload> {
4
4
  getChannelType(): string;
5
5
  getBody(phone: string): Promise<URLSearchParams>;
6
6
  private getVariables;
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WhatsAppMessageSender = void 0;
4
4
  const liquidjs_1 = require("liquidjs");
5
5
  const actions_core_1 = require("@segment/actions-core");
6
- const message_sender_1 = require("../utils/message-sender");
7
6
  const google_libphonenumber_1 = require("google-libphonenumber");
7
+ const phone_message_1 = require("../utils/phone-message");
8
8
  const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
9
9
  const Liquid = new liquidjs_1.Liquid();
10
- class WhatsAppMessageSender extends message_sender_1.MessageSender {
10
+ class WhatsAppMessageSender extends phone_message_1.PhoneMessage {
11
11
  constructor() {
12
12
  super(...arguments);
13
13
  this.getVariables = async () => {
@@ -31,7 +31,7 @@ class WhatsAppMessageSender extends message_sender_1.MessageSender {
31
31
  return JSON.stringify(mapping);
32
32
  }
33
33
  catch (error) {
34
- this.logError(`Failed to parse WhatsApp template with content variables - ${this.settings.spaceId} - [${error}]`);
34
+ this.logError(`Failed to parse template with content variables - ${this.settings.spaceId} - [${error}]`);
35
35
  throw new actions_core_1.IntegrationError(`Unable to parse templating in content variables`, `Content variables templating parse failure`, 400);
36
36
  }
37
37
  };
@@ -48,7 +48,7 @@ class WhatsAppMessageSender extends message_sender_1.MessageSender {
48
48
  }
49
49
  catch (error) {
50
50
  this.tags.push('type:invalid_phone_e164');
51
- this.logError(`WhatsApp invalid phone number - ${this.settings.spaceId} - [${error}]`);
51
+ this.logError(`invalid phone number - ${this.settings.spaceId} - [${error}]`);
52
52
  this.statsClient?.incr('actions-personas-messaging-twilio.error', 1, this.tags);
53
53
  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);
54
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"whatsapp-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.ts"],"names":[],"mappings":";;;AACA,uCAA6C;AAE7C,wDAAwD;AACxD,4DAAuD;AACvD,iEAA0E;AAE1E,MAAM,SAAS,GAAG,uCAAe,CAAC,WAAW,EAAE,CAAA;AAC/C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAa,qBAAsB,SAAQ,8BAAsB;IAAjE;;QA4CU,iBAAY,GAAG,KAAK,IAA4B,EAAE;YACxD,IAAI;gBAIF,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB;oBAChE,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,IAAI,CAAA;gBAC9D,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MA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AC,mCAAmC,IAAI,CAAC,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAAC,CAAA;YACtF,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,yCAAyC,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;YAC/E,MAAM,IAAI,+BAAgB,CACxB,wHAAwH,EACxH,eAAe,EACf,GAAG,CACJ,CAAA;SACF;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC5B,IAAI,CAAC,QAAQ,CAAC,mDAAmD,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;YACzF,MAAM,IAAI,+BAAgB,CAAC,gDAAgD,EAAE,qBAAqB,EAAE,GAAG,CAAC,CAAA;SACzG;QAED,MAAM,MAAM,GAA2B;YACrC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;YACnC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACvB,EAAE,EAAE,WAAW;SAChB,CAAA;QACD,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA;QAElD,IAAI,gBAAgB;YAAE,MAAM,CAAC,kBAAkB,CAAC,GAAG,gBAAgB,CAAA;QAEnE,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAA;IACpC,CAAC;CAqCF;AA/ED,sDA+EC"}
1
+ {"version":3,"file":"whatsapp-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.ts"],"names":[],"mappings":";;;AACA,uCAA6C;AAE7C,wDAAwD;AACxD,iEAA0E;AAC1E,0DAAqD;AAErD,MAAM,SAAS,GAAG,uCAAe,CAAC,WAAW,EAAE,CAAA;AAC/C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAa,qBAAsB,SAAQ,4BAAqB;IAAhE;;QA2CU,iBAAY,GAAG,KAAK,IAA4B,EAAE;YACxD,I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KAAK,EAAE,IAAI,CAAC,CAAA;YAC1C,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,yCAAiB,CAAC,IAAI,CAAC,CAAA;YACnE,WAAW,GAAG,YAAY,WAAW,EAAE,CAAA;SACxC;QAAC,OAAO,KAAc,EAAE;YACvB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAA;YACzC,IAAI,CAAC,QAAQ,CAAC,0BAA0B,IAAI,CAAC,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAAC,CAAA;YAC7E,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,yCAAyC,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;YAC/E,MAAM,IAAI,+BAAgB,CACxB,wHAAwH,EACxH,eAAe,EACf,GAAG,CACJ,CAAA;SACF;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC5B,IAAI,CAAC,QAAQ,CAAC,mDAAmD,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;YACzF,MAAM,IAAI,+BAAgB,CAAC,gDAAgD,EAAE,qBAAqB,EAAE,GAAG,CAAC,CAAA;SACzG;QAED,MAAM,MAAM,GAA2B;YACrC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;YACnC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACvB,EAAE,EAAE,WAAW;SAChB,CAAA;QACD,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA;QAElD,IAAI,gBAAgB;YAAE,MAAM,CAAC,kBAAkB,CAAC,GAAG,gBAAgB,CAAA;QAEnE,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAA;IACpC,CAAC;CAmCF;AA5ED,sDA4EC"}
@@ -1,9 +1,10 @@
1
- import type { RequestOptions } from '@segment/actions-core';
2
1
  import type { Settings } from '../generated-types';
3
2
  import type { Payload as SmsPayload } from '../sendSms/generated-types';
4
3
  import type { Payload as WhatsappPayload } from '../sendWhatsApp/generated-types';
4
+ import { RequestOptions } from '@segment/actions-core';
5
5
  import { Logger, StatsClient, StatsContext } from '@segment/actions-core/src/destination-kit';
6
6
  import { ExecuteInput } from '@segment/actions-core';
7
+ import { ContentTemplateTypes, Profile } from './types';
7
8
  export declare type RequestFn = (url: string, options?: RequestOptions) => Promise<Response>;
8
9
  export declare abstract class MessageSender<MessagePayload extends SmsPayload | WhatsappPayload> {
9
10
  readonly request: RequestFn;
@@ -14,22 +15,23 @@ export declare abstract class MessageSender<MessagePayload extends SmsPayload |
14
15
  readonly logger: Logger | undefined;
15
16
  readonly executeInput: ExecuteInput<Settings, MessagePayload>;
16
17
  readonly logDetails: Record<string, unknown>;
17
- private readonly EXTERNAL_ID_KEY;
18
- private readonly DEFAULT_HOSTNAME;
19
- private readonly DEFAULT_CONNECTION_OVERRIDES;
18
+ static readonly nonSendableStatuses: string[];
19
+ static readonly sendableStatuses: string[];
20
+ protected readonly supportedTemplateTypes: string[];
20
21
  constructor(request: RequestFn, payload: MessagePayload, settings: Settings, statsClient: StatsClient | undefined, tags: StatsContext['tags'], logger: Logger | undefined, executeInput: ExecuteInput<Settings, MessagePayload>, logDetails?: Record<string, unknown>);
21
- abstract getBody(phone: string): Promise<URLSearchParams>;
22
22
  abstract getChannelType(): string;
23
- isValidExternalId(externalId: NonNullable<MessagePayload['externalIds']>[number]): boolean;
23
+ abstract doSend(): Promise<Response | Response[] | object[] | undefined>;
24
+ send(): Promise<Response | object[] | Response[] | undefined>;
25
+ parseContent<R extends Record<string, string | string[] | undefined>>(content: R, profile: Profile): Promise<R>;
24
26
  redactPii(pii: string | undefined): string | undefined;
25
27
  logInfo(...msgs: string[]): void;
26
28
  logError(error?: any, ...msgs: string[]): void;
27
29
  private static isPromise;
28
30
  logWrap<R = void>(messages: string[], fn: () => R): R;
29
31
  initLogDetails(): void;
30
- send(): Promise<Response | undefined>;
31
- static nonSendableStatuses: string[];
32
- static sendableStatuses: string[];
33
- private getSendabilityPayload;
34
- private getWebhookUrlWithParams;
32
+ getContentTemplateTypes(): Promise<ContentTemplateTypes>;
33
+ private extractTemplateTypes;
34
+ getWebhookUrlWithParams(externalIdType?: string, externalIdValue?: string, defaultConnectionOverrides?: string): string | null;
35
+ logTwilioError(error: unknown, apiName?: string): unknown;
36
+ throwTwilioError(error: unknown, apiName?: string): void;
35
37
  }
@@ -1,15 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MessageSender = void 0;
4
+ const liquidjs_1 = require("liquidjs");
4
5
  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 = {}));
6
+ const Liquid = new liquidjs_1.Liquid();
13
7
  class MessageSender {
14
8
  constructor(request, payload, settings, statsClient, tags, logger, executeInput, logDetails = {}) {
15
9
  this.request = request;
@@ -20,31 +14,36 @@ class MessageSender {
20
14
  this.logger = logger;
21
15
  this.executeInput = executeInput;
22
16
  this.logDetails = logDetails;
23
- this.EXTERNAL_ID_KEY = 'phone';
24
- this.DEFAULT_HOSTNAME = 'api.twilio.com';
25
- this.DEFAULT_CONNECTION_OVERRIDES = 'rp=all&rc=5';
26
- this.getWebhookUrlWithParams = (phone) => {
27
- const webhookUrl = this.settings.webhookUrl;
28
- const connectionOverrides = this.settings.connectionOverrides;
29
- const customArgs = {
30
- ...this.payload.customArgs,
31
- space_id: this.settings.spaceId,
32
- __segment_internal_external_id_key__: this.EXTERNAL_ID_KEY,
33
- __segment_internal_external_id_value__: phone
34
- };
35
- if (webhookUrl && customArgs) {
36
- const webhookUrlWithParams = new URL(webhookUrl);
37
- for (const key of Object.keys(customArgs)) {
38
- webhookUrlWithParams.searchParams.append(key, String(customArgs[key]));
39
- }
40
- webhookUrlWithParams.hash = connectionOverrides || this.DEFAULT_CONNECTION_OVERRIDES;
41
- return webhookUrlWithParams.toString();
42
- }
43
- return null;
44
- };
45
17
  }
46
- isValidExternalId(externalId) {
47
- return externalId.type === 'phone' && this.getChannelType() === externalId.channelType?.toLowerCase();
18
+ async send() {
19
+ this.initLogDetails();
20
+ this.tags.push(`channel:${this.getChannelType()}`);
21
+ this.statsClient?.incr('actions_personas_messaging_twilio.initialize', 1, this.tags);
22
+ return this.logWrap([`Destination Action`], this.doSend.bind(this));
23
+ }
24
+ async parseContent(content, profile) {
25
+ try {
26
+ const parsedEntries = await Promise.all(Object.entries(content).map(async ([key, val]) => {
27
+ if (val == null) {
28
+ return [key, val];
29
+ }
30
+ if (Array.isArray(val)) {
31
+ val = await Promise.all(val.map((item) => Liquid.parseAndRender(item, { profile })));
32
+ }
33
+ else {
34
+ val = await Liquid.parseAndRender(val, { profile });
35
+ }
36
+ return [key, val];
37
+ }));
38
+ return Object.fromEntries(parsedEntries);
39
+ }
40
+ catch (error) {
41
+ this.logDetails['error'] = error instanceof Error ? error.message : error?.toString();
42
+ this.logError(`unable to parse templating - ${this.settings.spaceId}`);
43
+ this.tags.push('reason:invalid_liquid');
44
+ this.statsClient?.incr('actions-personas-messaging-twilio.error', 1, this.tags);
45
+ throw new actions_core_1.PayloadValidationError(`Unable to parse templating in ${this.getChannelType()}`);
46
+ }
48
47
  }
49
48
  redactPii(pii) {
50
49
  if (!pii) {
@@ -57,48 +56,48 @@ class MessageSender {
57
56
  }
58
57
  logInfo(...msgs) {
59
58
  const [firstMsg, ...rest] = msgs;
60
- this.logger?.info(`TE Messaging: ${firstMsg}`, ...rest, JSON.stringify(this.logDetails));
59
+ this.logger?.info(`TE Messaging: ${this.getChannelType().toUpperCase()} ${firstMsg}`, ...rest, JSON.stringify(this.logDetails));
61
60
  }
62
61
  logError(error, ...msgs) {
63
62
  const [firstMsg, ...rest] = msgs;
64
63
  if (typeof error === 'string') {
65
- this.logger?.error(`TE Messaging: ${error}`, ...msgs, JSON.stringify(this.logDetails));
64
+ this.logger?.error(`TE Messaging: ${this.getChannelType().toUpperCase()} ${error}`, ...msgs, JSON.stringify(this.logDetails));
66
65
  }
67
66
  else {
68
- this.logger?.error(`TE Messaging: ${firstMsg}`, ...rest, error instanceof Error ? error.message : error?.toString(), JSON.stringify(this.logDetails));
67
+ this.logger?.error(`TE Messaging: ${this.getChannelType().toUpperCase()} ${firstMsg}`, ...rest, error instanceof Error ? error.message : error?.toString(), JSON.stringify(this.logDetails));
69
68
  }
70
69
  }
71
70
  static isPromise(obj) {
72
71
  return obj instanceof Object && 'then' in obj && typeof obj.then === 'function';
73
72
  }
74
73
  logWrap(messages, fn) {
75
- this.logInfo("Starting: ", ...messages);
74
+ this.logInfo('Starting: ', ...messages);
76
75
  try {
77
76
  const res = fn();
78
77
  if (MessageSender.isPromise(res)) {
79
78
  return (async () => {
80
79
  try {
81
80
  const promisedRes = await res;
82
- this.logInfo("Success: ", ...messages);
81
+ this.logInfo('Success: ', ...messages);
83
82
  return promisedRes;
84
83
  }
85
84
  catch (error) {
86
- this.logError(error, "Failed: ", ...messages);
85
+ this.logError(error, 'Failed: ', ...messages);
87
86
  throw error;
88
87
  }
89
88
  })();
90
89
  }
91
- this.logInfo("Success: ", ...messages);
90
+ this.logInfo('Success: ', ...messages);
92
91
  return res;
93
92
  }
94
93
  catch (error) {
95
- this.logError(error, "Failed: ", ...messages);
94
+ this.logError(error, 'Failed: ', ...messages);
96
95
  throw error;
97
96
  }
98
97
  }
99
98
  initLogDetails() {
100
99
  Object.assign(this.logDetails, {
101
- externalIds: this.payload.externalIds?.map(eid => ({ ...eid, id: this.redactPii(eid.id) })),
100
+ externalIds: this.payload.externalIds?.map((eid) => ({ ...eid, id: this.redactPii(eid.id) })),
102
101
  shouldSend: this.payload.send,
103
102
  contentSid: this.payload.contentSid,
104
103
  sourceId: this.settings.sourceId,
@@ -106,104 +105,101 @@ class MessageSender {
106
105
  twilioApiKeySID: this.settings.twilioApiKeySID,
107
106
  region: this.settings.region,
108
107
  messageId: this.executeInput['rawData']?.messageId,
109
- channelType: this.getChannelType(),
108
+ channelType: this.getChannelType()
110
109
  });
111
110
  if ('userId' in this.payload)
112
111
  this.logDetails.userId = this.payload.userId;
113
112
  }
114
- async send() {
115
- this.initLogDetails();
116
- return this.logWrap([`Destination Action ${this.getChannelType()}`], async () => {
117
- const { phone, sendabilityStatus } = this.getSendabilityPayload();
118
- if (sendabilityStatus !== SendabilityStatus.ShouldSend || !phone) {
119
- this.logInfo(`Not sending message, because sendabilityStatus: ${sendabilityStatus}, phone: ${this.redactPii(phone)}`);
120
- return;
113
+ async getContentTemplateTypes() {
114
+ let template;
115
+ try {
116
+ if (!this.payload.contentSid) {
117
+ throw new actions_core_1.PayloadValidationError('Content SID not in payload');
121
118
  }
122
- this.logInfo("Getting content Body");
123
- const body = await this.getBody(phone);
124
- const webhookUrlWithParams = this.getWebhookUrlWithParams(phone);
125
- if (webhookUrlWithParams)
126
- body.append('StatusCallback', webhookUrlWithParams);
127
- const twilioHostname = this.settings.twilioHostname ?? this.DEFAULT_HOSTNAME;
128
119
  const twilioToken = Buffer.from(`${this.settings.twilioApiKeySID}:${this.settings.twilioApiKeySecret}`).toString('base64');
129
- this.statsClient?.set('actions_personas_messaging_twilio.message_body_size', body?.toString().length, this.tags);
130
- try {
131
- this.logInfo("Sending message to Twilio API");
132
- const response = await this.request(`https://${twilioHostname}/2010-04-01/Accounts/${this.settings.twilioAccountSID}/Messages.json`, {
133
- method: 'POST',
134
- headers: {
135
- authorization: `Basic ${twilioToken}`
136
- },
137
- body
138
- });
139
- this.tags.push(`twilio_status_code:${response.status}`);
140
- this.statsClient?.incr('actions_personas_messaging_twilio.response', 1, this.tags);
141
- if (this.payload.eventOccurredTS != undefined) {
142
- this.statsClient?.histogram('actions-personas-messaging-twilio.eventDeliveryTS', Date.now() - new Date(this.payload.eventOccurredTS).getTime(), this.tags);
143
- }
144
- this.logDetails['twilio-request-id'] = response.headers?.get('twilio-request-id');
145
- this.logInfo("Message sent successfully");
146
- return response;
147
- }
148
- catch (errorOrig) {
149
- let errorToRethrow = errorOrig;
150
- if (errorOrig instanceof Object) {
151
- const twilioApiError = errorOrig;
152
- this.logDetails['twilioApiError_response_data'] = twilioApiError.response?.data;
153
- this.logDetails['twilio-request-id'] = twilioApiError.response?.headers?.get('twilio-request-id');
154
- this.logDetails['error'] = twilioApiError.response;
155
- this.logError(`Twilio Programmable API error - ${this.settings.spaceId}`);
156
- const statusCode = twilioApiError.status || twilioApiError.response?.data?.status;
157
- this.tags.push(`twilio_status_code:${statusCode}`);
158
- this.statsClient?.incr('actions_personas_messaging_twilio.response', 1, this.tags);
159
- if (!twilioApiError.status) {
160
- errorToRethrow = new actions_core_1.IntegrationError(twilioApiError.response?.data?.message || twilioApiError.message, (twilioApiError.response?.data?.code || statusCode)?.toString() || "Twilio Api Request Error", statusCode);
161
- }
162
- const errorCode = twilioApiError.response?.data?.code;
163
- if (errorCode === 63018 || statusCode === 429) {
164
- this.statsClient?.incr('actions_personas_messaging_twilio.rate_limited', 1, this.tags);
165
- }
120
+ const response = await this.request(`https://content.twilio.com/v1/Content/${this.payload.contentSid}`, {
121
+ method: 'GET',
122
+ headers: {
123
+ authorization: `Basic ${twilioToken}`
166
124
  }
167
- throw errorToRethrow;
168
- }
169
- });
170
- }
171
- getSendabilityPayload() {
172
- if (!this.payload.send) {
173
- this.statsClient?.incr('actions-personas-messaging-twilio.send-disabled', 1, this.tags);
174
- return { sendabilityStatus: SendabilityStatus.SendDisabled, phone: undefined };
175
- }
176
- const validExtIds = this.payload.externalIds?.filter(extId => this.isValidExternalId(extId));
177
- const firstSubscribedExtId = validExtIds?.find(extId => extId.subscriptionStatus
178
- && MessageSender.sendableStatuses.includes(extId.subscriptionStatus?.toString()?.toLowerCase()));
179
- const invalidStatuses = validExtIds?.filter(extId => {
180
- const subStatus = extId.subscriptionStatus?.toString()?.toLowerCase();
181
- if (!subStatus)
182
- return false;
183
- return !(MessageSender.nonSendableStatuses.includes(subStatus) || MessageSender.sendableStatuses.includes(subStatus));
184
- });
185
- const hasInvalidStatuses = invalidStatuses && invalidStatuses.length > 0;
186
- if (hasInvalidStatuses) {
187
- this.logInfo(`Invalid subscription statuses found in externalIds: ${invalidStatuses.map(extId => extId.subscriptionStatus).join(', ')}`);
125
+ });
126
+ template = (await response.json());
188
127
  }
189
- let status = SendabilityStatus.DoNotSend;
190
- const phone = this.payload.toNumber || firstSubscribedExtId?.id;
191
- if (firstSubscribedExtId) {
192
- this.statsClient?.incr('actions_personas_messaging_twilio.subscribed', 1, this.tags);
193
- status = phone ? SendabilityStatus.ShouldSend : SendabilityStatus.NoSenderPhone;
128
+ catch (error) {
129
+ this.tags.push('reason:get_content_template');
130
+ this.statsClient?.incr('actions_personas_messaging_twilio.error', 1, this.tags);
131
+ this.logError(`failed request to fetch content template from Twilio Content API - ${this.settings.spaceId} - ${error}, ${JSON.stringify(error)})}`);
132
+ throw new actions_core_1.IntegrationError('Unable to fetch content template', 'Twilio Content API request failure', 500);
194
133
  }
195
- else if (hasInvalidStatuses) {
196
- this.statsClient?.incr('actions_personas_messaging_twilio.invalid_subscription_status', 1, this.tags);
197
- status = SendabilityStatus.InvalidSubscriptionStatus;
134
+ return this.extractTemplateTypes(template);
135
+ }
136
+ extractTemplateTypes(template) {
137
+ if (!template.types) {
138
+ this.logError(`template from Twilio Content API does not contain a template type - ${this.settings.spaceId} - [${JSON.stringify(template)}]`);
139
+ this.tags.push('reason:invalid_template_type');
140
+ this.statsClient?.incr('actions_personas_messaging_twilio.error', 1);
141
+ throw new actions_core_1.IntegrationError('Template from Twilio Content API does not contain any template types', `NO_CONTENT_TYPES`, 400);
198
142
  }
199
- else if (validExtIds && validExtIds.length > 0) {
200
- this.statsClient?.incr('actions_personas_messaging_twilio.notsubscribed', 1, this.tags);
201
- status = SendabilityStatus.DoNotSend;
143
+ const type = Object.keys(template.types)[0];
144
+ if (this.supportedTemplateTypes.includes(type)) {
145
+ return { body: template.types[type].body, media: template.types[type].media };
202
146
  }
203
147
  else {
204
- status = SendabilityStatus.NoSenderPhone;
148
+ this.logError(`unsupported content template type '${type}' - ${this.settings.spaceId}`);
149
+ this.tags.push('reason:invalid_template_type');
150
+ this.statsClient?.incr('actions_personas_messaging_twilio.error', 1);
151
+ throw new actions_core_1.IntegrationError(`Sending templates with '${type}' content type is not supported by ${this.getChannelType()}`, 'UNSUPPORTED_CONTENT_TYPE', 400);
152
+ }
153
+ }
154
+ getWebhookUrlWithParams(externalIdType, externalIdValue, defaultConnectionOverrides = 'rp=all&rc=5') {
155
+ const webhookUrl = this.settings.webhookUrl;
156
+ const connectionOverrides = this.settings.connectionOverrides;
157
+ const customArgs = {
158
+ ...this.payload.customArgs,
159
+ space_id: this.settings.spaceId,
160
+ __segment_internal_external_id_key__: externalIdType,
161
+ __segment_internal_external_id_value__: externalIdValue
162
+ };
163
+ if (webhookUrl && customArgs) {
164
+ try {
165
+ const webhookUrlWithParams = new URL(webhookUrl);
166
+ for (const key of Object.keys(customArgs)) {
167
+ webhookUrlWithParams.searchParams.append(key, String(customArgs[key]));
168
+ }
169
+ webhookUrlWithParams.hash = connectionOverrides || defaultConnectionOverrides;
170
+ return webhookUrlWithParams.toString();
171
+ }
172
+ catch (error) {
173
+ this.logDetails['webhook-custom-args'] = this.payload.customArgs;
174
+ this.logError(`invalid webhook url - ${this.settings.spaceId}`);
175
+ throw new actions_core_1.PayloadValidationError('Invalid webhook url arguments');
176
+ }
177
+ }
178
+ return null;
179
+ }
180
+ logTwilioError(error, apiName = 'Twilio Programmable API') {
181
+ let errorToRethrow = error;
182
+ if (error instanceof Object) {
183
+ const twilioApiError = error;
184
+ this.logDetails['twilioApiError_response_data'] = twilioApiError.response?.data;
185
+ this.logDetails['twilio-request-id'] = twilioApiError.response?.headers?.get('twilio-request-id');
186
+ this.logDetails['error'] = twilioApiError.response;
187
+ this.logError(`${apiName} error - ${this.settings.spaceId}`);
188
+ const statusCode = twilioApiError.status || twilioApiError.response?.data?.status;
189
+ this.tags.push(`twilio_status_code:${statusCode}`);
190
+ this.statsClient?.incr('actions_personas_messaging_twilio.response', 1, this.tags);
191
+ if (!twilioApiError.status) {
192
+ errorToRethrow = new actions_core_1.IntegrationError(twilioApiError.response?.data?.message || twilioApiError.message, (twilioApiError.response?.data?.code || statusCode)?.toString() || 'Twilio Api Request Error', statusCode);
193
+ }
194
+ const errorCode = twilioApiError.response?.data?.code;
195
+ if (errorCode === 63018 || statusCode === 429) {
196
+ this.statsClient?.incr('actions_personas_messaging_twilio.rate_limited', 1, this.tags);
197
+ }
205
198
  }
206
- return { sendabilityStatus: status, phone };
199
+ return errorToRethrow;
200
+ }
201
+ throwTwilioError(error, apiName = 'Twilio Programmable API') {
202
+ throw this.logTwilioError(error, apiName);
207
203
  }
208
204
  }
209
205
  exports.MessageSender = MessageSender;
@@ -1 +1 @@
1
- {"version":3,"file":"message-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/utils/message-sender.ts"],"names":[],"mappings":";;;AAKA,wDAAwD;AAIxD,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;AAqBD,MAAsB,aAAa;IAKjC,YACW,OAAkB,EAClB,OAAuB,EACvB,QAAkB,EAClB,WAAoC,EACpC,IAA0B,EAC1B,MAA0B,EAE1B,YAAoD,EACpD,aAAsC,EAAE;QARxC,YAAO,GAAP,OAAO,CAAW;QAClB,YAAO,GAAP,OAAO,CAAgB;QACvB,aAAQ,GAAR,QAAQ,CAAU;QAClB,gBAAW,GAAX,WAAW,CA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QH,sCAkSC;AA5EQ,iCAAmB,GAAG,CAAC,cAAc,EAAE,oBAAoB,EAAE,OAAO,CAAC,CAAA;AACrE,8BAAgB,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA"}
1
+ {"version":3,"file":"message-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/utils/message-sender.ts"],"names":[],"mappings":";;;AACA,uCAA6C;AAI7C,wDAAgG;AAKhG,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAI7B,MAAsB,aAAa;IAKjC,YACW,OAAkB,EAClB,OAAuB,EACvB,QAAkB,EAClB,WAAoC,EACpC,IAA0B,EAC1B,MAA0B,EAC1B,YAAoD,EACpD,aAAsC,EAAE;QAPxC,YAAO,GAAP,OAAO,CAAW;QAClB,YAAO,GAAP,OAAO,CAAgB;QACvB,aAAQ,GAAR,QAAQ,CAAU;QAClB,gBAAW,GAAX,WAAW,CAAyB;QACpC,SAAI,GAAJ,IAAI,CAAsB;QAC1B,WAAM,GAAN,MAAM,CAAoB;QAC1B,iBAAY,GAAZ,YAAY,CAAwC;QACpD,eAAU,GAAV,UAAU,CAA8B;IAChD,CAAC;IAKJ,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,cAAc,EAAE,CAAA;QACrB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;QAClD,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,8CAA8C,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QACpF,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACrE,CAAC;IAKD,KAAK,CAAC,YAAY,CAChB,OAAU,EACV,OAAgB;QAEhB,IAAI;YACF,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG,CACrC,M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OAAO,IAAI,cAAc,CAAC,OAAO,EAChE,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,IAAI,UAAU,CAAC,EAAE,QAAQ,EAAE,IAAI,0BAA0B,EAC7F,UAAU,CACX,CAAA;aACF;YAED,MAAM,SAAS,GAAG,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAA;YACrD,IAAI,SAAS,KAAK,KAAK,IAAI,UAAU,KAAK,GAAG,EAAE;gBAE7C,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,gDAAgD,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;aACvF;SACF;QACD,OAAO,cAAc,CAAA;IACvB,CAAC;IAED,gBAAgB,CAAC,KAAc,EAAE,OAAO,GAAG,yBAAyB;QAClE,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IAC3C,CAAC;;AAjSH,sCAkSC;AAjSiB,iCAAmB,GAAG,CAAC,cAAc,EAAE,oBAAoB,EAAE,OAAO,CAAC,CAAA;AACrE,8BAAgB,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { MessageSender } from './message-sender';
2
+ import type { Payload as SmsPayload } from '../sendSms/generated-types';
3
+ import type { Payload as WhatsappPayload } from '../sendWhatsApp/generated-types';
4
+ export declare abstract class PhoneMessage<Payload extends SmsPayload | WhatsappPayload> extends MessageSender<Payload> {
5
+ private readonly EXTERNAL_ID_KEY;
6
+ private readonly DEFAULT_HOSTNAME;
7
+ private readonly DEFAULT_CONNECTION_OVERRIDES;
8
+ abstract getBody(phone: string): Promise<URLSearchParams>;
9
+ doSend(): Promise<Response | undefined>;
10
+ isValidExternalId(externalId: NonNullable<Payload['externalIds']>[number]): boolean;
11
+ private getSendabilityPayload;
12
+ }