diff --git a/packages/sms/__tests__/__dataSets__/sms.ts b/packages/sms/__tests__/__dataSets__/sms.ts index fa76e478..25b33838 100644 --- a/packages/sms/__tests__/__dataSets__/sms.ts +++ b/packages/sms/__tests__/__dataSets__/sms.ts @@ -354,4 +354,61 @@ export default [ } as SMSParams, ], }, + { + label: 'send message with number pool', + request: [ + '/sms/json', + 'POST', + { + 'from': '12126875309', + 'to': '14152739164', + 'text': 'too many secrets', + 'pool-id': 'abc123' + + }, + ], + response: [ + 200, + { + 'message-count': 1, + messages: [ + { + to: '14152739164', + 'message-id': '986ebc8e-46de-4f80-88e4-21d4c5d0c0a6', + status: SMSStatus.SUCCESS, + 'remaining-balance': '0.42', + 'message-price': '0.84', + network: '123456', + } as SMSMessageResponse, + ], + } as SMSResponse, + ], + method: 'post', + clientMethod: 'send', + parameters: [ + { + from: '12126875309', + to: '14152739164', + text: 'too many secrets', + poolId: 'abc123', + } as SMSParams, + ], + expected: { + 'message-count': 1, + messageCount: 1, + messages: [ + { + to: '14152739164', + 'message-id': '986ebc8e-46de-4f80-88e4-21d4c5d0c0a6', + messageId: '986ebc8e-46de-4f80-88e4-21d4c5d0c0a6', + status: SMSStatus.SUCCESS, + 'remaining-balance': '0.42', + remainingBalance: '0.42', + 'message-price': '0.84', + messagePrice: '0.84', + network: '123456', + } as SMSMessageResponse, + ], + } as SMSMessages, + } ]; diff --git a/packages/sms/lib/types/SMSParams.ts b/packages/sms/lib/types/SMSParams.ts index dcf0b857..2456ca7d 100644 --- a/packages/sms/lib/types/SMSParams.ts +++ b/packages/sms/lib/types/SMSParams.ts @@ -104,4 +104,14 @@ export type SMSParams = { * accounts subscribed to Fraud Defender Premium. */ trustedNumber?: boolean + + /** + * The ID of the Number Pool to use as the sender of this message. If + * specified, a number from the pool will be used as the from number. The + * from parameter is still required even when specifying a pool-id and will + * be used as a fall-back if the number pool cannot be used. + * + * @see https://developer.vonage.com/en/numbers/number-pools-api/overview + */ + poolId?: string; }