Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikeflynn/gmail-clj
A Clojure library that abstracts the GMail API (not the IMAP) interface.
https://github.com/mikeflynn/gmail-clj
clojure gmail google
Last synced: 2 months ago
JSON representation
A Clojure library that abstracts the GMail API (not the IMAP) interface.
- Host: GitHub
- URL: https://github.com/mikeflynn/gmail-clj
- Owner: mikeflynn
- License: epl-1.0
- Created: 2014-07-21T16:20:43.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-02-08T16:26:42.000Z (almost 2 years ago)
- Last Synced: 2024-09-14T11:36:38.786Z (4 months ago)
- Topics: clojure, gmail, google
- Language: Clojure
- Size: 22.5 KB
- Stars: 34
- Watchers: 3
- Forks: 16
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `gmail-clj`
A Clojure library designed to abstract the details of the GMail REST API: [developers.google.com/gmail/api/](https://developers.google.com/gmail/api/)
## Installation
`gmail-clj` is available as a Maven artifact from [Clojars](https://clojars.org/gmail-clj):
![](https://clojars.org/gmail-clj/latest-version.svg)
## Usage
Require the library in your REPL:
```clojure
(require '[gmail-clj.core :as gmail])
```...or in your project.clj file
```clojure
(ns my-app.core
(:require [gmail-clj.core :as gmail]))
```Be sure to set your Google API Application Key and Secret:
```clojure
(gmail/set-client-secret! "aaaaa")
(gmail/set-client-id! "bbbbbb")
(gmail/set-refresh-token! "ccccc")
(gmail/set-access-token! "dddddd") ; Optional. If you already have an access token.
```## Authorizing
This library takes your API information and will do an authorization based on a refresh token. (*Note: If your app doesn't request a refresh token, you can simply set the access-token with gmail/set-access-token!, but we can't re-authorize after that token expires without a refresh token.*)
To generate the refresh token you need to write your own interface with the Google OAuth endpoint, but for development and testing I've included an HTML file that does the basic OAuth handshake and returns the refresh token: [/resources/index.html](https://github.com/mikeflynn/gmail-clj/blob/master/resources/index.html).
## To Do
Here's a few things I haven't gotten to yet, mostly because I didn't need them in my specific use case. If you'd like to dive in an help on these, that would much appreciated!
1. Sending email is very basic at the moment (to, subject, body): no bcc, no cc, no multiple addresses bcc / cc / to.
2. All endpoints are hard-coded to the "me" authorized email identifier at this time.
3. Email attachments!!## License
Copyright © 2014 Mike Flynn / [@thatmikeflynn](http://twitter.com/thatmikeflynn)
Distributed under the Eclipse Public License, the same as Clojure.