ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - bradleyd/exgrid: Elixir library to interact with Sendgrid's API
Elixir library to interact with Sendgrid's API. Contribute to bradleyd/exgrid development by creating an account on GitHub.
Visit Site

GitHub - bradleyd/exgrid: Elixir library to interact with Sendgrid's API

GitHub - bradleyd/exgrid: Elixir library to interact with Sendgrid's API

ExGrid

Build Status Hex.pm

Elixir library to interact with Sendgrid's V2 Web API

This is a WIP, YMMV

Upgrading from 0.4.0 to 1.0.0

The reason the version got bumped to 1.0.0 is because I replaced all traces of Dict with Map. A lot of the functions returned a Dict and this may break some folks code.

There are some other changes to dep versions which may be an issue in your application as well. If this is the case, stay with 0.X branch. I will try to keep 0.X up to date as best I can for these reasons. However, there will not be any new dev time for the 0.X series. Only bug fixes.

Installation

In order to install it via hex, add exgrid and ibrowse package into the deps list of your mix.exs.

  defp deps do
    [
      {:exgrid, "~> 1.0"}
    ]
  end

Quick Start

Send an email

  • ExGrid.Message.new requires a text and/or html body
{:ok, creds }   = ExGrid.credentials(%{api_key: "mysecretpassword", api_user: "[email protected]"})
{:ok, message } = ExGrid.Message.new([to: "[email protected]", subject: "hello world", from: "[email protected]", text: "this is a test message"])

{code, body}    = ExGrid.Mail.send(creds, message)

{200, %{"message" => "success"}}

Usage

Profile

Get your profile
{200, body } = ExGrid.Profile.get(creds)
IO.inspect body #=>
[%{"first_name", "John"}, {"username", "[email protected]"}, {"website_access", "true"}, {"phone", "123456789"}, {"state", "CO"}, {"last_name", "Doe"}, {"address2", ""}, {"city", "Denver"}, {"email", "[email protected]"}, {"website", "http://sendgrid.com"}, {"country", "US"}, {"active", "true"}, {"zip", "80020"}, {"address", "123 main st"}]
Set a profile attribute
{200, body} = ExGrid.Profile.set(creds, %{address: "456 Main st"})
IO.inspect body #=> %{"message", "success"}

Bounces

Please see docs for all parameters

{200, body} = ExGrid.Bounces.get(creds)
# return the `created` time for each bounce
{200, body} = ExGrid.Bounces.get(creds, %{date: 1})
Remove bounces
{200, body} = ExGrid.Bounces.remove(creds, %{type: "soft"})
IO.inspect body #=> {"message", "success"}
{200, body} = ExGrid.Bounces.remove(creds, %{email: "[email protected]"})
IO.inspect body #=> {"message", "success"}
You can even get bounce counts
{200, body} = ExGrid.Bounces.count(creds)
IO.inspect body #=> {"count", "4"}

Blocks

Please see docs for all parameters

{200, body} = ExGrid.Blocks.get(creds)
# return the `created` time for each block
{200, body} = ExGrid.Blocks.get(creds, %{date: 1})
Remove blocks
  • only parameter accepted is email
{200, body} = ExGrid.Blocks.remove(creds, %{email: "[email protected]"})
IO.inspect body #=> {"message", "success"}
You can even get block counts
{200, body} = ExGrid.Blocks.count(creds)
IO.inspect body #=> {"count", "4"}

Statistics

Please see docs for all parameters

{200, body} = ExGrid.Statistics.get(creds)
IO.inspect body #=>
[
   %{
      "date": "2014-02-26",
      "delivered": 314,
      "unsubscribes": 1,
      "invalid_email": 5,
      "bounces": 9,
      "repeat_unsubscribes": 2,
      "unique_clicks": 65,
      "blocked": 3,
      "spam_drop": 5,
      "repeat_bounces": 8,
      "repeat_spamreports": 9,
      "requests": 350,
      "spamreports": 1,
      "clicks": 78,
      "opens": 80,
      "unique_opens": 70}
]

Number of days in the past to include statistics (Includes today)
{200, body} = ExGrid.Statistics.get(creds, %{days: 1})
List all categories
{200, body} = ExGrid.Statistics.categories(creds)
You can even get aggregate stats
{200, body} = ExGrid.Statistics.get(creds, %{aggregate: 1})

Tests

The tests are a unit style and do not go out and hit SendGrid.

mix test

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory