if (FALSE) {
myteam <- get_team("my team")
myteam$list_channels()
chan <- myteam$get_channel()
chan$list_messages()
chan$send_message("hello from R")
# a multi-line message with an attachment
msg_text <- c(
"message line 1",
"message line 2",
"message line 3"
)
chan$send_message(msg_text, attachments="myfile.csv")
# sending an inline image
chan$send_message("", content_type="html", inline="graph.png")
# channel members
chan$list_members()
jane <- chan$get_member("Jane Smith")
bill <- chan$get_member(email="billg@mycompany.com")
# mentioning a team member
chan$send_message("Here is a message", content_type="html", mentions=jane)
# mentioning 2 or more members: use a list
chan$send_message("Here is another message", content_type="html",
mentions=list(jane, bill))
# mentioning an entire channel or team
chan$send_message("FYI to channel", content_type="html", mentions=chan)
chan$send_message("FYI to everyone", content_type="html", mentions=myteam)
chan$list_files()
chan$upload_file("mydocument.docx")
}
Run the code above in your browser using DataLab