SNSClient
Auto-generated documentation for SNS type annotations stubs module types-aiobotocore-sns.
SNSClient
Type annotations and code completion for session.client("sns")
boto3 documentation
from aioboto3.session import Session
from types_aiobotocore_sns.client import SNSClient
session = Session()
async with session.client("sns") as client:
client: SNSClient
Exceptions
aioboto3
client exceptions are generated in runtime.
This class provides code completion for session.client("sns").exceptions
structure.
async with session.client("sns") as client:
try:
do_something(client)
except (
client.AuthorizationErrorException,
client.BatchEntryIdsNotDistinctException,
client.BatchRequestTooLongException,
client.ClientError,
client.ConcurrentAccessException,
client.EmptyBatchRequestException,
client.EndpointDisabledException,
client.FilterPolicyLimitExceededException,
client.InternalErrorException,
client.InvalidBatchEntryIdException,
client.InvalidParameterException,
client.InvalidParameterValueException,
client.InvalidSecurityException,
client.KMSAccessDeniedException,
client.KMSDisabledException,
client.KMSInvalidStateException,
client.KMSNotFoundException,
client.KMSOptInRequired,
client.KMSThrottlingException,
client.NotFoundException,
client.OptedOutException,
client.PlatformApplicationDisabledException,
client.ResourceNotFoundException,
client.StaleTagException,
client.SubscriptionLimitExceededException,
client.TagLimitExceededException,
client.TagPolicyException,
client.ThrottledException,
client.TooManyEntriesInBatchRequestException,
client.TopicLimitExceededException,
client.UserErrorException,
client.ValidationException,
client.VerificationException,
) as e:
print(e)
from types_aiobotocore_sns.client import Exceptions
def handle_error(exc: Exceptions.AuthorizationErrorException) -> None:
...
Methods
add_permission
Adds a statement to a topic's access control policy, granting access for the specified Amazon Web Services accounts to the specified actions.
Type annotations and code completion for session.client("sns").add_permission
method.
boto3 documentation
await def add_permission(
self,
*,
TopicArn: str,
Label: str,
AWSAccountId: Sequence[str],
ActionName: Sequence[str],
) -> EmptyResponseMetadataTypeDef: # (1)
...
kwargs: AddPermissionInputRequestTypeDef = { # (1)
"TopicArn": ...,
"Label": ...,
"AWSAccountId": ...,
"ActionName": ...,
}
parent.add_permission(**kwargs)
can_paginate
Check if an operation can be paginated.
Type annotations and code completion for session.client("sns").can_paginate
method.
boto3 documentation
check_if_phone_number_is_opted_out
Accepts a phone number and indicates whether the phone holder has opted out of receiving SMS messages from your Amazon Web Services account.
Type annotations and code completion for session.client("sns").check_if_phone_number_is_opted_out
method.
boto3 documentation
await def check_if_phone_number_is_opted_out(
self,
*,
phoneNumber: str,
) -> CheckIfPhoneNumberIsOptedOutResponseTypeDef: # (1)
...
kwargs: CheckIfPhoneNumberIsOptedOutInputRequestTypeDef = { # (1)
"phoneNumber": ...,
}
parent.check_if_phone_number_is_opted_out(**kwargs)
close
Closes underlying endpoint connections.
Type annotations and code completion for session.client("sns").close
method.
boto3 documentation
confirm_subscription
Verifies an endpoint owner's intent to receive messages by validating the token
sent to the endpoint by an earlier Subscribe
action.
Type annotations and code completion for session.client("sns").confirm_subscription
method.
boto3 documentation
await def confirm_subscription(
self,
*,
TopicArn: str,
Token: str,
AuthenticateOnUnsubscribe: str = ...,
) -> ConfirmSubscriptionResponseTypeDef: # (1)
...
kwargs: ConfirmSubscriptionInputRequestTypeDef = { # (1)
"TopicArn": ...,
"Token": ...,
}
parent.confirm_subscription(**kwargs)
create_platform_application
Creates a platform application object for one of the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging), to which devices and mobile apps may register.
Type annotations and code completion for session.client("sns").create_platform_application
method.
boto3 documentation
await def create_platform_application(
self,
*,
Name: str,
Platform: str,
Attributes: Mapping[str, str],
) -> CreatePlatformApplicationResponseTypeDef: # (1)
...
kwargs: CreatePlatformApplicationInputRequestTypeDef = { # (1)
"Name": ...,
"Platform": ...,
"Attributes": ...,
}
parent.create_platform_application(**kwargs)
create_platform_endpoint
Creates an endpoint for a device and mobile app on one of the supported push notification services, such as GCM (Firebase Cloud Messaging) and APNS.
Type annotations and code completion for session.client("sns").create_platform_endpoint
method.
boto3 documentation
await def create_platform_endpoint(
self,
*,
PlatformApplicationArn: str,
Token: str,
CustomUserData: str = ...,
Attributes: Mapping[str, str] = ...,
) -> CreateEndpointResponseTypeDef: # (1)
...
kwargs: CreatePlatformEndpointInputRequestTypeDef = { # (1)
"PlatformApplicationArn": ...,
"Token": ...,
}
parent.create_platform_endpoint(**kwargs)
create_sms_sandbox_phone_number
Adds a destination phone number to an Amazon Web Services account in the SMS sandbox and sends a one-time password (OTP) to that phone number.
Type annotations and code completion for session.client("sns").create_sms_sandbox_phone_number
method.
boto3 documentation
await def create_sms_sandbox_phone_number(
self,
*,
PhoneNumber: str,
LanguageCode: LanguageCodeStringType = ..., # (1)
) -> Dict[str, Any]:
...
kwargs: CreateSMSSandboxPhoneNumberInputRequestTypeDef = { # (1)
"PhoneNumber": ...,
}
parent.create_sms_sandbox_phone_number(**kwargs)
create_topic
Creates a topic to which notifications can be published.
Type annotations and code completion for session.client("sns").create_topic
method.
boto3 documentation
await def create_topic(
self,
*,
Name: str,
Attributes: Mapping[str, str] = ...,
Tags: Sequence[TagTypeDef] = ..., # (1)
) -> CreateTopicResponseTypeDef: # (2)
...
- See TagTypeDef
- See CreateTopicResponseTypeDef
kwargs: CreateTopicInputRequestTypeDef = { # (1)
"Name": ...,
}
parent.create_topic(**kwargs)
delete_endpoint
Deletes the endpoint for a device and mobile app from Amazon SNS.
Type annotations and code completion for session.client("sns").delete_endpoint
method.
boto3 documentation
await def delete_endpoint(
self,
*,
EndpointArn: str,
) -> EmptyResponseMetadataTypeDef: # (1)
...
kwargs: DeleteEndpointInputRequestTypeDef = { # (1)
"EndpointArn": ...,
}
parent.delete_endpoint(**kwargs)
delete_platform_application
Deletes a platform application object for one of the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging).
Type annotations and code completion for session.client("sns").delete_platform_application
method.
boto3 documentation
await def delete_platform_application(
self,
*,
PlatformApplicationArn: str,
) -> EmptyResponseMetadataTypeDef: # (1)
...
kwargs: DeletePlatformApplicationInputRequestTypeDef = { # (1)
"PlatformApplicationArn": ...,
}
parent.delete_platform_application(**kwargs)
delete_sms_sandbox_phone_number
Deletes an Amazon Web Services account's verified or pending phone number from the SMS sandbox.
Type annotations and code completion for session.client("sns").delete_sms_sandbox_phone_number
method.
boto3 documentation
await def delete_sms_sandbox_phone_number(
self,
*,
PhoneNumber: str,
) -> Dict[str, Any]:
...
kwargs: DeleteSMSSandboxPhoneNumberInputRequestTypeDef = { # (1)
"PhoneNumber": ...,
}
parent.delete_sms_sandbox_phone_number(**kwargs)
delete_topic
Deletes a topic and all its subscriptions.
Type annotations and code completion for session.client("sns").delete_topic
method.
boto3 documentation
await def delete_topic(
self,
*,
TopicArn: str,
) -> EmptyResponseMetadataTypeDef: # (1)
...
kwargs: DeleteTopicInputRequestTypeDef = { # (1)
"TopicArn": ...,
}
parent.delete_topic(**kwargs)
generate_presigned_url
Generate a presigned url given a client, its method, and arguments.
Type annotations and code completion for session.client("sns").generate_presigned_url
method.
boto3 documentation
await def generate_presigned_url(
self,
ClientMethod: str,
Params: Mapping[str, Any] = ...,
ExpiresIn: int = 3600,
HttpMethod: str = ...,
) -> str:
...
get_endpoint_attributes
Retrieves the endpoint attributes for a device on one of the supported push notification services, such as GCM (Firebase Cloud Messaging) and APNS.
Type annotations and code completion for session.client("sns").get_endpoint_attributes
method.
boto3 documentation
await def get_endpoint_attributes(
self,
*,
EndpointArn: str,
) -> GetEndpointAttributesResponseTypeDef: # (1)
...
kwargs: GetEndpointAttributesInputRequestTypeDef = { # (1)
"EndpointArn": ...,
}
parent.get_endpoint_attributes(**kwargs)
get_platform_application_attributes
Retrieves the attributes of the platform application object for the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging).
Type annotations and code completion for session.client("sns").get_platform_application_attributes
method.
boto3 documentation
await def get_platform_application_attributes(
self,
*,
PlatformApplicationArn: str,
) -> GetPlatformApplicationAttributesResponseTypeDef: # (1)
...
kwargs: GetPlatformApplicationAttributesInputRequestTypeDef = { # (1)
"PlatformApplicationArn": ...,
}
parent.get_platform_application_attributes(**kwargs)
get_sms_attributes
Returns the settings for sending SMS messages from your Amazon Web Services account.
Type annotations and code completion for session.client("sns").get_sms_attributes
method.
boto3 documentation
await def get_sms_attributes(
self,
*,
attributes: Sequence[str] = ...,
) -> GetSMSAttributesResponseTypeDef: # (1)
...
kwargs: GetSMSAttributesInputRequestTypeDef = { # (1)
"attributes": ...,
}
parent.get_sms_attributes(**kwargs)
get_sms_sandbox_account_status
Retrieves the SMS sandbox status for the calling Amazon Web Services account in the target Amazon Web Services Region.
Type annotations and code completion for session.client("sns").get_sms_sandbox_account_status
method.
boto3 documentation
await def get_sms_sandbox_account_status(
self,
) -> GetSMSSandboxAccountStatusResultTypeDef: # (1)
...
get_subscription_attributes
Returns all of the properties of a subscription.
Type annotations and code completion for session.client("sns").get_subscription_attributes
method.
boto3 documentation
await def get_subscription_attributes(
self,
*,
SubscriptionArn: str,
) -> GetSubscriptionAttributesResponseTypeDef: # (1)
...
kwargs: GetSubscriptionAttributesInputRequestTypeDef = { # (1)
"SubscriptionArn": ...,
}
parent.get_subscription_attributes(**kwargs)
get_topic_attributes
Returns all of the properties of a topic.
Type annotations and code completion for session.client("sns").get_topic_attributes
method.
boto3 documentation
await def get_topic_attributes(
self,
*,
TopicArn: str,
) -> GetTopicAttributesResponseTypeDef: # (1)
...
kwargs: GetTopicAttributesInputRequestTypeDef = { # (1)
"TopicArn": ...,
}
parent.get_topic_attributes(**kwargs)
list_endpoints_by_platform_application
Lists the endpoints and endpoint attributes for devices in a supported push notification service, such as GCM (Firebase Cloud Messaging) and APNS.
Type annotations and code completion for session.client("sns").list_endpoints_by_platform_application
method.
boto3 documentation
await def list_endpoints_by_platform_application(
self,
*,
PlatformApplicationArn: str,
NextToken: str = ...,
) -> ListEndpointsByPlatformApplicationResponseTypeDef: # (1)
...
kwargs: ListEndpointsByPlatformApplicationInputRequestTypeDef = { # (1)
"PlatformApplicationArn": ...,
}
parent.list_endpoints_by_platform_application(**kwargs)
list_origination_numbers
Lists the calling Amazon Web Services account's dedicated origination numbers and their metadata.
Type annotations and code completion for session.client("sns").list_origination_numbers
method.
boto3 documentation
await def list_origination_numbers(
self,
*,
NextToken: str = ...,
MaxResults: int = ...,
) -> ListOriginationNumbersResultTypeDef: # (1)
...
kwargs: ListOriginationNumbersRequestRequestTypeDef = { # (1)
"NextToken": ...,
}
parent.list_origination_numbers(**kwargs)
list_phone_numbers_opted_out
Returns a list of phone numbers that are opted out, meaning you cannot send SMS messages to them.
Type annotations and code completion for session.client("sns").list_phone_numbers_opted_out
method.
boto3 documentation
await def list_phone_numbers_opted_out(
self,
*,
nextToken: str = ...,
) -> ListPhoneNumbersOptedOutResponseTypeDef: # (1)
...
kwargs: ListPhoneNumbersOptedOutInputRequestTypeDef = { # (1)
"nextToken": ...,
}
parent.list_phone_numbers_opted_out(**kwargs)
list_platform_applications
Lists the platform application objects for the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging).
Type annotations and code completion for session.client("sns").list_platform_applications
method.
boto3 documentation
await def list_platform_applications(
self,
*,
NextToken: str = ...,
) -> ListPlatformApplicationsResponseTypeDef: # (1)
...
kwargs: ListPlatformApplicationsInputRequestTypeDef = { # (1)
"NextToken": ...,
}
parent.list_platform_applications(**kwargs)
list_sms_sandbox_phone_numbers
Lists the calling Amazon Web Services account's current verified and pending destination phone numbers in the SMS sandbox.
Type annotations and code completion for session.client("sns").list_sms_sandbox_phone_numbers
method.
boto3 documentation
await def list_sms_sandbox_phone_numbers(
self,
*,
NextToken: str = ...,
MaxResults: int = ...,
) -> ListSMSSandboxPhoneNumbersResultTypeDef: # (1)
...
kwargs: ListSMSSandboxPhoneNumbersInputRequestTypeDef = { # (1)
"NextToken": ...,
}
parent.list_sms_sandbox_phone_numbers(**kwargs)
list_subscriptions
Returns a list of the requester's subscriptions.
Type annotations and code completion for session.client("sns").list_subscriptions
method.
boto3 documentation
await def list_subscriptions(
self,
*,
NextToken: str = ...,
) -> ListSubscriptionsResponseTypeDef: # (1)
...
kwargs: ListSubscriptionsInputRequestTypeDef = { # (1)
"NextToken": ...,
}
parent.list_subscriptions(**kwargs)
list_subscriptions_by_topic
Returns a list of the subscriptions to a specific topic.
Type annotations and code completion for session.client("sns").list_subscriptions_by_topic
method.
boto3 documentation
await def list_subscriptions_by_topic(
self,
*,
TopicArn: str,
NextToken: str = ...,
) -> ListSubscriptionsByTopicResponseTypeDef: # (1)
...
kwargs: ListSubscriptionsByTopicInputRequestTypeDef = { # (1)
"TopicArn": ...,
}
parent.list_subscriptions_by_topic(**kwargs)
list_tags_for_resource
List all tags added to the specified Amazon SNS topic.
Type annotations and code completion for session.client("sns").list_tags_for_resource
method.
boto3 documentation
await def list_tags_for_resource(
self,
*,
ResourceArn: str,
) -> ListTagsForResourceResponseTypeDef: # (1)
...
kwargs: ListTagsForResourceRequestRequestTypeDef = { # (1)
"ResourceArn": ...,
}
parent.list_tags_for_resource(**kwargs)
list_topics
Returns a list of the requester's topics.
Type annotations and code completion for session.client("sns").list_topics
method.
boto3 documentation
await def list_topics(
self,
*,
NextToken: str = ...,
) -> ListTopicsResponseTypeDef: # (1)
...
kwargs: ListTopicsInputRequestTypeDef = { # (1)
"NextToken": ...,
}
parent.list_topics(**kwargs)
opt_in_phone_number
Use this request to opt in a phone number that is opted out, which enables you to resume sending SMS messages to the number.
Type annotations and code completion for session.client("sns").opt_in_phone_number
method.
boto3 documentation
kwargs: OptInPhoneNumberInputRequestTypeDef = { # (1)
"phoneNumber": ...,
}
parent.opt_in_phone_number(**kwargs)
publish
Sends a message to an Amazon SNS topic, a text message (SMS message) directly to
a phone number, or a message to a mobile platform endpoint (when you specify the
TargetArn
).
Type annotations and code completion for session.client("sns").publish
method.
boto3 documentation
await def publish(
self,
*,
Message: str,
TopicArn: str = ...,
TargetArn: str = ...,
PhoneNumber: str = ...,
Subject: str = ...,
MessageStructure: str = ...,
MessageAttributes: Mapping[str, MessageAttributeValueTypeDef] = ..., # (1)
MessageDeduplicationId: str = ...,
MessageGroupId: str = ...,
) -> PublishResponseTypeDef: # (2)
...
kwargs: PublishInputRequestTypeDef = { # (1)
"Message": ...,
}
parent.publish(**kwargs)
publish_batch
Publishes up to ten messages to the specified topic.
Type annotations and code completion for session.client("sns").publish_batch
method.
boto3 documentation
await def publish_batch(
self,
*,
TopicArn: str,
PublishBatchRequestEntries: Sequence[PublishBatchRequestEntryTypeDef], # (1)
) -> PublishBatchResponseTypeDef: # (2)
...
kwargs: PublishBatchInputRequestTypeDef = { # (1)
"TopicArn": ...,
"PublishBatchRequestEntries": ...,
}
parent.publish_batch(**kwargs)
remove_permission
Removes a statement from a topic's access control policy.
Type annotations and code completion for session.client("sns").remove_permission
method.
boto3 documentation
await def remove_permission(
self,
*,
TopicArn: str,
Label: str,
) -> EmptyResponseMetadataTypeDef: # (1)
...
kwargs: RemovePermissionInputRequestTypeDef = { # (1)
"TopicArn": ...,
"Label": ...,
}
parent.remove_permission(**kwargs)
set_endpoint_attributes
Sets the attributes for an endpoint for a device on one of the supported push notification services, such as GCM (Firebase Cloud Messaging) and APNS.
Type annotations and code completion for session.client("sns").set_endpoint_attributes
method.
boto3 documentation
await def set_endpoint_attributes(
self,
*,
EndpointArn: str,
Attributes: Mapping[str, str],
) -> EmptyResponseMetadataTypeDef: # (1)
...
kwargs: SetEndpointAttributesInputRequestTypeDef = { # (1)
"EndpointArn": ...,
"Attributes": ...,
}
parent.set_endpoint_attributes(**kwargs)
set_platform_application_attributes
Sets the attributes of the platform application object for the supported push notification services, such as APNS and GCM (Firebase Cloud Messaging).
Type annotations and code completion for session.client("sns").set_platform_application_attributes
method.
boto3 documentation
await def set_platform_application_attributes(
self,
*,
PlatformApplicationArn: str,
Attributes: Mapping[str, str],
) -> EmptyResponseMetadataTypeDef: # (1)
...
kwargs: SetPlatformApplicationAttributesInputRequestTypeDef = { # (1)
"PlatformApplicationArn": ...,
"Attributes": ...,
}
parent.set_platform_application_attributes(**kwargs)
set_sms_attributes
Use this request to set the default settings for sending SMS messages and receiving daily SMS usage reports.
Type annotations and code completion for session.client("sns").set_sms_attributes
method.
boto3 documentation
await def set_sms_attributes(
self,
*,
attributes: Mapping[str, str],
) -> Dict[str, Any]:
...
kwargs: SetSMSAttributesInputRequestTypeDef = { # (1)
"attributes": ...,
}
parent.set_sms_attributes(**kwargs)
set_subscription_attributes
Allows a subscription owner to set an attribute of the subscription to a new value.
Type annotations and code completion for session.client("sns").set_subscription_attributes
method.
boto3 documentation
await def set_subscription_attributes(
self,
*,
SubscriptionArn: str,
AttributeName: str,
AttributeValue: str = ...,
) -> EmptyResponseMetadataTypeDef: # (1)
...
kwargs: SetSubscriptionAttributesInputRequestTypeDef = { # (1)
"SubscriptionArn": ...,
"AttributeName": ...,
}
parent.set_subscription_attributes(**kwargs)
set_topic_attributes
Allows a topic owner to set an attribute of the topic to a new value.
Type annotations and code completion for session.client("sns").set_topic_attributes
method.
boto3 documentation
await def set_topic_attributes(
self,
*,
TopicArn: str,
AttributeName: str,
AttributeValue: str = ...,
) -> EmptyResponseMetadataTypeDef: # (1)
...
kwargs: SetTopicAttributesInputRequestTypeDef = { # (1)
"TopicArn": ...,
"AttributeName": ...,
}
parent.set_topic_attributes(**kwargs)
subscribe
Subscribes an endpoint to an Amazon SNS topic.
Type annotations and code completion for session.client("sns").subscribe
method.
boto3 documentation
await def subscribe(
self,
*,
TopicArn: str,
Protocol: str,
Endpoint: str = ...,
Attributes: Mapping[str, str] = ...,
ReturnSubscriptionArn: bool = ...,
) -> SubscribeResponseTypeDef: # (1)
...
kwargs: SubscribeInputRequestTypeDef = { # (1)
"TopicArn": ...,
"Protocol": ...,
}
parent.subscribe(**kwargs)
tag_resource
Add tags to the specified Amazon SNS topic.
Type annotations and code completion for session.client("sns").tag_resource
method.
boto3 documentation
await def tag_resource(
self,
*,
ResourceArn: str,
Tags: Sequence[TagTypeDef], # (1)
) -> Dict[str, Any]:
...
- See TagTypeDef
kwargs: TagResourceRequestRequestTypeDef = { # (1)
"ResourceArn": ...,
"Tags": ...,
}
parent.tag_resource(**kwargs)
unsubscribe
Deletes a subscription.
Type annotations and code completion for session.client("sns").unsubscribe
method.
boto3 documentation
await def unsubscribe(
self,
*,
SubscriptionArn: str,
) -> EmptyResponseMetadataTypeDef: # (1)
...
kwargs: UnsubscribeInputRequestTypeDef = { # (1)
"SubscriptionArn": ...,
}
parent.unsubscribe(**kwargs)
untag_resource
Remove tags from the specified Amazon SNS topic.
Type annotations and code completion for session.client("sns").untag_resource
method.
boto3 documentation
await def untag_resource(
self,
*,
ResourceArn: str,
TagKeys: Sequence[str],
) -> Dict[str, Any]:
...
kwargs: UntagResourceRequestRequestTypeDef = { # (1)
"ResourceArn": ...,
"TagKeys": ...,
}
parent.untag_resource(**kwargs)
verify_sms_sandbox_phone_number
Verifies a destination phone number with a one-time password (OTP) for the calling Amazon Web Services account.
Type annotations and code completion for session.client("sns").verify_sms_sandbox_phone_number
method.
boto3 documentation
await def verify_sms_sandbox_phone_number(
self,
*,
PhoneNumber: str,
OneTimePassword: str,
) -> Dict[str, Any]:
...
kwargs: VerifySMSSandboxPhoneNumberInputRequestTypeDef = { # (1)
"PhoneNumber": ...,
"OneTimePassword": ...,
}
parent.verify_sms_sandbox_phone_number(**kwargs)
__aenter__
Type annotations and code completion for session.client("sns").__aenter__
method.
boto3 documentation
__aexit__
Type annotations and code completion for session.client("sns").__aexit__
method.
boto3 documentation
get_paginator
Type annotations and code completion for session.client("sns").get_paginator
method with overloads.
client.get_paginator("list_endpoints_by_platform_application")
-> ListEndpointsByPlatformApplicationPaginatorclient.get_paginator("list_origination_numbers")
-> ListOriginationNumbersPaginatorclient.get_paginator("list_phone_numbers_opted_out")
-> ListPhoneNumbersOptedOutPaginatorclient.get_paginator("list_platform_applications")
-> ListPlatformApplicationsPaginatorclient.get_paginator("list_sms_sandbox_phone_numbers")
-> ListSMSSandboxPhoneNumbersPaginatorclient.get_paginator("list_subscriptions")
-> ListSubscriptionsPaginatorclient.get_paginator("list_subscriptions_by_topic")
-> ListSubscriptionsByTopicPaginatorclient.get_paginator("list_topics")
-> ListTopicsPaginator