subscription: Subscribe and unsubscribe endpoints

Description Usage Arguments Examples

Description

Subscribe one or more users to a topic and unsubscribe them using their endpoints. For better performance, use the endpoint ARN on unsubscribe(). You can retrieve these ARN's in your SNS account on Amazon or using list_subscriptions().

Usage

1
2
3
subscribe(topic, protocol, endpoint, profile = "default")

unsubscribe(topic, endpoint, subscription_arn, profile = "default")

Arguments

topic

A topic name or topic ARN.

protocol

A string or a vector of strings with the protocol. "sms" and "email" are supported. If you have a vector of endpoints with the same protocol, you just need to specify the protocol once, not a vector of protocols.

endpoint

A string or a vector of strings with users that you want to subscribe. Use a valid email and for SMS use a complete cell phone number, for example: "+558112345678".

profile

Your profile name in AWS. If profile was not supplied this function will use the default profile.

subscription_arn

A string with the user's ARN. Use this for better performance in unsubscribe(). You can check the endpoint ARN in SNS account or using the list_subscription()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## Not run: 
# subscribe a user
# subscribe(topic = "your topic",
             protocol = "sms",
             endpoint = "+0012345")

# subscribe more than one user with a singe protocol
endpoint <- c("user1@email.com", "user2@email.com", "user3@email.com" )
subscribe(topic = "your topic",
          protocol = "email",
          endpoint = endpoint)

# subscribe more than one user with differents protocols
endpoint <- c("user4@email.com", "+0054321", "user5@email.com" )
protocol <- c("email", "sms", "email")
subscribe(topic = "your topic",
         protocol = protocol,
         endpoint = endpoint)

# unsubscribe a user
unsubscribe(topic = "your topic",
            endpoint = "+0012345")

# unsubscribe more than one user
unsubscribe(topic = "your topic",
            endpoint = c("user4@email.com", "+0054321"))

# use the endpoint ARN for better performance
unsubscribe(topic = "your topic",
            endpoint_arn = "arn:aws:sns:your_topic:12345")

## End(Not run)

samuelmacedo83/raws.sns documentation built on May 23, 2019, 8:57 a.m.