Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/orbit-apps/elixir-segment-api

Elixir Segment API
https://github.com/orbit-apps/elixir-segment-api

library

Last synced: 10 days ago
JSON representation

Elixir Segment API

Awesome Lists containing this project

README

        

# SegmentAPI

Basic HTTP wrapper for the Segment service.

## Installation

Package can be installed by adding `segment_api` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:segment_api, github: "pixelunion/elixir-segment-api", tag: "v0.4.0"}
]
end
```

Add the following configuration to your config.ex

```elixir
config :segment_api, :api_key, ""
```

Uses Jason for json transcoding by default, if you want to configure it to use Poison add the following.

```elixir
config segment_api, json_library, Poison
```

Use like

```elixir
app_slug = "USO"
shopify_domain = "example.myshopify.com"
type = :customer_data_request

SegmentAPI.track(
SegmentAPI.event(app_slug, type),
shopify_domain,
%{data: %{foo: "bar"}},
%{integrations: %{All: true, Salesforce: false}}
)
```