git.iko.soy/typeable/mandrill
on v0.5.3.1 help sign in
130 lines 3.3 kB history raw
1[![Build Status](https://travis-ci.org/adinapoli/mandrill.svg?branch=master)](https://travis-ci.org/adinapoli/mandrill)
2[![Coverage Status](https://img.shields.io/coveralls/adinapoli/mandrill.svg)](https://coveralls.io/r/adinapoli/mandrill)
4# Haskell Client for the Mandrill JSON API
6This module implement a low-level, 1:1 mapping API to
7the [Mandrill](http://mandrillapp.com) transactional email service.
9# Changelog
11## Version 0.5.3.1
13* Relaxed upper bound on Aeson (see: fpco/stackage/issues/2177 )
15## Version 0.5.3.0
17* Added support for webhooks (thanks to @mwotton).
19## Version 0.5.2.3
21* Added support for aeson-1.0.0.0 by relaxing its upper bound.
23## Version 0.5.2.2
25* Added support for QuickCheck-2.9 by relaxing its upper bound.
27## Version 0.5.2.1
29* Added `Functor`, `Foldable` and `Traversable` instances to `MandrillResponse` (Courtesy of @dredozubov)
31## Version 0.5.2.0
33* Added inbound calls (Courtesy of @mwotton)
35## Version 0.5.1.0
37* Relaxed the constraint on `aeson` to allow `0.11.0.0`.
39## Version 0.5.0.0
41* Changed the `MandrillHeaders` type synonym from `Value` to `Object`.
43* Changed the `mmsg_metadata` and `mmdt_values` fields from `MandrillVars` to `Object`.
45* Changed the `mmsg_global_merge_vars` and `mmvr_vars` fields from `[MandrillVars]` to `[MergeVar]`
47* Added the `MergeVar` data type:
49```haskell
50data MergeVar = MergeVar {
51 _mv_name :: !Text
52 , _mv_content :: Value
53 }
54```
56* Removed the `MandrillVars` type synonym.
58## Version 0.4.0.0
60* Modified the `Base64ByteString` type to accept another constructor. This
61 allows the user to pass already-encoded Base64 strings which might be coming
62 upstream.
64# Example
66This package was built with pragmatism and reuse in mind. This means
67this API comes in two flavours: an IO-based and an handy monad transformer
68which can be plugged in your stack of choice.
69Example:
71``` haskell
72{-# LANGUAGE OverloadedStrings #-}
73import Text.Email.Validate
74import Network.API.Mandrill
76main :: IO ()
77main = do
78 case validate "foo@example.com" of
79 Left err -> print $ "Invalid email!" ++ show err
80 Right addr -> runMandrill "MYTOKENHERE" $ do
81 let msg = "<p>My Html</p>"
82 res <- sendEmail (newTextMessage addr [addr] "Hello" msg)
83 case res of
84 MandrillSuccess k -> liftIO (print k)
85 MandrillFailure f -> liftIO (print f)
86```
88# Supported API versions
90* 1.0 (partially)
91 - [Users call](https://mandrillapp.com/api/docs/users.JSON.html) - 100%
92 + info.json
93 + ~~ping.json~~ (as **doesn't return valid json!**)
94 + ping2.json
95 + senders.json
97 - [Messages call](https://mandrillapp.com/api/docs/messages.JSON.html)
98 + send.json
100 - [Senders call](https://mandrillapp.com/api/docs/senders.JSON.html)
101 + verify-domain.json
103 - [Inbound call](https://mandrillapp.com/api/docs/inbound.JSON.html)
104 + add-route.json
105 + add-domain.json
107# Testing online API
109To test the online API, first build the package with tests enabled:
111```
112cabal install --enable-tests
113```
115Then export an environment variable with your Mandrill **Test** token:
117```
118export MANDRILL_API_KEY="YOURKEYGOESHERE"
119```
121And finally execute the testsuite:
123```
124cabal test
125```
127# Contributions
128This library scratches my own itches, but please fork away!
129Pull requests are encouraged to implement the part of the API
130you need.