On this page:
sns-endpoint
create-topic
delete-topic
get-topic-attributes
list-topics
subscription
list-subscriptions
list-subscriptions-by-topic
sns-protocol?
subscribe
unsubscribe
publish

8 SNS (Notifications)

 (require (planet gh/aws:1:=4/sns))

SNS lets you create topics to which notifications can be published. Each topic has zero or more subscriptions.

Subscriptions can be of various types of endpoints, such as email, SMS, or an HTTP POST of a JSON-encoded message.

A new subscription must be confirmed by the recipient before it will receive notifications, to prevent unwanted notifications.

Topics and subscriptions are unqiuely identified by a string referred to as an ARN (Amazon Resource Name). The string is composed of the service endpoint hostname, your AWS account number, and a name. An example ARN is arn:aws:sns:us-east-1:123456789012:My-Topic.

parameter

(sns-endpoint)  endpoint?

(sns-endpoint v)  void?
  v : endpoint?
Set the endpoint for the service. Defaults to (endpoint "sns.us-east-1.amazonaws.com" #f).

procedure

(create-topic name)  string?

  name : string?
Create a topic and return its ARN.

procedure

(delete-topic arn)  void?

  arn : string?
Delete a topic.

procedure

(get-topic-attributes arn)  (listof (cons/c symbol? string?))

  arn : string?
Get the attributes for a topic as an association list.

procedure

(list-topics)  (listof string?)

Get the ARN for all SNS topics for the AWS account.

struct

(struct subscription (protocol
    owner
    topic-arn
    subscription-arn
    endpoint)
  #:extra-constructor-name make-subscription)
  protocol : string?
  owner : string?
  topic-arn : string?
  subscription-arn : string?
  endpoint : string?

procedure

(list-subscriptions)  (listof subscription?)

procedure

(list-subscriptions-by-topic arn)  (listof subscription?)

  arn : string?
Get subscriptions for all topic, or just those for a given topic.

procedure

(sns-protocol? s)  boolean?

  s : string?

procedure

(subscribe endpoint protocol topic-arn)  string?

  endpoint : string?
  protocol : sns-protocol?
  topic-arn : string?
Subscribe to a topic, returning the ARN for the subscription.

procedure

(unsubscribe subscription-arn)  void?

  subscription-arn : string?
Delete a subscription.

procedure

(publish topic-arn    
  message    
  #:subject subject    
  #:json? json?)  void?
  topic-arn : string?
  message : string?
  subject : ""
  json? : #f
Publish a notification message to a topic. If #:json? is #t then message must be valid JSON or SNS will return an error.