[R-pkgs] Introducing teamr Package

Tanbing Yan t@nb|ngy @end|ng |rom gm@||@com
Mon Jul 22 20:23:31 CEST 2019

Today I am so pleased to introduce my first CRAN package for sending
formatted messages to Microsoft Teams, teamr

Motivation is simple here. For years I have been using Slack and built many
slash commands and apps using incoming webhooks with R, but ever since I
started to use Teams, I found that we will have the same needs for
communicating with R as well. So with some inspiration from the Python
package pymsteams <https://pypi.org/project/pymsteams/>. I created
teamr package
with the hope that this package will provide a simple and clean way to talk
to Teams from R.

You can install the released version of teamr from CRAN
<https://cran.r-project.org/> with:


And the development version from GitHub <https://github.com/> with:

# install.packages("devtools")


This is a basic example of send a simple titled message to MS Teams:

# initiate new connector card object
cc <- connector_card$new(hookurl =
"https://outlook.office.com/webhook/...")# add text
cc$text("This is text of main body.")# add title
cc$title("This is message title")# add hyperlink button
cc$add_link_button("Read more", "https://www.google.com")# change theme color

We can print out the payload that will be sending to given webhook using

# print out the payload for checking

  hookurl: https://outlook.office.com/webhook/...
  payload:  {"text":"This is text of main body.","title":"This is
message title","potentialAction":[{"@context":"http://schema.org","@type":"ViewAction","name":"Read

Our JSON payload looks good, time to send it out :)

# send to Teams

[1] TRUE

send menthod will return TRUE if send was successful (status code 200). If
it failed, it will return the reponse object for further investigation. Our
message with a link button will looks like this:

	[[alternative HTML version deleted]]

More information about the R-packages mailing list