send_text_message
async
¶
send_text_message(
destination_phone_number: PhoneNumber,
*,
config_overrides: Optional[AsyncPinpointSMSVoiceV2ClientConfig] = None,
origination_identity: Optional[TextMessageOriginationIdentity] = None,
message_body: Optional[TextMessageBody] = None,
message_type: Optional[MessageType] = None,
keyword: Optional[Keyword] = None,
configuration_set_name: Optional[ConfigurationSetNameOrArn] = None,
max_price: Optional[MaxPrice] = None,
time_to_live: Optional[TimeToLive] = None,
context: Optional[ContextMap] = None,
destination_country_parameters: Optional[DestinationCountryParameters] = None,
dry_run: Optional[bool] = None,
protect_configuration_id: Optional[ProtectConfigurationIdOrArn] = None,
message_feedback_enabled: Optional[bool] = None,
) -> SendTextMessageResult
Creates a new text message and sends it to a recipient's phone number. SendTextMessage only sends an SMS message to one recipient each time it is invoked.
SMS throughput limits are measured in Message Parts per Second (MPS). Your MPS limit depends on the destination country of your messages, as well as the type of phone number (origination number) that you use to send the message. For more information about MPS, see Message Parts per Second (MPS) limits in the End User Messaging SMS User Guide.
Parameters:
-
destination_phone_number(PhoneNumber) –The destination phone number in E.164 format.
-
origination_identity(Optional[TextMessageOriginationIdentity], default:None) –The origination identity of the message. This can be either the PhoneNumber, PhoneNumberId, PhoneNumberArn, RcsAgentId, RcsAgentArn, SenderId, SenderIdArn, PoolId, or PoolArn.
If you are using a shared End User Messaging SMS resource then you must use the full Amazon Resource Name(ARN).
-
message_body(Optional[TextMessageBody], default:None) –The body of the text message.
-
message_type(Optional[MessageType], default:None) –The type of message. Valid values are for messages that are critical or time-sensitive and PROMOTIONAL for messages that aren't critical or time-sensitive.
-
keyword(Optional[Keyword], default:None) –When you register a short code in the US, you must specify a program name. If you don’t have a US short code, omit this attribute.
-
configuration_set_name(Optional[ConfigurationSetNameOrArn], default:None) –The name of the configuration set to use. This can be either the ConfigurationSetName or ConfigurationSetArn.
-
max_price(Optional[MaxPrice], default:None) –The maximum amount that you want to spend, in US dollars, per each text message. If the calculated amount to send the text message is greater than
MaxPrice, the message is not sent and an error is returned. -
time_to_live(Optional[TimeToLive], default:None) –How long the text message is valid for, in seconds. By default this is 72 hours. If the messages isn't handed off before the TTL expires we stop attempting to hand off the message and return
TTL_EXPIREDevent. -
context(Optional[ContextMap], default:None) –You can specify custom data in this field. If you do, that data is logged to the event destination.
-
destination_country_parameters(Optional[DestinationCountryParameters], default:None) –This field is used for any country-specific registration requirements. Currently, this setting is only used when you send messages to recipients in India using a sender ID. For more information see Special requirements for sending SMS messages to recipients in India.
-
IN_ENTITY_IDThe entity ID or Principal Entity (PE) ID that you received after completing the sender ID registration process. -
IN_TEMPLATE_IDThe template ID that you received after completing the sender ID registration process.Make sure that the Template ID that you specify matches your message template exactly. If your message doesn't match the template that you provided during the registration process, the mobile carriers might reject your message.
-
-
dry_run(Optional[bool], default:None) –When set to true, the message is checked and validated, but isn't sent to the end recipient. You are not charged for using
DryRun.The Message Parts per Second (MPS) limit when using
DryRunis five. If your origination identity has a lower MPS limit then the lower MPS limit is used. For more information about MPS limits, see Message Parts per Second (MPS) limits in the End User Messaging SMS User Guide.. -
protect_configuration_id(Optional[ProtectConfigurationIdOrArn], default:None) –The unique identifier for the protect configuration.
-
message_feedback_enabled(Optional[bool], default:None) –Set to true to enable message feedback for the message. When a user receives the message you need to update the message status using PutMessageFeedback.
Raises:
-
AccessDeniedException–The request was denied because you don't have sufficient permissions to access the resource.
-
ConflictException–Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time or it could be that the requested action isn't valid for the current state or configuration of the resource.
-
InternalServerException–The API encountered an unexpected error and couldn't complete the request. You might be able to successfully issue the request again in the future.
-
ResourceNotFoundException–A requested resource couldn't be found.
-
ServiceQuotaExceededException–The request would cause a service quota to be exceeded.
-
ThrottlingException–An error that occurred because too many requests were sent during a certain amount of time.
-
ValidationException–A validation exception for a field.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_pinpoint_sms_voice_v2/_services/async_pinpoint_sms_voice_v2.py
6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 | |