publish: Publish to a topic or endpoint

View source: R/publish.r

publishR Documentation

Publish to a topic or endpoint

Description

Publish a message to a specified topic or application endpoint.

Usage

publish(topic, endpoint, message, subject, ...)

Arguments

topic

Optionally, a character string containing an SNS Topic Amazon Resource Name (ARN). Must specify topic or endpoint.

endpoint

Optionally, a character string containing an SNS Application Endpoint ARN. Must specify topic or endpoint.

message

Either a single character string containing a message to be sent to all endpoints, or a named list of messages to be sent to specific endpoints (where the names of each element correspond to endpoints).

subject

Optionally, a character string containing a subject line (e.g., to be used for an email endpoint).

...

Additional arguments passed to snsHTTP.

Details

Publishes a message to a topic or an application endpoint. Messages can be the same for all endpoints or customized so that, for example, a short 140-character message is sent to SMS endpoints that are subscribed to a topic while longer messages are sent to email endpoints, etc. The allowed message types are: default, email, email-json, sqs, sms, http, https, and application.

Value

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

Author(s)

Thomas J. Leeper

References

Publish

Examples

## Not run: 
  top <- create_topic("new_topic")

  # simple notifications
  publish(top, message = "This is a notification message", subject = "Notification!")

  # endpoint-specific notification
  publish(top, message = list(sms = "This is an sms message", 
                              email = "This is an email"), 
          subject = "Notification!")

  delete_topic(top)

## End(Not run)


cloudyr/aws.sns documentation built on June 26, 2022, 4:04 a.m.