https://github.com/anthontaylor/clj-sendgrid
A Clojure Library for the Sendgrid API v3
https://github.com/anthontaylor/clj-sendgrid
Last synced: 8 months ago
JSON representation
A Clojure Library for the Sendgrid API v3
- Host: GitHub
- URL: https://github.com/anthontaylor/clj-sendgrid
- Owner: anthontaylor
- License: epl-1.0
- Created: 2017-07-06T23:09:08.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-10-10T18:53:06.000Z (over 7 years ago)
- Last Synced: 2025-10-21T22:57:38.943Z (8 months ago)
- Language: Clojure
- Homepage:
- Size: 25.4 KB
- Stars: 8
- Watchers: 1
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/anthontaylor/clj-sendgrid)
[](https://codecov.io/gh/anthontaylor/clj-sendgrid)
# clj-sendgrid
A Clojure Library for the Sendgrid API v3
[](https://clojars.org/clj-sendgrid)
## Usage
clj-sendgrid is available in Clojars. Add this ```:dependency``` to your Leiningen ```project.clj```:
```
[clj-sendgrid "0.1.2"]
```
Include in your namespace
```
(:require [sendgrid.core :as sg])
```
### Each request below requires an api-token
```
(def api-token "Bearer YOURTOKENVALUE")
```
```
(get-alerts api-token)
(get-bounces api-token)
(get-blocks api-token)
(get-invalid-emails api-token)
(get-spam-reports api-token)
```
### You can also add parameters as a map
```
(get-blocks api-token {:limit 1})
```
### Basic usage of sending an email
```
(send-email {:api-token api-token
:from test@test.com
:to abc@abc.com
:subject "Test Subject"
:message "Test Message"})
```
### Email can be sent to multiple recipients
```
(send-email {:api-token api-token
:from test@test.com
:to [abc@abc.com hello@abc.com]
:subject "Test Subject"
:message "Test Message"})
```
### Basic usage of sending an email with file content
```
(send-email {:api-token api-token
:from test@test.com
:to abc@abc.com
:subject "Test Subject"
:message "Test Message"
:filename "Test.txt"
:content (string->b64-string "Hello World)"})
```
### Sendgrid API
https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html