Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Create LINE Bot with Elixir

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Create LINE Bot with Elixir

Introduce my own LINE Bot created with Elixir and that's features.
tokyo.ex #2 LT Slide #beamlangtokyo
http://beam-lang.connpass.com/event/30513/

Avatar for Takayuki Matsubara

Takayuki Matsubara

May 23, 2016
Tweet

More Decks by Takayuki Matsubara

Other Decks in Programming

Transcript

  1. self-introduction me |> name # Takayuki Matsubara |> job #

    Software Engineer |> work_at # M3, Inc. |> works # Rails, Java, JavaScript |> twitter # ma2ge |> github # ma2gedev |> oss # PowerAssertEx, breadcrumble, # chrono_logger, bundle-star, # faraday-encoding
  2. Implementation - Worker defmodule ZakuHead.PeriodicTask do use GenServer def start_link

    do GenServer.start_link(__MODULE__, %{}) end def init(state) do Process.send_after(self(), :work, 0) # start immediately when starting {:ok, state} end def handle_info(:work, state) do # scraping from the train information page # find some trouble routes and notify LINE BOT API Process.send_after(self(), :work, 5 * 60 * 1000) # every 5 minutes {:noreply, state} end end