The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The rt
package was built to make it easier for our own team to work with RT in an automated fashion. As a result, most functions in the package have return values suitable for passing into other functions in the rt
package or functions from other packages. Notably, functions are pipeable when possible.
Below are some example workflows you might use this package for.
You can always email your RT installations associated email address to create a ticket but you can also create one programmatically:
rt_ticket_create("General", "me@example.com", "Hey, a quick question...")
You could also create a set of tickets from a database dump of some kind, such as an old ticket tracking system.
First, let’s create some example data to work with:
<- data.frame(
old_tickets queue = "General",
subject = c("I need some help", "about those TPS reports...", "hello!"),
requestor = c("someone@example.com", "boss@initech.com", "user@example.com"),
stringsAsFactors = FALSE
)
With some example data, creating tickets for each of those in on go is only a few lines of code:
lapply(seq_len(nrow(old_tickets)), function (row) {
do.call(rt_ticket_create, as.list(old_tickets[row,]))
})
We can then check our work:
library(dplyr)
rt_ticket_search('Queue="General"') %>%
select(id, Subject)
# A tibble: 3 x 2
id Subject
<chr> <chr>
1 1 I need some help
2 2 about those TPS reports...
3 3 hello!
Each ticket has a set of properties associated with it and rt
makes it quick to update those programmatically.
For example, we write R code to resolve a ticket. For example, say we’re ready to resolve ticket number 6:
rt_ticket_edit(6, status = "resolved")
What if we wanted to re-assign a set of tickets? We could go about this the slow way: By looking up ticket IDs in our web browser and resolving them one by one. Instead, we can make rt
do the work for us:
<- rt_ticket_search("Owner = 'manager'", format = "i")
result sapply(result, function (id) {
rt_ticket_edit(id, owner = "intern")
})
Many functions in rt
return values suitable for passing into other functions, such as with the %>%
operator from the magrittr
package that’s commonly used in the tidyverse
. Here’s an example of how this can be used:
rt_ticket_create("General") %>%
rt_ticket_edit(owner = "some_user") %>%
rt_ticket_history_comment("Hey, this is just a comment...")
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Comment and Replying
If you’re already using RT, you’re probably already familiar with commenting and replying to tickets. You’ve also possibly pasted text into your web browser from another source.
rt
can help automate some of this.For example, what if we were calculating some statistics for a ticket and wanted to put that information in the ticket as a comment?
Above, we used the handy
capture.output
function along withpaste
but there are many other ways to get information from R into RT.We can look at the comment we just made like so: