publish: Publish to a topic or endpoint

Description Usage Arguments Details Value Author(s) References Examples

View source: R/publish.R

Description

Publish a message to a specified topic or application endpoint.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## 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)

aws.sns documentation built on May 2, 2019, 9:31 a.m.