PinpointSMSVoiceV2 / Client / request_phone_number

request_phone_number#

PinpointSMSVoiceV2.Client.request_phone_number(**kwargs)#

Request an origination phone number for use in your account. For more information on phone number request see Requesting a number in the Amazon Pinpoint User Guide.

See also: AWS API Documentation

Request Syntax

response = client.request_phone_number(
    IsoCountryCode='string',
    MessageType='TRANSACTIONAL'|'PROMOTIONAL',
    NumberCapabilities=[
        'SMS'|'VOICE',
    ],
    NumberType='LONG_CODE'|'TOLL_FREE'|'TEN_DLC'|'SIMULATOR',
    OptOutListName='string',
    PoolId='string',
    RegistrationId='string',
    DeletionProtectionEnabled=True|False,
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    ClientToken='string'
)
Parameters:
  • IsoCountryCode (string) –

    [REQUIRED]

    The two-character code, in ISO 3166-1 alpha-2 format, for the country or region.

  • MessageType (string) –

    [REQUIRED]

    The type of message. Valid values are TRANSACTIONAL for messages that are critical or time-sensitive and PROMOTIONAL for messages that aren’t critical or time-sensitive.

  • NumberCapabilities (list) –

    [REQUIRED]

    Indicates if the phone number will be used for text messages, voice messages, or both.

    • (string) –

  • NumberType (string) –

    [REQUIRED]

    The type of phone number to request.

  • OptOutListName (string) – The name of the OptOutList to associate with the phone number. You can use the OptOutListName or OptOutListArn.

  • PoolId (string) – The pool to associated with the phone number. You can use the PoolId or PoolArn.

  • RegistrationId (string) – Use this field to attach your phone number for an external registration process.

  • DeletionProtectionEnabled (boolean) – By default this is set to false. When set to true the phone number can’t be deleted.

  • Tags (list) –

    An array of tags (key and value pairs) associate with the requested phone number.

    • (dict) –

      The list of tags to be added to the specified topic.

      • Key (string) – [REQUIRED]

        The key identifier, or name, of the tag.

      • Value (string) – [REQUIRED]

        The string value associated with the key of the tag.

  • ClientToken (string) –

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you don’t specify a client token, a randomly generated token is used for the request to ensure idempotency.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'PhoneNumberArn': 'string',
    'PhoneNumberId': 'string',
    'PhoneNumber': 'string',
    'Status': 'PENDING'|'ACTIVE'|'ASSOCIATING'|'DISASSOCIATING'|'DELETED',
    'IsoCountryCode': 'string',
    'MessageType': 'TRANSACTIONAL'|'PROMOTIONAL',
    'NumberCapabilities': [
        'SMS'|'VOICE',
    ],
    'NumberType': 'LONG_CODE'|'TOLL_FREE'|'TEN_DLC'|'SIMULATOR',
    'MonthlyLeasingPrice': 'string',
    'TwoWayEnabled': True|False,
    'TwoWayChannelArn': 'string',
    'TwoWayChannelRole': 'string',
    'SelfManagedOptOutsEnabled': True|False,
    'OptOutListName': 'string',
    'DeletionProtectionEnabled': True|False,
    'PoolId': 'string',
    'RegistrationId': 'string',
    'Tags': [
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    'CreatedTimestamp': datetime(2015, 1, 1)
}

Response Structure

  • (dict) –

    • PhoneNumberArn (string) –

      The Amazon Resource Name (ARN) of the requested phone number.

    • PhoneNumberId (string) –

      The unique identifier of the new phone number.

    • PhoneNumber (string) –

      The new phone number that was requested.

    • Status (string) –

      The current status of the request.

    • IsoCountryCode (string) –

      The two-character code, in ISO 3166-1 alpha-2 format, for the country or region.

    • MessageType (string) –

      The type of message. Valid values are TRANSACTIONAL for messages that are critical or time-sensitive and PROMOTIONAL for messages that aren’t critical or time-sensitive.

    • NumberCapabilities (list) –

      Indicates if the phone number will be used for text messages, voice messages or both.

      • (string) –

    • NumberType (string) –

      The type of number that was released.

    • MonthlyLeasingPrice (string) –

      The monthly price, in US dollars, to lease the phone number.

    • TwoWayEnabled (boolean) –

      By default this is set to false. When set to true you can receive incoming text messages from your end recipients.

    • TwoWayChannelArn (string) –

      The ARN used to identify the two way channel.

    • TwoWayChannelRole (string) –

      An optional IAM Role Arn for a service to assume, to be able to post inbound SMS messages.

    • SelfManagedOptOutsEnabled (boolean) –

      By default this is set to false. When an end recipient sends a message that begins with HELP or STOP to one of your dedicated numbers, Amazon Pinpoint automatically replies with a customizable message and adds the end recipient to the OptOutList. When set to true you’re responsible for responding to HELP and STOP requests. You’re also responsible for tracking and honoring opt-out requests.

    • OptOutListName (string) –

      The name of the OptOutList that is associated with the requested phone number.

    • DeletionProtectionEnabled (boolean) –

      By default this is set to false. When set to true the phone number can’t be deleted.

    • PoolId (string) –

      The unique identifier of the pool associated with the phone number

    • RegistrationId (string) –

      The unique identifier for the registration.

    • Tags (list) –

      An array of key and value pair tags that are associated with the phone number.

      • (dict) –

        The list of tags to be added to the specified topic.

        • Key (string) –

          The key identifier, or name, of the tag.

        • Value (string) –

          The string value associated with the key of the tag.

    • CreatedTimestamp (datetime) –

      The time when the phone number was created, in UNIX epoch time format.

Exceptions

  • PinpointSMSVoiceV2.Client.exceptions.ServiceQuotaExceededException

  • PinpointSMSVoiceV2.Client.exceptions.ThrottlingException

  • PinpointSMSVoiceV2.Client.exceptions.AccessDeniedException

  • PinpointSMSVoiceV2.Client.exceptions.ResourceNotFoundException

  • PinpointSMSVoiceV2.Client.exceptions.ValidationException

  • PinpointSMSVoiceV2.Client.exceptions.ConflictException

  • PinpointSMSVoiceV2.Client.exceptions.InternalServerException