{"id":13472424,"url":"https://github.com/micksatana/fireliff-cli","last_synced_at":"2025-03-26T15:32:21.667Z","repository":{"id":38426136,"uuid":"149722715","full_name":"micksatana/fireliff-cli","owner":"micksatana","description":"Command line interface for building LIFF app on Firebase","archived":false,"fork":false,"pushed_at":"2023-03-04T02:51:44.000Z","size":992,"stargazers_count":11,"open_issues_count":11,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-09-18T01:41:31.517Z","etag":null,"topics":["firebase","fireliff-cli","fliff","liff","line-things","linebot","richmenu","things"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micksatana.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-09-21T06:55:08.000Z","updated_at":"2024-04-23T04:12:48.000Z","dependencies_parsed_at":"2023-07-17T15:42:29.984Z","dependency_job_id":null,"html_url":"https://github.com/micksatana/fireliff-cli","commit_stats":null,"previous_names":["intocode-io/fireliff-cli"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micksatana%2Ffireliff-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micksatana%2Ffireliff-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micksatana%2Ffireliff-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micksatana%2Ffireliff-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micksatana","download_url":"https://codeload.github.com/micksatana/fireliff-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222151632,"owners_count":16939423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["firebase","fireliff-cli","fliff","liff","line-things","linebot","richmenu","things"],"created_at":"2024-07-31T16:00:54.538Z","updated_at":"2024-10-30T02:32:09.881Z","avatar_url":"https://github.com/micksatana.png","language":"JavaScript","funding_links":["https://paypal.me/micksatana?locale.x=en_GB"],"categories":["JavaScript"],"sub_categories":[],"readme":"# fireliff-cli\n[![Build Status](https://travis-ci.com/micksatana/fireliff-cli.svg?branch=master)](https://travis-ci.com/micksatana/fireliff-cli)\n[![codecov](https://codecov.io/gh/micksatana/fireliff-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/micksatana/fireliff-cli)\n![NPM](https://img.shields.io/npm/l/@intocode-io/line-api-cli)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/micksatana?locale.x=en_GB)\n\nCommand line interface for building LIFF app on Firebase. This module will help you handle API to add, update, delete, get LIFF apps and set LIFF IDs in Firebase Functions configuration which can be retrieved in your Functions project.\n\nNOTE: If you do not need to work with Firebase, we recommend our latest package [`line-api-cli`](https://www.npmjs.com/package/line-api-cli)\n\n## Prerequisite\n\n### Firebase Tools\nFirebase tools must be installed\n```\nnpm i -g firebase-tools\n```\nFirebase project must be initiated with Functions (for Messaging API) and Hosting (for LIFF)\n```\nfirebase init\n```\nFirebase project must be defined\n```\nfirebase use --add\n```\n\n## Installation\nInstall FireLIFF CLI\n```\nnpm i -g @intocode-io/fireliff-cli\n```\n\n### Configure LINE channel access token\nThere are two approaches to set LINE channel access token\n\n#### A) Use long-lived access token\nThis approach is quick and easy but less secure because the token we are using here is long-lived access token. You can manually issue this token using [LINE Developers Console](https://developers.line.biz/console).\n```\nfliff config --token \u003caccessToken\u003e\n```\n\n#### B) Use short-lived access token\nThis approach is recommended. First setup your channel id and secret. They can be found in [LINE Developers Console](https://developers.line.biz/console).\n```\nfliff config --id \u003cchannelId\u003e --secret \u003cchannelSecret\u003e\n```\nAfter channel ID and secret are configured. Issue a channel access token and save it.\n```\nfliff token --issue --save\n```\nIn case you want to revoke an access token, you can run with `--revoke` option.\n```\nfliff token --revoke \u003caccessToken\u003e\n```\n\n##### IMPORTANT NOTE\nShort-lived access token is valid for 30 days. You should have a process to replace the access token periodically.\n\n### Set Firebase Hosting URL\n```\nfirebase functions:config:set hosting.url=\u003chostingUrl\u003e\n```\n## Usage\n\n### Init LIFF project\nThis command should be run first time under Firebase project root folder which containing `firebase.json`.\n```\nfliff init\n```\nAfter run successfully, you will get a `web-views` LIFF project folder. This sub-project is a boilerplate with Parcel Bundler. You can change directory into `web-views` and run `npm run dev` to start LIFF App development. See [Develop LIFF Web Views](#develop-liff-web-views)\n\n\n### Add LIFF view\nAdd LIFF using view `--name` and `--url` options. We make `--type` option as optional in FireLIFF CLI to shorten the command line. So you can omit `--type`, it will be `full` by default. \n```\nfliff add --name \u003cviewName\u003e --url \u003cviewUrl\u003e\n```\nIf you prefer to specify type, run with `--type` option. It can be `full`, `tall` or `compact`.\n```\nfliff add --name \u003cviewName\u003e --url \u003cviewUrl\u003e --type \u003cviewType\u003e\n```\n\n### Update LIFF view\nUpdate using LIFF ID\n```\nfliff update --id \u003cliffId\u003e --type \u003cviewType\u003e --url \u003cviewUrl\u003e\n```\nUpdate using view name\n```\nfliff update --name \u003cviewName\u003e --type \u003cviewType\u003e --url \u003cviewUrl\u003e\n```\nTo update Bluetooth® Low Energy (BLE) flag, use `--ble` option\n```\nfliff update --id \u003cliffId\u003e --ble \u003ctrue|false\u003e\n```\n\n#### IMPORTANT NOTE\nThe Name column in LIFF tab in LINE developers Console is not related to `fliff update --name` option here. According to LINE LIFF API specification, this Name of the LIFF app column is actually `description` in its request body. So If you would like to change this value you can run `fliff update --id \u003cviewId\u003e --description \u003cdescripton\u003e`\n\n### Delete LIFF view\nUpdate using LIFF ID\n```\nfliff delete --id \u003cliffId\u003e\n```\nUpdate using view name\n```\nfliff delete --name \u003cviewName\u003e\n```\n\n### Get LIFF views\nList LIFF apps\n```\nfliff get\n```\nList LIFF apps with description and Bluetooth® Low Energy (BLE) flag\n```\nfliff get --detail\n```\n\n### Add RichMenu\nTo add a new RichMenu\n```\nrichmenu add --name \u003crichMenuName\u003e --data \u003cdataFile\u003e --image \u003cimageFile\u003e\n```\n#### IMPORTANT NOTE\nThe richmenu naming cannot be uppercase due to Firebase Functions Configuration specification. It's recommended to use `rich-menu-name` pattern.\n\n### Update RichMenu\nLINE Rich Menu API currently not support `PUT` method which means you cannot update the rich menu. The workaround is add new menu and delete the old one.\n\n### Delete RichMenu\nUpdate using RichMenu ID\n```\nrichmenu delete --id \u003crichMenuId\u003e\n```\nUpdate using RichMenu name\n```\nrichmenu delete --name \u003crichMenuName\u003e\n```\n\n### Get RichMenu\nTo display existing rich menus, run the following command. This will display existing rich menus in table.\n```\nrichmenu get\n```\nOr if you need more detail, such as `areas` property, run with `--detail` option. This will display as object.\n```\nrichmenu get --detail\n```\n\n### Set RichMenu as default\nSet RichMenu for all users using RichMenu ID\n```\nrichmenu default --id \u003crichMenuId\u003e\n```\nSet RichMenu for all users using RichMenu name\n```\nrichmenu default --name \u003crichMenuName\u003e\n```\n\n### Link a RichMenu to an individual user\nLink RichMenu to an individual user using RichMenu ID\n```\nrichmenu link --id \u003crichMenuId\u003e --user \u003cuserId\u003e\n```\nLink RichMenu to an individual user using RichMenu name\n```\nrichmenu link --name \u003crichMenuName\u003e --user \u003cuserId\u003e\n```\n\n### Unlink RichMenu from an individual user\nUnlink RichMenu from an individual user\n```\nrichmenu unlink --user \u003cuserId\u003e\n```\n\n#### IMPORTANT NOTE\nThe RichMenu name is the name when you add the RichMenu with `--name` option which will be saved in Firebase Functions Configuration. It is not the same as a `name` property in data file. You can run `richmenu get` to see RichMenu name in the first column.\n\n## Develop LIFF Web Views\n### Performance consideration\nEach web view will be loaded inside LINE app when LINE user open a `line://app/{view}`. So to load each web view faster, it's recommended to avoid using single-page app approach but create a set of files for each page using the following pattern instead.\n```\nweb-views/src/some-view.html\nweb-views/src/some-view.js\nweb-views/src/some-view.css\n```\nIt's recommended to load only neccessary library in the html file; for example, the LIFF SDK. And use Parcel Bundler to import other libraries as needed. Parcel Bundler will help to several things; including Tree-shaking which will reduce JavaScript payloads.\n\n### Environment file naming\nThe boilerplate has two environments; `production` and `staging`. But you can create more if needed. Environment file uses the following format\n```\nweb-views/.env.{process.NODE_ENV}\n```\n\n### Environment and Firebase project alias\nEnvironment must be aligned with Firebase project alias. Run `firebase use` to see all aliases. If you don't have `staging` and `production` aliases, you can add them by run the following command.\n```\nfirebase use --add\n```\n\n### Firebase app initialization\nIn the environment file, we have two default variables; `FIREBASE_API_KEY` and `FIREBASE_API_PROJECT_ID`, which needed during firebase app initialization.\n```\nimport firebase from 'firebase/app';\n\nfirebase.initializeApp({\n    apiKey: process.env.FIREBASE_API_KEY,\n    projectId: process.env.FIREBASE_API_PROJECT_ID\n});\n```\n\n### LIFF initialization\nYou can access `liff` variable in any JavaScript file as long as the JavaScript file is loaded in an HTML page which include LIFF SDK script.\n```\nliff.init(\n     data =\u003e console.log(data.context),\n     error =\u003e console.log(error)\n);\n```\n\n### Deploy to staging environment\n```\ncd web-views\nnpm run deploy:staging\n```\nThis command will clean `web-views/dist`, re-build and deploy to Firebase Hosting.\n\nAfter complete, you can [add LIFF view](#add-liff-view). The command will add LIFF view to LINE and configure Firebase Functions for you.\n\n## How to retrieve LIFF View IDs or RichMenu in Firebase Functions\nYou can get LIFF view IDs programmatically, in your Firebase Functions project using the following code.\n```\nimport * as functions from 'firebase-functions';\nconst views = functions.config().views;\nconst richMenus = functions.config().richmenus;\n```\nLet's say you previously add a view named `some_view`, you can create URL using LIFF ID in `views` like this.\n```\nconst signUpUrl = `line://app/${views.some_view}`;\n```\n\nWhen LINE user access this view `line://app/${views.some_view}`, the user will see `web-views/src/some-view.html` hosted on Firebase Hosting.\n\n## LINE Things\n\n### Enable LINE Things\n\nTo enable LINE Things, read [LINE Things Starter, Enable LINE Things](https://github.com/line/line-things-starter#enable-line-things) section\n\n### LINE Things CLIs\n\n**NOTE**: `things` CLIs send requests and `console.log` back the response data. It will not save any information.\n\n#### Create trial product information\n\n`things create:trial --liff \u003cliffId\u003e --name \u003cproductName\u003e`\n\n#### Get trial product information\n\n`things get:trial`\n\n#### Delete trial product information\n\n`things delete:trial --product \u003cproductId\u003e`\n\n#### Get product ID and PSDI by device ID\n\n`things get:product --device \u003cdeviceId\u003e`\n\n#### Get device information by device ID and user ID\n\n`things get:device --device \u003cdeviceId\u003e --user \u003cuserId\u003e`\n\n#### Get device information by product ID and user ID\n\n`things get:device --product \u003cproductId\u003e --user \u003cuserId\u003e`\n\n## LICENSE\n\nMIT License\n\nCopyright (c) 2018-2019 intocode Co., Ltd.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicksatana%2Ffireliff-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicksatana%2Ffireliff-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicksatana%2Ffireliff-cli/lists"}