Skip to content

SendTextMessage

Source: src/AWS/PinpointSMSVoiceV2/SendTextMessage.ts

Runtime binding for sms-voice:SendTextMessage.

Sends an SMS message from the bound origination phone number to one recipient — the effectful call made from a deployed Lambda or Task. The deploy-time half grants sms-voice:SendTextMessage on the number and the runtime half injects its ARN as the request’s OriginationIdentity. Provide the implementation with Effect.provide(AWS.PinpointSMSVoiceV2.SendTextMessageHttp).

// init — lease a number and bind the send operation
const number = yield* AWS.PinpointSMSVoiceV2.PhoneNumber("Sender", {
isoCountryCode: "US",
messageType: "TRANSACTIONAL",
numberCapabilities: ["SMS"],
numberType: "TOLL_FREE",
});
const sendText = yield* AWS.PinpointSMSVoiceV2.SendTextMessage(number);
// runtime
const { MessageId } = yield* sendText({
DestinationPhoneNumber: "+12065550100",
MessageBody: "Your code is 123456",
MessageType: "TRANSACTIONAL",
});