Slide 1

Slide 1 text

Create LINE Bot with Elixir

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

My LINE Bot(Not Public)

Slide 4

Slide 4 text

Structure 4 Phoenix Framework 4 HTTPoison 4 PostgreSQL

Slide 5

Slide 5 text

Features

Slide 6

Slide 6 text

Help

Slide 7

Slide 7 text

Run Elixir code from LINE app

Slide 8

Slide 8 text

Implementation {result, bindings} = Code.eval_string( code, [], [file: "linebot.ex", line: 1] ) 4 [WIP] takeover session 4 [WIP] security

Slide 9

Slide 9 text

Pitfall !

Slide 10

Slide 10 text

Train information

Slide 11

Slide 11 text

4 https://twitter.com/twcrone/status/ 574623119618535425/photo/1

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

Implementation - Scraping 4 Floki 4 https://github.com/philss/floki

Slide 14

Slide 14 text

jobs.m3.com/engineer/

Slide 15

Slide 15 text

Start/Stop Zaku

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

See Also if you interested in cloudBit 4 https://speakerdeck.com/ma2gedev/playing-with- littlebits-number-m3dev

Slide 19

Slide 19 text

Light Sensor

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Resources 4 LINE BOT API 4 https://developers.line.me/bot-api/overview