Git Product home page Git Product logo

gmailr's Introduction

gmailr

Build Status Coverage Status

Exposing the Gmail API from R.

Installation

Get the released version from CRAN:

install.packages("gmailr")

Or the development version from github with:

# install.packages("devtools")
devtools::install_github("jimhester/gmailr")

Features

  • retrieve data from your email
    • drafts: my_drafts = drafts()
    • history: my_history = history(start_num)
    • labels: my_labels = labels()
    • messages: my_messages = messages("search query")
    • threads: my_threads = threads("search query")
  • Create and send emails and drafts: see sending_messages vignette
  • manage email labels programmatically: modify_thread(thread_id, add_labels=c("label_1"), remove_labels=c("label_2"))
  • put things in the gmail trash
    • messages: trash_message(message_id)
    • threads: trash_thread(thread_id)
  • take things out of the gmail trash
    • messages: untrash_message(message_id)
    • threads: untrash_thread(thread_id)
  • delete directly without using the trash
    • messages: delete_message(message_id)
    • threads: delete_thread(thread_id)

Setup

By default gmailr will use a global project. However if you are going to be a heavy user and will do a lot of queries please setup your own project with the steps below. This often works best via Google Chrome.

  • Pick a project name; referred to as PROJ-NAME from now on.

  • Register a new project at https://console.developers.google.com/project.

  • From Overview screen, look at Google Apps APIs and select the Gmail API. Enable it.

  • Click "Go to Credentials" or navigate directly to Credentials.

  • You want a get a client ID and will need to "Configure consent screen".

    • The email should be pre-filled. Enter PROJ-NAME as Product name. Other fields can be left blank.
  • Returning to the "client id" process:

    • Application Type: "Other"
    • Enter PROJ-NAME again as the name.
    • Click "Create"
  • Client id and secret will appear in a pop-up which you can dismiss via "OK". Instead use download icon at far right of your project's listing to download a JSON file with all of this info. Move to an appropriate location and consider renaming as PROJ-NAME.json.

  • Use the downloaded JSON file as input to use_secret_file(), prior to other gmailr calls.

    ``` r
    use_secret_file('PROJ-NAME.json')
    ```
    

Future Work

  • More unit tests and better coverage
  • More (complicated) examples
  • Email statistics
  • Programmatic emailing
  • Returning data frames in addition to native Gmail API objects which are usually a nested list.
  • Support all the formats of users.messages:get

Examples

gmailr's People

Contributors

jimhester avatar lawremi avatar kazuya030 avatar alkashef avatar jlegewie avatar obarisk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.