Skip to main content

phone_numbers

Creates, updates, deletes, gets or lists a phone_numbers resource.

Overview

Namephone_numbers
TypeResource
Idaws.pinpoint_sms_voice_v2.phone_numbers

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
created_timestampstring (date-time)The time when the phone number was created, in UNIX epoch time format.
deletion_protection_enabledbooleanWhen set to true the phone number can't be deleted.
international_sending_enabledbooleanWhen set to true the international sending of phone number is Enabled.
iso_country_codestringThe two-character code, in ISO 3166-1 alpha-2 format, for the country or region. (pattern: <code>[A-Z]{2}</code>)
message_typestringThe 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. (TRANSACTIONAL, PROMOTIONAL)
monthly_leasing_pricestringThe price, in US dollars, to lease the phone number.
number_capabilitiesarrayDescribes if the origination identity can be used for text messages, voice calls or both.
number_typestringThe type of phone number. (SHORT_CODE, LONG_CODE, TOLL_FREE, TEN_DLC, SIMULATOR)
opt_out_list_namestringThe name of the OptOutList associated with the phone number. (pattern: <code>[A-Za-z0-9_-]+</code>)
phone_numberstringThe phone number in E.164 format. (pattern: <code>+?[1-9][0-9]{1,18}</code>)
phone_number_arnstringThe Amazon Resource Name (ARN) associated with the phone number.
phone_number_idstringThe unique identifier for the phone number.
pool_idstringThe unique identifier of the pool associated with the phone number.
registration_idstringThe unique identifier for the registration.
self_managed_opt_outs_enabledbooleanWhen set to false and an end recipient sends a message that begins with HELP or STOP to one of your dedicated numbers, End User Messaging SMS 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 request. For more information see Self-managed opt-outs
statusstringThe current status of the phone number. (PENDING, ACTIVE, ASSOCIATING, DISASSOCIATING, DELETED)
two_way_channel_arnstringThe Amazon Resource Name (ARN) of the two way channel. (pattern: <code>\S+</code>)
two_way_channel_rolestringAn optional IAM Role Arn for a service to assume, to be able to post inbound SMS messages. (pattern: <code>arn:\S+</code>)
two_way_enabledbooleanBy default this is set to false. When set to true you can receive incoming text messages from your end recipients using the TwoWayChannelArn.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_phone_numbersselectregionDescribes the specified origination phone number, or all the phone numbers in your account. If you specify phone number IDs, the output includes information for only the specified phone numbers. If you specify filters, the output includes information for only those phone numbers that meet the filter criteria. If you don't specify phone number IDs or filters, the output includes information for all phone numbers. If you specify a phone number ID that isn't valid, an error is returned.
release_phone_numberupdateregion, PhoneNumberIdReleases an existing origination phone number in your account. Once released, a phone number is no longer available for sending messages. If the origination phone number has deletion protection enabled or is associated with a pool, an error is returned.
update_phone_numberexecregion, PhoneNumberIdUpdates the configuration of an existing origination phone number. You can update the opt-out list, enable or disable two-way messaging, change the TwoWayChannelArn, enable or disable self-managed opt-outs, and enable or disable deletion protection. If the origination phone number is associated with a pool, an error is returned.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Describes the specified origination phone number, or all the phone numbers in your account. If you specify phone number IDs, the output includes information for only the specified phone numbers. If you specify filters, the output includes information for only those phone numbers that meet the filter criteria. If you don't specify phone number IDs or filters, the output includes information for all phone numbers. If you specify a phone number ID that isn't valid, an error is returned.

SELECT
created_timestamp,
deletion_protection_enabled,
international_sending_enabled,
iso_country_code,
message_type,
monthly_leasing_price,
number_capabilities,
number_type,
opt_out_list_name,
phone_number,
phone_number_arn,
phone_number_id,
pool_id,
registration_id,
self_managed_opt_outs_enabled,
status,
two_way_channel_arn,
two_way_channel_role,
two_way_enabled
FROM aws.pinpoint_sms_voice_v2.phone_numbers
WHERE region = '{{ region }}' -- required
;

UPDATE examples

Releases an existing origination phone number in your account. Once released, a phone number is no longer available for sending messages. If the origination phone number has deletion protection enabled or is associated with a pool, an error is returned.

UPDATE aws.pinpoint_sms_voice_v2.phone_numbers
SET
PhoneNumberId = '{{ PhoneNumberId }}'
WHERE
region = '{{ region }}' --required
AND PhoneNumberId = '{{ PhoneNumberId }}' --required
RETURNING
created_timestamp,
iso_country_code,
message_type,
monthly_leasing_price,
number_capabilities,
number_type,
opt_out_list_name,
phone_number,
phone_number_arn,
phone_number_id,
registration_id,
self_managed_opt_outs_enabled,
status,
two_way_channel_arn,
two_way_channel_role,
two_way_enabled;

Lifecycle Methods

Updates the configuration of an existing origination phone number. You can update the opt-out list, enable or disable two-way messaging, change the TwoWayChannelArn, enable or disable self-managed opt-outs, and enable or disable deletion protection. If the origination phone number is associated with a pool, an error is returned.

EXEC aws.pinpoint_sms_voice_v2.phone_numbers.update_phone_number
@region='{{ region }}' --required
@@json=
'{
"PhoneNumberId": "{{ PhoneNumberId }}",
"TwoWayEnabled": {{ TwoWayEnabled }},
"TwoWayChannelArn": "{{ TwoWayChannelArn }}",
"TwoWayChannelRole": "{{ TwoWayChannelRole }}",
"SelfManagedOptOutsEnabled": {{ SelfManagedOptOutsEnabled }},
"OptOutListName": "{{ OptOutListName }}",
"InternationalSendingEnabled": {{ InternationalSendingEnabled }},
"DeletionProtectionEnabled": {{ DeletionProtectionEnabled }}
}'
;