Learn R Programming

aws.sns (version 0.1.7)

subscribe: Subscribe/Unsubscribe to a topic

Description

Subscribes an endpoint to the specified SNS topic.

Usage

subscribe(topic, endpoint, protocol, ...)

unsubscribe(subscription, ...)

Arguments

topic

A character string containing an SNS Topic Amazon Resource Name (ARN).

endpoint

A character string containing the endpoint to be subscribed (e.g., an email address).

protocol

The allowed protocol types are: default, email, email-json, sqs, sms, http, https, and application.

...

Additional arguments passed to snsHTTP.

subscription

A character string containing an SNS Subscription Amazon Resource Name (ARN).

Value

If successful, a character string containing a subscription ARN. Otherwise, a data structure of class “aws_error” containing any error message(s) from AWS and information about the request attempt.

Details

subscribe initiates a subscription of an endpoint to an SNS topic. For example, this is used to add an email address endpoint to a topic. Subscriptions need to be confirmed by the endpoint. For example, an SMS endpoint will require an SMS response to an subscription invitation message. Subscriptions can be removed using unsubscribe (or whatever method is described in the invitation message); thus subscriptions can be handled by both users and administrator (you).

unsubscribe unsubscribes an endpoint from an SNS topic.

References

Subscribe Unsubscribe

See Also

list_subscriptions

Examples

Run this code

  top <- create_topic("new_topic")
  # email subscription
  subscribe(top, "example@example.com", protocol = "email")

  # sms subscription
  subscribe(top, "555-123-4567", protocol = "sms")

  delete_topic(top)


Run the code above in your browser using DataLab