gutefrage / scala-mandrill

Minimal Scala wrapper for the Mandrill Mail API

Website GitHub

Build Status Latest version

Minimal Scala API for Mandrill

Mandrill is a transactional email API for MailChimp users. This library provides a API models and json (de)serializers.

Goals

There is already a scala library scamandrill. While this library as a lot more API models implemented it takes a more opinionated approach.

Scala Mandrill provides

  • Generic API models and provides parsers for different json libs. You choose.
  • No Mandrill Email Client. It's up to the user which http library to use

In addition the API models are incomplete. We'll add more as the library evolves.

Features

  • core provides API models and helpers to create them
  • play-json provides json Reads and Writes instances for all models
  • test-kit provides scalacheck generators and arbitraries for all API models

Supported APIs

Usage

Add the necessary dependencies to your build.sbt

libraryDependencies ++= Seq(
  "net.gutefrage.mandrill" %% "mandrill-core" % "0.1.6",
  "net.gutefrage.mandrill" %% "mandrill-play-json" % "0.1.6",
  "net.gutefrage.mandrill" %% "mandrill-test-kit" % "0.1.6" % "test"
)

Mandrill API request bodies are constructed via a fluent interface.

import net.gutefrage.mandrill._
import net.gutefrage.mandrill.core._

val apiKey = MandrillApiKey("your-api-key")
val sendTemplateBody = Mandrill(apiKey)
      .messages
      .sendTemplate("my-template-slug")
      .to("foo@bar.com")

For more information read the documentation

Acknowledgement

  • Mandrill for a great API documentation
  • Scamandrill as a source of inspiration
  • Scala Cats for a great documentation and inspiration for a scala library build setup