Skip to content
REST client for Twitch in Elixir
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


RestTwitch is a Elixir Library for accessing the Twitch REST API. Using Kraken Twitch API v5.

Open to all pull requests and contributions.

To start:

  1. mix deps.get

Set your TWITCH_CLIENT_ID to your environmental variables. You can find this on > Manage.

  1. TWITCH_CLIENT_ID=XXX iex -S mix

Get a channel object

iex>   RestTwitch.Channels.get("test_channel")
%RestTwitch.Channels.Channel{_id: 6140842, _link: nil, background: nil,
 banner: nil, broadcaster_language: nil, created_at: "2009-05-08T08:19:58Z",
 delay: nil, display_name: "Test_channel", followers: 7, game: nil,
 language: "en", logo: nil, mature: false, name: "test_channel", partner: false,
 profile_banner: nil, profile_banner_background_color: nil,
 status: "TESTING  TESTING   TESTING", updated_at: "2015-06-17T15:15:29Z",
 url: "", video_banner: nil, views: 87}

Get a user object

iex> RestTwitch.Users.get("test_user1")
%RestTwitch.Users.User{_id: 22747064,
 _links: %{"self" => ""}, bio: nil,
 created_at: "2011-06-02T20:04:03Z", display_name: "Test_user1",
 logo: "",
 name: "test_user1", type: "user"}

Get status of follow relationship between user and target channel

iex> RestTwitch.Follows.follows("test_user1", "test_channel")
"test_user1 is not following test_channel"

iex> RestTwitch.Follows.follows("rockerboo", "dansgaming")
%RestTwitch.Channels.Channel{_id: 7236692, _link: nil, background: nil,
 banner: nil, broadcaster_language: "en", created_at: "2009-07-15T03:02:41Z",
 delay: nil, display_name: "DansGaming", followers: 335128, game: "NothingElse",
 language: "en",
 logo: "",
 mature: true, name: "dansgaming", partner: true,
 profile_banner: "",
 profile_banner_background_color: "#f6f6f6", status: "Just Talking Guys <3",
 updated_at: "2015-06-05T18:18:31Z", url: "",
 video_banner: "",
 views: 44543258}

Get a user's list of followed channels

iex> RestTwitch.Follows.get("test_user1", %{"direction" => "desc"})
[%RestTwitch.Follows.Follow{_links: %{"self" => ""},
  channel: %{"_id" => 32271832,
    "_links" => %{"chat" => "",
      "commercial" => "",
      "editors" => "",
      "features" => "",
      "follows" => "",
      "self" => "",
      "stream_key" => "",
      "subscriptions" => "",
      "teams" => "",
      "videos" => ""},
    "background" => nil, "banner" => nil, "broadcaster_language" => "en",
    "created_at" => "2012-07-20T02:03:58Z", "delay" => nil,
    "display_name" => "zMASKm", "followers" => 1411, "game" => "Dark Souls",
    "language" => "en",
    "logo" => "",
    "mature" => true, "name" => "zmaskm", "partner" => false,
    "profile_banner" => nil, "profile_banner_background_color" => nil,
    "status" => "Revisiting Lordran || Metal and Dark Souls || #TeamPxL",
    "updated_at" => "2015-06-05T18:15:52Z",
    "url" => "",
    "video_banner" => "",
    "views" => 33126}, created_at: "2015-03-19T23:22:00Z", notifications: false,
  user: %RestTwitch.Users.User{_id: nil, _links: nil, bio: nil, created_at: nil,
   display_name: nil, logo: nil, name: nil, type: nil}}, %RestTwitch.Follows.Follow{...}, ...]
You can’t perform that action at this time.