phone_numbers
Creates, updates, deletes, gets or lists a phone_numbers resource.
Overview
| Name | phone_numbers |
| Type | Resource |
| Id | aws.pinpoint_sms_voice_v2.phone_numbers |
Fields
The following fields are returned by SELECT queries:
- describe_phone_numbers
| Name | Datatype | Description |
|---|---|---|
created_timestamp | string (date-time) | The time when the phone number was created, in UNIX epoch time format. |
deletion_protection_enabled | boolean | When set to true the phone number can't be deleted. |
international_sending_enabled | boolean | When set to true the international sending of phone number is Enabled. |
iso_country_code | string | The two-character code, in ISO 3166-1 alpha-2 format, for the country or region. (pattern: <code>[A-Z]{2}</code>) |
message_type | 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. (TRANSACTIONAL, PROMOTIONAL) |
monthly_leasing_price | string | The price, in US dollars, to lease the phone number. |
number_capabilities | array | Describes if the origination identity can be used for text messages, voice calls or both. |
number_type | string | The type of phone number. (SHORT_CODE, LONG_CODE, TOLL_FREE, TEN_DLC, SIMULATOR) |
opt_out_list_name | string | The name of the OptOutList associated with the phone number. (pattern: <code>[A-Za-z0-9_-]+</code>) |
phone_number | string | The phone number in E.164 format. (pattern: <code>+?[1-9][0-9]{1,18}</code>) |
phone_number_arn | string | The Amazon Resource Name (ARN) associated with the phone number. |
phone_number_id | string | The unique identifier for the phone number. |
pool_id | string | The unique identifier of the pool associated with the phone number. |
registration_id | string | The unique identifier for the registration. |
self_managed_opt_outs_enabled | boolean | When 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 |
status | string | The current status of the phone number. (PENDING, ACTIVE, ASSOCIATING, DISASSOCIATING, DELETED) |
two_way_channel_arn | string | The Amazon Resource Name (ARN) of the two way channel. (pattern: <code>\S+</code>) |
two_way_channel_role | string | An optional IAM Role Arn for a service to assume, to be able to post inbound SMS messages. (pattern: <code>arn:\S+</code>) |
two_way_enabled | boolean | By 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_phone_numbers | select | region | 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. | |
release_phone_number | update | region, PhoneNumberId | 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_phone_number | exec | region, PhoneNumberId | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- describe_phone_numbers
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
- release_phone_number
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
- update_phone_number
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 }}
}'
;