3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rubyで始めるLIFF API

Posted at

はじめにLIFFとは

LIFFとはLINEがリリースしているフロントエンドのフレームワークです。
基本的にはFront周りのAPIなのですが、pathの設定などのめんどくさい部分があります。簡単に登録できるliff_selectorについて説明します。

※今回の記事ではローカルで始めるLINE bot @Rubyを基にして作成しています。

liff_selectorの機能

helpで見るとliffは次のような機能を提供しています。
今回は、LIFFアプリのテンプレートを作成する部分までを説明します。

 → bundle exec liff_select help
liff_select show                  : display all apps
liff_select same                  : display same url and type apps
liff_select clean                 : delete same url and type apps
liff_select upload _TYPE_ _URL_   : upload new apps with type and url.
                                  : type is <type:compact|tall:|full>
liff_select delete _LIFF_ID_      : delete app _LIFF_ID_ is referenced show number.
liff_select help                  : commands helps
liff_select new _html_name_       : make liff sample html

テンプレートの作成

liff_selectorを使うことにより、シンプルなテンプレートを作成することができます。

 → bundle exec liff_select create index
> [SUCESS] make ./views/index.erb

liffの登録

LIFFアプリのテンプレートを作成したので、rubyからliffアプリ呼び出す受け口を作成します。

app.rb
get '/' do
  erb :index
end

LIFFアプリとして、lineで起動させるためには、LINE側へliffアプリのURLを登録する必要があります。

 → bundle exec liff_select upload tall https://6fd2cf79.ngrok.io
> make liff app
> [SUCCESS] make app
> app uri : line://app/1598664616-30ozn5rM

登録したLIFFアプリ一覧

登録したアプリは show コマンドを使うことにより簡単に閲覧することができます。

 → bundle exec liff_select show
id liffId               type    url
1. 1598664616-30ozn5rM  tall    https://6fd2cf79.ngrok.io

最後に

liff_selectorなら簡単にliffアプリを管理することができます。
Happy LINE LIFE :)

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?