:doc:`PinpointSMSVoiceV2 <../../pinpoint-sms-voice-v2>` / Client / send_text_message

*****************
send_text_message
*****************



.. py:method:: PinpointSMSVoiceV2.Client.send_text_message(**kwargs)

  

  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 <https://docs.aws.amazon.com/sms-voice/latest/userguide/sms-limitations-mps.html>`__ in the *End User Messaging SMS User Guide*.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/pinpoint-sms-voice-v2-2022-03-31/SendTextMessage>`_  


  **Request Syntax**
  ::

    response = client.send_text_message(
        DestinationPhoneNumber='string',
        OriginationIdentity='string',
        MessageBody='string',
        MessageType='TRANSACTIONAL'|'PROMOTIONAL',
        Keyword='string',
        ConfigurationSetName='string',
        MaxPrice='string',
        TimeToLive=123,
        Context={
            'string': 'string'
        },
        DestinationCountryParameters={
            'string': 'string'
        },
        DryRun=True|False,
        ProtectConfigurationId='string',
        MessageFeedbackEnabled=True|False
    )
    
  :type DestinationPhoneNumber: string
  :param DestinationPhoneNumber: **[REQUIRED]** 

    The destination phone number in E.164 format.

    

  
  :type OriginationIdentity: string
  :param OriginationIdentity: 

    The origination identity of the message. This can be either the PhoneNumber, PhoneNumberId, PhoneNumberArn, SenderId, SenderIdArn, PoolId, or PoolArn.

     

    .. warning::

       

      If you are using a shared End User Messaging SMS resource then you must use the full Amazon Resource Name(ARN).

      

    

  
  :type MessageBody: string
  :param MessageBody: 

    The body of the text message.

    

  
  :type MessageType: string
  :param MessageType: 

    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.

    

  
  :type Keyword: string
  :param Keyword: 

    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.

    

  
  :type ConfigurationSetName: string
  :param ConfigurationSetName: 

    The name of the configuration set to use. This can be either the ConfigurationSetName or ConfigurationSetArn.

    

  
  :type MaxPrice: string
  :param MaxPrice: 

    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.

    

  
  :type TimeToLive: integer
  :param TimeToLive: 

    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_EXPIRED`` event.

    

  
  :type Context: dict
  :param Context: 

    You can specify custom data in this field. If you do, that data is logged to the event destination.

    

  
    - *(string) --* 

    
      - *(string) --* 

      


  :type DestinationCountryParameters: dict
  :param DestinationCountryParameters: 

    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 <https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-senderid-india.html>`__.

     

    
    * ``IN_ENTITY_ID`` The entity ID or Principal Entity (PE) ID that you received after completing the sender ID registration process.
     
    * ``IN_TEMPLATE_ID`` The template ID that you received after completing the sender ID registration process. 

    .. warning::

      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.

    
    

    

  
    - *(string) --* 

    
      - *(string) --* 

      


  :type DryRun: boolean
  :param DryRun: 

    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 ``DryRun`` is 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 <https://docs.aws.amazon.com/sms-voice/latest/userguide/sms-limitations-mps.html>`__ in the *End User Messaging SMS User Guide*..

    

  
  :type ProtectConfigurationId: string
  :param ProtectConfigurationId: 

    The unique identifier for the protect configuration.

    

  
  :type MessageFeedbackEnabled: boolean
  :param MessageFeedbackEnabled: 

    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.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'MessageId': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **MessageId** *(string) --* 

        The unique identifier for the message.

        
  
  **Exceptions**
  
  *   :py:class:`PinpointSMSVoiceV2.Client.exceptions.ServiceQuotaExceededException`

  
  *   :py:class:`PinpointSMSVoiceV2.Client.exceptions.ThrottlingException`

  
  *   :py:class:`PinpointSMSVoiceV2.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`PinpointSMSVoiceV2.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`PinpointSMSVoiceV2.Client.exceptions.ValidationException`

  
  *   :py:class:`PinpointSMSVoiceV2.Client.exceptions.ConflictException`

  
  *   :py:class:`PinpointSMSVoiceV2.Client.exceptions.InternalServerException`

  