SNSClient.subscribe
rboto-sns==0.4.0 · Service index · Types
Model summary (excerpt): Subscribes an endpoint to an Amazon SNS topic. If the endpoint type is HTTP/S or email, or if the endpoint and the topic are not in the same Amazon Web Services account, the endpoint owner must run the ConfirmSubscription action to confirm the subscription. You call the ConfirmSubscription action with the token from the subscription response. Confirmation tokens are valid for two days. This...
Install and imports
Signature
async def subscribe(
*,
topic_arn: str,
protocol: str,
endpoint: str | None = None,
attributes: dict[str, str] | None = None,
return_subscription_arn: bool | None = None,
) -> SubscribeOutput: ...
Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.
Arguments
| Argument | Required | Model notes (excerpt) |
|---|---|---|
topic_arn |
Yes | The ARN of the topic you want to subscribe to. |
protocol |
Yes | The protocol that you want to use. Supported protocols include: http – delivery of JSON-encoded message via HTTP POST https – delivery of JSON-encoded message via HTTPS POST email – delivery of message via SMTP email-json – delivery of JSON-encoded message via SMTP sms – delivery of message via SMS sqs – delivery of JSON-encoded message to an Amazon SQS queue application – delivery of... |
endpoint |
No | The endpoint that you want to receive notifications. Endpoints vary by protocol: For the http protocol, the (public) endpoint is a URL beginning with http:// . For the https protocol, the (public) endpoint is a URL beginning with https:// . For the email protocol, the endpoint is an email address. For the email-json protocol, the endpoint is an email address. For the sms protocol, the endpoint... |
attributes |
No | A map of attributes with their corresponding values. The following lists the names, descriptions, and values of the special request parameters that the Subscribe action uses: DeliveryPolicy – The policy that defines how Amazon SNS retries failed deliveries to HTTP/S endpoints. FilterPolicy – The simple JSON object that lets your subscriber receive only a subset of messages, rather than... |
return_subscription_arn |
No | Sets whether the response from the Subscribe request includes the subscription ARN, even if the subscription is not yet confirmed. If you set this parameter to true , the response includes the ARN in all cases, even if the subscription is not yet confirmed. In addition to the ARN for confirmed subscriptions, the response also includes the pending subscription ARN value for subscriptions that... |
Output
SubscribeOutput.
Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.
| Field | Type | Presence | References |
|---|---|---|---|
subscription_arn |
str | None |
Always present | — |
| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.
Related types
Follow these links for nested inputs and outputs; recursive types link back to the same type page.
Pagination and streaming
No generated paginator for this operation.
No output stream.
Errors
Import from rboto_sns.exceptions:
AuthorizationError, FilterPolicyLimitExceededError, InternalError, InvalidParameterError, InvalidSecurityError, NotFoundError, ReplayLimitExceededError, SubscriptionLimitExceededError.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.