├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── backend ├── APP │ ├── replymessage │ │ ├── __init__.py │ │ ├── app.py │ │ └── requirements.txt │ ├── samconfig.toml │ └── template.yaml └── Layer │ ├── layer │ ├── common │ │ ├── common_const.py │ │ ├── const.py │ │ └── utils.py │ └── requirements.txt │ ├── samconfig.toml │ └── template.yaml ├── docs ├── en │ ├── README_en.md │ ├── back-end-construction.md │ ├── liff-channel-create.md │ ├── richmenu-create.md │ └── validation.md ├── images │ ├── access_token_en.png │ ├── bot-basic-id-en.png │ ├── channel-access-token-table-record-en.png │ ├── en │ │ ├── access_token_en.png │ │ ├── bot-basic-id-en.png │ │ ├── channel-access-token-table-record-en.png │ │ ├── end-point-url-description-en.png │ │ ├── liff-console-en.png │ │ ├── line-channel-create-1-en.png │ │ ├── line-channel-create-2-en.png │ │ ├── line-channel-create-3-en.png │ │ ├── line-channel-create-4-en.png │ │ ├── line-channel-create-add-liff-app-en.png │ │ ├── line-channel-create-add-liff-en.png │ │ ├── line-provider-create-1-en.png │ │ ├── line-provider-create-2-en.png │ │ ├── messaging_api_tab-en.png │ │ ├── out-put-description-en.png │ │ ├── postman_import-en.png │ │ ├── richmenu-image-link-en.png │ │ ├── send_richmenu-en.png │ │ └── webhook-setting-en.png │ ├── end-point-url-description-en.png │ ├── end-point-url-editing-en.png │ ├── jp │ │ ├── access_token.png │ │ ├── bot-basic-id.png │ │ ├── channel-access-token-table-record.png │ │ ├── liff-console.png │ │ ├── line-channel-create-1.png │ │ ├── line-channel-create-2.png │ │ ├── line-channel-create-3.png │ │ ├── line-channel-create-4.png │ │ ├── line-channel-create-add-liff-app.png │ │ ├── line-channel-create-add-liff.png │ │ ├── line-provider-create-1.png │ │ ├── line-provider-create-2.png │ │ ├── messaging_api_tab.png │ │ ├── out-put-description.png │ │ ├── postman_import.png │ │ ├── richmenu-image-link.png │ │ ├── send_richmenu.png │ │ └── webhook-setting.png │ ├── liff-console-en.png │ ├── line-channel-create-1-en.png │ ├── line-channel-create-2-en.png │ ├── line-channel-create-3-en.png │ ├── line-channel-create-4-en.png │ ├── line-channel-create-add-liff-app-en.png │ ├── line-channel-create-add-liff-en.png │ ├── line-provider-create-1-en.png │ ├── line-provider-create-2-en.png │ ├── messaging_api_tab_en.png │ ├── out-put-description-en.png │ ├── postman_import_en.png │ ├── richmenu-image-link-en.png │ ├── send_richmenu_en.png │ └── webhook-setting-en.png └── jp │ ├── back-end-construction.md │ ├── liff-channel-create.md │ ├── richmenu-create.md │ └── validation.md └── richmenu_setting ├── menu_img ├── carousel_ja.png ├── flex_ja.png └── message_ja.png └── rich menu.postman_collection.json /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 2 | # Contributor Covenant Code of Conduct 3 | 4 | ## Our Pledge 5 | 6 | We as members, contributors, and leaders pledge to make participation in our 7 | community a harassment-free experience for everyone, regardless of age, body 8 | size, visible or invisible disability, ethnicity, sex characteristics, gender 9 | identity and expression, level of experience, education, socio-economic status, 10 | nationality, personal appearance, race, religion, or sexual identity 11 | and orientation. 12 | 13 | We pledge to act and interact in ways that contribute to an open, welcoming, 14 | diverse, inclusive, and healthy community. 15 | 16 | ## Our Standards 17 | 18 | Examples of behavior that contributes to a positive environment for our 19 | community include: 20 | 21 | * Demonstrating empathy and kindness toward other people 22 | * Being respectful of differing opinions, viewpoints, and experiences 23 | * Giving and gracefully accepting constructive feedback 24 | * Accepting responsibility and apologizing to those affected by our mistakes, 25 | and learning from the experience 26 | * Focusing on what is best not just for us as individuals, but for the 27 | overall community 28 | 29 | Examples of unacceptable behavior include: 30 | 31 | * The use of sexualized language or imagery, and sexual attention or 32 | advances of any kind 33 | * Trolling, insulting or derogatory comments, and personal or political attacks 34 | * Public or private harassment 35 | * Publishing others' private information, such as a physical or email 36 | address, without their explicit permission 37 | * Other conduct which could reasonably be considered inappropriate in a 38 | professional setting 39 | 40 | ## Enforcement Responsibilities 41 | 42 | Community leaders are responsible for clarifying and enforcing our standards of 43 | acceptable behavior and will take appropriate and fair corrective action in 44 | response to any behavior that they deem inappropriate, threatening, offensive, 45 | or harmful. 46 | 47 | Community leaders have the right and responsibility to remove, edit, or reject 48 | comments, commits, code, wiki edits, issues, and other contributions that are 49 | not aligned to this Code of Conduct, and will communicate reasons for moderation 50 | decisions when appropriate. 51 | 52 | ## Scope 53 | 54 | This Code of Conduct applies within all community spaces, and also applies when 55 | an individual is officially representing the community in public spaces. 56 | Examples of representing our community include using an official e-mail address, 57 | posting via an official social media account, or acting as an appointed 58 | representative at an online or offline event. 59 | 60 | ## Enforcement 61 | 62 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 63 | reported to the community leaders responsible for enforcement at 64 | [dl_oss_dev@linecorp.com](mailto:dl_oss_linecorp.com). 65 | All complaints will be reviewed and investigated promptly and fairly. 66 | 67 | All community leaders are obligated to respect the privacy and security of the 68 | reporter of any incident. 69 | 70 | ## Enforcement Guidelines 71 | 72 | Community leaders will follow these Community Impact Guidelines in determining 73 | the consequences for any action they deem in violation of this Code of Conduct: 74 | 75 | ### 1. Correction 76 | 77 | **Community Impact**: Use of inappropriate language or other behavior deemed 78 | unprofessional or unwelcome in the community. 79 | 80 | **Consequence**: A private, written warning from community leaders, providing 81 | clarity around the nature of the violation and an explanation of why the 82 | behavior was inappropriate. A public apology may be requested. 83 | 84 | ### 2. Warning 85 | 86 | **Community Impact**: A violation through a single incident or series 87 | of actions. 88 | 89 | **Consequence**: A warning with consequences for continued behavior. No 90 | interaction with the people involved, including unsolicited interaction with 91 | those enforcing the Code of Conduct, for a specified period of time. This 92 | includes avoiding interactions in community spaces as well as external channels 93 | like social media. Violating these terms may lead to a temporary or 94 | permanent ban. 95 | 96 | ### 3. Temporary Ban 97 | 98 | **Community Impact**: A serious violation of community standards, including 99 | sustained inappropriate behavior. 100 | 101 | **Consequence**: A temporary ban from any sort of interaction or public 102 | communication with the community for a specified period of time. No public or 103 | private interaction with the people involved, including unsolicited interaction 104 | with those enforcing the Code of Conduct, is allowed during this period. 105 | Violating these terms may lead to a permanent ban. 106 | 107 | ### 4. Permanent Ban 108 | 109 | **Community Impact**: Demonstrating a pattern of violation of community 110 | standards, including sustained inappropriate behavior, harassment of an 111 | individual, or aggression toward or disparagement of classes of individuals. 112 | 113 | **Consequence**: A permanent ban from any sort of public interaction within 114 | the community. 115 | 116 | ## Attribution 117 | 118 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 119 | version 2.0, available at 120 | [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0]. 121 | 122 | Community Impact Guidelines were inspired by 123 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. 124 | 125 | For answers to common questions about this code of conduct, see the FAQ at 126 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available 127 | at [https://www.contributor-covenant.org/translations][translations]. 128 | 129 | [homepage]: https://www.contributor-covenant.org 130 | [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html 131 | [Mozilla CoC]: https://github.com/mozilla/diversity 132 | [FAQ]: https://www.contributor-covenant.org/faq 133 | [translations]: https://www.contributor-covenant.org/translations 134 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | [LINE API Use Caseサイト](https://lineapiusecase.com/ja/top.html)で提供している[Messaging API](https://lineapiusecase.com/ja/api/msgapi.html)のデモアプリケーションソースコードとなります。 3 | 今回紹介している手順を参考にすると、Messaging APIを活用したアプリケーションを開発することが可能です。 4 | Messaging APIは、あなたのサービスが用意したLINE公式アカウントで、LINEユーザーとコミュニケーションをとるためのAPIです。 5 | Messaging APIを利用することで、あなたが用意したサービスをLINEのトークルームで提供できます。 6 | 7 | なお、このページで紹介しているソースコードの環境はAWSを利用しています。 8 | 9 | ※ [The English version document is here.](./docs/en/README_en.md) 10 | 11 | # Libraries 12 | ## Python 13 | Pythonのバージョン3.8以上がインストール済みでない場合、インストールしてください。 14 | コマンドプロンプト、又はターミナルにて以下のコマンドを入力し、インストール済みか確認できます。 15 | ``` 16 | python --version 17 | 18 | Python 3.8.3 ← このように表示されたら、インストール済みです。 19 | ``` 20 | 21 | インストール済みでない場合、バックエンド側の開発で使用するPython(3.8以上)をローカル開発環境にインストールしてください。 22 | 23 | 【Pythonインストール参考サイト】 24 | Windows: https://www.python.jp/install/windows/install.html 25 | Mac: https://www.python.jp/install/macos/index.html 26 | 27 | ## AWS SAM 28 | 本アプリケーションのデプロイには、AWS サーバーレスアプリケーションモデル(AWS SAM)を利用します。 29 | [AWS公式ドキュメント](https://docs.aws.amazon.com/ja_jp/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html 30 | )を参考に、AWS アカウントの登録と設定、AWS SAM CLI と Docker のインストールを行ってください。 31 | ※ SAM CLIの推奨バージョンは1.15.0以上 32 | ※ Docker のインストールもローカルテストの有無に関わらず必要です。 33 | 34 | ### 公式ドキュメントの参考箇所 35 | 公式ドキュメントの以下の項目を完了させ、次の手順に進んでください。なお、既に導入済みのものは適宜飛ばして下さい。 36 | ※本資料は 2020 年 12 月に作成しているため、最新の公式ドキュメントの内容と齟齬がある可能性があります。 37 | 38 | 1. AWS SAM CLI のインストール 39 | 1. AWS 認証情報の設定 40 | 1. (任意)チュートリアル: Hello World アプリケーションの導入 41 | 42 | # Getting Started / Tutorial 43 | こちらの手順では、アプリケーション開発に必要な「LINEチャネル作成、リッチメニューの作成、バックエンドの構築、動作確認」について説明します。 44 | 以下リンク先の手順を参考にし、本番環境(AWS)とローカル環境の構築を行ってください。 45 | 46 | ### [LINE チャネルの作成](./docs/jp/liff-channel-create.md) 47 | ### [リッチメニューの作成](./docs/jp/richmenu-create.md) 48 | ### [バックエンドの構築](./docs/jp/back-end-construction.md) 49 | *** 50 | ### [動作確認](./docs/jp/validation.md) 51 | *** 52 | # License 53 | MessagingAPIの全てのファイルは、条件なしで自由にご利用いただけます。 54 | 自由にdownload&cloneをして、LINE APIを活用した素敵なアプリケーションの開発を始めてください! 55 | 56 | See [LICENSE](LICENSE) for more detail.(English) 57 | 58 | # How to contribute 59 | 60 | First of all, thank you so much for taking your time to contribute! LINE API Use Case Hair Salon is not very different from any other open source projects. It will be fantastic if you help us by doing any of the following: 61 | 62 | - File an issue in [the issue tracker](https://github.com/line/line-api-use-case-messaging-api/issues) to report bugs and propose new features and improvements. 63 | - Ask a question using [the issue tracker](https://github.com/line/line-api-use-case-messaging-api/issues). 64 | - Contribute your work by sending [a pull request](https://github.com/line/line-api-use-case-messaging-api/pulls). 65 | 66 | When you are sending a pull request, you'll be considered as being aware of and accepting the followings. 67 | - Grant [the same license](LICENSE) to the contribution 68 | - Represent the contribution is your own creation 69 | - Not expected to provide support for your contribution 70 | -------------------------------------------------------------------------------- /backend/APP/replymessage/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/backend/APP/replymessage/__init__.py -------------------------------------------------------------------------------- /backend/APP/replymessage/app.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import json 4 | import logging 5 | from linebot import ( 6 | LineBotApi, WebhookHandler 7 | ) 8 | from linebot.models import ( 9 | MessageEvent, PostbackEvent, FollowEvent, TextMessage, ImageMessage, 10 | TextSendMessage, FlexSendMessage, QuickReply, TemplateSendMessage, 11 | ConfirmTemplate, ButtonsTemplate 12 | ) 13 | from linebot.exceptions import ( 14 | LineBotApiError, InvalidSignatureError 15 | ) 16 | from common import (common_const, utils) 17 | 18 | 19 | # ログ出力設定 20 | LOGGER_LEVEL = os.environ.get("LOGGER_LEVEL") 21 | logger = logging.getLogger() 22 | if LOGGER_LEVEL == 'DEBUG': 23 | logger.setLevel(logging.DEBUG) 24 | else: 25 | logger.setLevel(logging.INFO) 26 | 27 | channel_secret = os.getenv('LINE_CHANNEL_SECRET', None) 28 | channel_access_token = os.getenv('LINE_CHANNEL_ACCESS_TOKEN', None) 29 | if channel_secret is None: 30 | logger.error('Specify LINE_CHANNEL_SECRET as environment variable.') 31 | sys.exit(1) 32 | if channel_access_token is None: 33 | logger.error('Specify LINE_CHANNEL_ACCESS_TOKEN as environment variable.') 34 | sys.exit(1) 35 | 36 | line_bot_api = LineBotApi(channel_access_token) 37 | handler = WebhookHandler(channel_secret) 38 | 39 | 40 | def get_sigunature(key_search_dict): 41 | """ 42 | 署名発行に必要なx-line-signatureを大文字小文字区別せずに取得し、署名内容を返却する 43 | 44 | Parameters 45 | ---------- 46 | key_search_dict : dict 47 | Webhookへのリクエストのheaders 48 | 49 | Returns 50 | ------- 51 | signature : str 52 | LINE Botの署名 53 | """ 54 | for key in key_search_dict.keys(): 55 | if key.lower() == 'x-line-signature': 56 | signature = key_search_dict[key] 57 | return signature 58 | 59 | 60 | def convert_user_id(event): 61 | """ 62 | LINE UserIdのマスク処理 63 | 64 | Parameters 65 | ---------- 66 | event : dict 67 | Webhookへのリクエスト内容。 68 | 69 | Returns 70 | ------- 71 | log_event : dict 72 | UserIdマスク後のリクエスト内容。 73 | """ 74 | log_body = json.loads(event['body']) 75 | update_body = [] 76 | for linebot_event in log_body['events']: 77 | linebot_event['source']['userId'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 78 | update_body.append(linebot_event) 79 | del log_body['events'] 80 | log_body['events'] = update_body 81 | log_event = event 82 | log_event['body'] = json.dumps(log_body, ensure_ascii=False) 83 | 84 | return log_event 85 | 86 | 87 | def lambda_handler(event, context): 88 | """ 89 | Webhookに送信されたLINEトーク内容を返却する 90 | 91 | Parameters 92 | ---------- 93 | event : dict 94 | Webhookへのリクエスト内容。 95 | context : dict 96 | コンテキスト内容。 97 | 98 | Returns 99 | ------- 100 | Response : dict 101 | Webhookへのレスポンス内容。 102 | """ 103 | log_event = event.copy() 104 | logger.info(convert_user_id(log_event)) 105 | signature = get_sigunature(event['headers']) 106 | body = event['body'] 107 | error_json = utils.create_error_response('Error') 108 | error_json['isBase64Encoded'] = False 109 | 110 | try: 111 | handler.handle(body, signature) 112 | except LineBotApiError as e: 113 | logger.error('Got exception from LINE Messaging API: %s\n' % e.message) 114 | for m in e.error.details: 115 | logger.error(' %s: %s' % (m.property, m.message)) 116 | return error_json 117 | except InvalidSignatureError as e: 118 | logger.error('Got exception from LINE Messaging API: %s\n' % e.message) 119 | return error_json 120 | else: 121 | ok_json = utils.create_success_response( 122 | json.dumps('Success')) 123 | ok_json['isBase64Encoded'] = False 124 | return ok_json 125 | 126 | # データを貯めるなどの処理を実施したい場合は、SQSなどにメッセージ通知をして、それをトリガーに別途Lambdaを起動して処理する 127 | 128 | 129 | @handler.add(MessageEvent, message=TextMessage) 130 | def text_message(line_event): 131 | """ 132 | Webhookに送信されたLINEメッセージ(テキスト)イベントについて処理を実施する 133 | 134 | Parameters 135 | ---------- 136 | line_event : dict 137 | LINEメッセージイベント内容。 138 | 139 | """ 140 | text = line_event.message.text 141 | line_bot_api.reply_message( 142 | line_event.reply_token, 143 | TextSendMessage(text=text)) 144 | 145 | 146 | @handler.add(MessageEvent, message=ImageMessage) 147 | def image_message(line_event): 148 | """ 149 | Webhookに送信されたLINEメッセージイベント(画像)について処理を実施する 150 | 151 | Parameters 152 | ---------- 153 | line_event: dict 154 | LINEメッセージイベント内容。 155 | 156 | """ 157 | line_bot_api.reply_message( 158 | line_event.reply_token, 159 | TextSendMessage(text='画像を受け付けました(画像は保存されません)')) 160 | 161 | 162 | @handler.add(PostbackEvent) 163 | def postback(line_event): 164 | """ 165 | Webhookに送信されたLINEポストバックイベントについて処理を実施する 166 | 167 | Parameters 168 | ---------- 169 | line_event: dict 170 | LINEメッセージイベント内容。 171 | 172 | """ 173 | param_list = line_event.postback.data.split('&') 174 | action = None 175 | action_type = None 176 | for param in param_list: 177 | if param.split('=')[0] == 'action': 178 | action = param.split('=')[1] 179 | elif param.split('=')[0] == 'lang': 180 | language = param.split('=')[1] 181 | else: 182 | action_type = param.split('=')[1] 183 | 184 | if action == 'send_message': 185 | if action_type == 'flex': 186 | flex_obj = FlexSendMessage.new_from_json_dict( 187 | common_const.const.FLEX) 188 | line_bot_api.reply_message( 189 | line_event.reply_token, flex_obj) 190 | elif action_type == 'carousel': 191 | carousel_template_message = common_const.const.CAROUSEL 192 | line_bot_api.reply_message( 193 | line_event.reply_token, carousel_template_message) 194 | elif action_type == 'message': 195 | line_bot_api.reply_message( 196 | line_event.reply_token, TextSendMessage(text='通常メッセージの送信デモ')) 197 | else: 198 | line_bot_api.reply_message( 199 | line_event.reply_token, TextSendMessage( 200 | text='Demonstration of sending Normal Message')) 201 | elif action == 'change_menu': 202 | logger.debug('change_menu: ' + action_type) 203 | line_bot_api.link_rich_menu_to_user( 204 | line_event.source.user_id, 205 | common_const.const.MENU_LIST[action_type]) 206 | elif action == 'reserve': 207 | logger.debug(line_event.postback.params) 208 | message = str(line_event.postback.params['datetime']) + 'に予約しました!' 209 | line_bot_api.reply_message(line_event.reply_token, 210 | TextSendMessage(text=message)) 211 | elif action == 'quick_reply': 212 | items = common_const.const.QUICK_REPLY_ITEMS 213 | messages = [ 214 | TextSendMessage(text='クイックリプライメニュー', 215 | quick_reply=QuickReply(items=items)), 216 | TextSendMessage(text='「位置情報」を送信する機能を希望しない場合は、端末の「位置情報共有」をオフにしてください。', # noqa 501 217 | quick_reply=QuickReply(items=items))] 218 | line_bot_api.reply_message( 219 | line_event.reply_token, 220 | messages=messages) 221 | 222 | 223 | @handler.add(FollowEvent) 224 | def follow(line_event): 225 | """ 226 | Webhookに送信されたLINEフォローイベントについて処理を実施する 227 | 228 | Parameters 229 | ---------- 230 | line_event: dict 231 | LINEメッセージイベント内容。 232 | 233 | """ 234 | # デフォルトのリッチメニューを表示する 235 | line_bot_api.link_rich_menu_to_user( 236 | line_event.source.user_id, 237 | common_const.const.MENU_LIST['message']) 238 | -------------------------------------------------------------------------------- /backend/APP/replymessage/requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/backend/APP/replymessage/requirements.txt -------------------------------------------------------------------------------- /backend/APP/samconfig.toml: -------------------------------------------------------------------------------- 1 | version = 0.1 2 | [default] 3 | [default.deploy] 4 | [default.deploy.parameters] 5 | region = "ap-northeast-1" 6 | capabilities = "CAPABILITY_NAMED_IAM" 7 | parameter_overrides = "Environment=\"dev\"" -------------------------------------------------------------------------------- /backend/APP/template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | LINE-Messaging-API-Demo 5 | 6 | SAM Template for LINE-Messaging-API-Demo 7 | 8 | Globals: 9 | Function: 10 | Timeout: 30 11 | MemorySize: !FindInMap [EnvironmentMap, !Ref Environment, LambdaMemorySize] 12 | 13 | Parameters: 14 | Environment: 15 | Type: String 16 | AllowedValues: 17 | - dev 18 | - prod 19 | Default: dev 20 | 21 | Mappings: 22 | EnvironmentMap: 23 | dev: 24 | LineChannelSecret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 25 | LineChannelAccessToken: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxFU= 26 | RichMenuMessage: richmenu-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 27 | RichMenuFlex: richmenu-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 28 | RichMenuCarousel: richmenu-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 29 | LayerVersion: 1 30 | LoggerLevel: INFO or DEBUG 31 | LambdaMemorySize: 128 32 | prod: 33 | LineChannelSecret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 34 | LineChannelAccessToken: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxFU= 35 | RichMenuMessage: richmenu-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 36 | RichMenuFlex: richmenu-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 37 | RichMenuCarousel: richmenu-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 38 | LayerVersion: 1 39 | LoggerLevel: INFO 40 | LambdaMemorySize: 128 41 | 42 | Resources: 43 | Replymessage: 44 | Type: AWS::Serverless::Function 45 | Properties: 46 | CodeUri: replymessage/ 47 | Handler: app.lambda_handler 48 | Runtime: python3.8 49 | Layers: 50 | - !Join 51 | - ":" 52 | - - !Sub "arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:layer" 53 | - !ImportValue MessagingAPILayerDev 54 | - !FindInMap [EnvironmentMap, !Ref Environment, LayerVersion] 55 | Environment: 56 | Variables: 57 | LINE_CHANNEL_SECRET: !FindInMap [EnvironmentMap, !Ref Environment, LineChannelSecret] 58 | LINE_CHANNEL_ACCESS_TOKEN: !FindInMap [EnvironmentMap, !Ref Environment, LineChannelAccessToken] 59 | RICH_MENU_MESSAGE: !FindInMap [EnvironmentMap, !Ref Environment, RichMenuMessage] 60 | RICH_MENU_CAROUSEL: !FindInMap [EnvironmentMap, !Ref Environment, RichMenuCarousel] 61 | RICH_MENU_FLEX: !FindInMap [EnvironmentMap, !Ref Environment, RichMenuFlex] 62 | LOGGER_LEVEL: !FindInMap [EnvironmentMap, !Ref Environment, LoggerLevel] 63 | Events: 64 | ReplyMessage: 65 | Type: Api 66 | Properties: 67 | Path: /replymessage 68 | Method: post 69 | RestApiId: 70 | Ref: ReplyMessageApiGatewayApi 71 | ReplyMessageApiGatewayApi: 72 | Properties: 73 | StageName: !Ref Environment 74 | OpenApiVersion: 3.0.2 75 | Type: AWS::Serverless::Api 76 | 77 | 78 | Outputs: 79 | ReplyMessageApi: 80 | Description: "API Gateway endpoint URL for Replymessage function" 81 | Value: !Sub "https://${ReplyMessageApiGatewayApi}.execute-api.${AWS::Region}.amazonaws.com/${Environment}/replymessage/" 82 | ReplymessageFunction: 83 | Description: "Replymessage Lambda Function ARN" 84 | Value: !GetAtt Replymessage.Arn 85 | RichMenuMessage : 86 | Description: "RichMenuID for Message" 87 | Value: !FindInMap [EnvironmentMap, !Ref Environment, RichMenuMessage] 88 | RichMenuCarousel : 89 | Description: "RichMenuID for Carousel" 90 | Value: !FindInMap [EnvironmentMap, !Ref Environment, RichMenuCarousel] 91 | RichMenuFlex : 92 | Description: "RichMenuID for Flex" 93 | Value: !FindInMap [EnvironmentMap, !Ref Environment, RichMenuFlex] 94 | 95 | -------------------------------------------------------------------------------- /backend/Layer/layer/common/common_const.py: -------------------------------------------------------------------------------- 1 | """ 2 | Constant types in Python. 3 | 定数上書きチェック用 4 | """ 5 | import os 6 | from common import const 7 | from datetime import timedelta 8 | 9 | from linebot.models import ( 10 | TemplateSendMessage, CarouselTemplate, CarouselColumn, MessageAction, 11 | QuickReplyButton, CameraAction, CameraRollAction, LocationAction 12 | ) 13 | 14 | const.API_PROFILE_URL = 'https://api.line.me/v2/profile' 15 | const.API_NOTIFICATIONTOKEN_URL = 'https://api.line.me/message/v3/notifier/token' # noqa: E501 16 | const.API_SENDSERVICEMESSAGE_URL = 'https://api.line.me/message/v3/notifier/send?target=service' # noqa 501 17 | const.API_USER_ID_URL = 'https://api.line.me/oauth2/v2.1/verify' 18 | 19 | const.MSG_ERROR_NOPARAM = 'パラメータ未設定エラー' 20 | const.DATA_LIMIT_TIME = 60 * 60 * 12 21 | const.ONE_WEEK = timedelta(days=7) 22 | const.JST_UTC_TIMEDELTA = timedelta(hours=9) 23 | 24 | 25 | const.FLEX = { 26 | "type": "flex", 27 | "altText": "Flex Message", 28 | "contents": { 29 | "type": "bubble", 30 | "hero": { 31 | "type": "image", 32 | "url": "https://media.istockphoto.com/photos/empty-coffee-shop-picture-id1154756901", # noqa:E501 33 | "size": "full", 34 | "aspectRatio": "1:1", 35 | "aspectMode": "cover", 36 | "action": { 37 | "type": "uri", 38 | "label": "UseCase Cafe", 39 | "uri": "https://line.me/ja/" 40 | } 41 | }, 42 | "body": { 43 | "type": "box", 44 | "layout": "vertical", 45 | "contents": [ 46 | { 47 | "type": "text", 48 | "text": "LINE Cafe", 49 | "size": "xl", 50 | "weight": "bold" 51 | }, 52 | { 53 | "type": "box", 54 | "layout": "baseline", 55 | "margin": "md", 56 | "contents": [ 57 | { 58 | "type": "icon", 59 | "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png", # noqa:E501 60 | "size": "sm" 61 | }, 62 | { 63 | "type": "icon", 64 | "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png", # noqa:E501 65 | "size": "sm" 66 | }, 67 | { 68 | "type": "icon", 69 | "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png", # noqa:E501 70 | "size": "sm" 71 | }, 72 | { 73 | "type": "icon", 74 | "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gold_star_28.png", # noqa:E501 75 | "size": "sm" 76 | }, 77 | { 78 | "type": "icon", 79 | "url": "https://scdn.line-apps.com/n/channel_devcenter/img/fx/review_gray_star_28.png", # noqa:E501 80 | "size": "sm" 81 | }, 82 | { 83 | "type": "text", 84 | "text": "4.0", 85 | "flex": 0, 86 | "margin": "md", 87 | "size": "sm", 88 | "color": "#999999" 89 | } 90 | ] 91 | }, 92 | { 93 | "type": "box", 94 | "layout": "vertical", 95 | "spacing": "sm", 96 | "margin": "lg", 97 | "contents": [ 98 | { 99 | "type": "box", 100 | "layout": "baseline", 101 | "spacing": "sm", 102 | "contents": [ 103 | { 104 | "type": "text", 105 | "text": "Place", 106 | "flex": 1, 107 | "size": "sm", 108 | "color": "#AAAAAA" 109 | }, 110 | { 111 | "type": "text", 112 | "text": "Miraina Tower, 4-1-6 Shinjuku, Tokyo", # noqa:E501 113 | "flex": 5, 114 | "size": "sm", 115 | "color": "#666666", 116 | "wrap": True 117 | } 118 | ] 119 | }, 120 | { 121 | "type": "box", 122 | "layout": "baseline", 123 | "spacing": "sm", 124 | "contents": [ 125 | { 126 | "type": "text", 127 | "text": "Time", 128 | "flex": 1, 129 | "size": "sm", 130 | "color": "#AAAAAA" 131 | }, 132 | { 133 | "type": "text", 134 | "text": "10:00 - 23:00", 135 | "flex": 5, 136 | "size": "sm", 137 | "color": "#666666", 138 | "wrap": True 139 | } 140 | ] 141 | } 142 | ] 143 | } 144 | ] 145 | }, 146 | "footer": { 147 | "type": "box", 148 | "layout": "vertical", 149 | "flex": 0, 150 | "spacing": "sm", 151 | "contents": [ 152 | { 153 | "type": "button", 154 | "action": { 155 | "type": "uri", 156 | "label": "WEBサイト", 157 | "uri": "https://line.me/ja/" 158 | }, 159 | "height": "sm", 160 | "style": "link" 161 | }, 162 | { 163 | "type": "button", 164 | "action": { 165 | "type": "datetimepicker", 166 | "label": "予約", 167 | "data": "action=reserve", 168 | "mode": "datetime", 169 | "initial": "2020-01-01t00:00", 170 | "max": "2020-12-31t23:59", 171 | "min": "2020-01-01t00:00" 172 | }, 173 | "height": "sm", 174 | "style": "link" 175 | }, 176 | { 177 | "type": "button", 178 | "action": { 179 | "type": "postback", 180 | "label": "クイックアクション", 181 | "data": "action=quick_reply", 182 | }, 183 | "height": "sm", 184 | "style": "link" 185 | }, 186 | { 187 | "type": "spacer", 188 | "size": "sm" 189 | } 190 | ] 191 | } 192 | } 193 | } 194 | 195 | const.CAROUSEL = TemplateSendMessage( 196 | alt_text='Carousel template', 197 | template=CarouselTemplate( 198 | columns=[ 199 | CarouselColumn( 200 | thumbnail_image_url='https://media.istockphoto.com/photos/neon-sale-glowing-text-sign-sale-banner-design-3d-render-glow-sale-picture-id854550186', # noqa:E501 201 | title='最大80%OFF', 202 | text='期間限定SALE', 203 | actions=[ 204 | MessageAction( 205 | label='Go to SALE', 206 | text='Choose SALE' 207 | ) 208 | ] 209 | ), 210 | CarouselColumn( 211 | thumbnail_image_url='https://media.istockphoto.com/photos/womens-clothes-set-isolatedfemale-clothing-collage-picture-id1067767654', # noqa:E501 212 | title='今月のおススメ商品', 213 | text='これがあれば困らない!', 214 | actions=[ 215 | MessageAction( 216 | label='Recommended', 217 | text='Choose Recommended' 218 | ) 219 | ] 220 | ), 221 | CarouselColumn( 222 | thumbnail_image_url='https://media.istockphoto.com/photos/clothes-hanging-on-rail-in-white-wardrobe-picture-id518597694', # noqa:E501 223 | title='スッキリ収納特集', 224 | text='大切なお洋服をスッキリ簡単に収納します', 225 | actions=[ 226 | MessageAction( 227 | label='To receive clothes', 228 | text='Choose receive clothes' 229 | ) 230 | ] 231 | ) 232 | ] 233 | ) 234 | ) 235 | 236 | const.QUICK_REPLY_ITEMS = [ 237 | QuickReplyButton(action=LocationAction(label='位置情報')), 238 | QuickReplyButton(action=CameraAction(label='カメラ起動')), 239 | QuickReplyButton(action=CameraRollAction(label='カメラロール起動')), 240 | ] 241 | 242 | const.MENU_LIST = {'message': os.getenv('RICH_MENU_MESSAGE', None), 243 | 'carousel': os.getenv('RICH_MENU_CAROUSEL', None), 244 | 'flex': os.getenv('RICH_MENU_FLEX', None) 245 | } 246 | -------------------------------------------------------------------------------- /backend/Layer/layer/common/const.py: -------------------------------------------------------------------------------- 1 | """ 2 | Constant types in Python. 3 | 定数上書きチェック用 4 | """ 5 | import sys 6 | 7 | 8 | class Const: 9 | class ConstError(TypeError): 10 | pass 11 | 12 | def __setattr__(self, name, value): 13 | if name in self.__dict__: 14 | raise self.ConstError("Can't rebind const (%s)" % name) 15 | self.__dict__[name] = value 16 | 17 | 18 | sys.modules[__name__] = Const() 19 | -------------------------------------------------------------------------------- /backend/Layer/layer/common/utils.py: -------------------------------------------------------------------------------- 1 | """ 2 | 共通関数 3 | """ 4 | 5 | 6 | def create_response(status_code, body): 7 | """ 8 | フロントに返却するデータを作成する 9 | 10 | Parameters 11 | ---------- 12 | status_code : int 13 | フロントに返却するステータスコード 14 | body:dict,str 15 | フロントに返却するbodyに格納するデータ 16 | Returns 17 | ------- 18 | response : dict 19 | フロントに返却するデータ 20 | """ 21 | response = { 22 | 'statusCode': status_code, 23 | 'headers': {"Access-Control-Allow-Origin": "*"}, 24 | 'body': body 25 | } 26 | return response 27 | 28 | 29 | def create_error_response(body, status=500): 30 | """ 31 | エラー発生時にフロントに返却するデータを作成する 32 | 33 | Parameters 34 | ---------- 35 | body : dict,str 36 | フロントに返却するbodyに格納するデータ 37 | status:int 38 | フロントに返却するステータスコード 39 | Returns 40 | ------- 41 | create_response:dict 42 | フロントに返却するデータ 43 | """ 44 | return create_response(status, body) 45 | 46 | 47 | def create_success_response(body): 48 | """ 49 | 正常終了時にフロントに返却するデータを作成する 50 | 51 | Parameters 52 | ---------- 53 | body : dict,str 54 | フロントに返却するbodyに格納するデータ 55 | Returns 56 | ------- 57 | create_response:dict 58 | フロントに返却するデータ 59 | """ 60 | return create_response(200, body) 61 | -------------------------------------------------------------------------------- /backend/Layer/layer/requirements.txt: -------------------------------------------------------------------------------- 1 | line-bot-sdk==1.17.0 -------------------------------------------------------------------------------- /backend/Layer/samconfig.toml: -------------------------------------------------------------------------------- 1 | version = 0.1 2 | [default] 3 | [default.deploy] 4 | [default.deploy.parameters] 5 | region = "ap-northeast-1" 6 | capabilities = "CAPABILITY_NAMED_IAM" 7 | parameter_overrides = "Environment=\"dev\"" -------------------------------------------------------------------------------- /backend/Layer/template.yaml: -------------------------------------------------------------------------------- 1 | # Stack:LINE-UseCase-Layer 2 | AWSTemplateFormatVersion: "2010-09-09" 3 | Transform: AWS::Serverless-2016-10-31 4 | Description: > 5 | LINE-UseCase-Layer-Sample 6 | 7 | # More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst 8 | Globals: 9 | Function: 10 | Timeout: 30 11 | 12 | Parameters: 13 | Environment: 14 | Type: String 15 | AllowedValues: 16 | - dev 17 | - prod 18 | Default: dev 19 | 20 | Mappings: 21 | EnvironmentMap: 22 | dev: 23 | LayerName: LINE-USECASE-MESSAGING-API-LAYER-DEV 24 | prod: 25 | LayerName: LINE-USECASE-MESSAGING-API-LAYER-PROD 26 | 27 | Resources: 28 | UseCaseLayerDev: 29 | Type: AWS::Serverless::LayerVersion 30 | Properties: 31 | CompatibleRuntimes: 32 | - python3.8 33 | ContentUri: layer 34 | Description: LambdaLayer 35 | CompatibleRuntimes: 36 | - python3.8 37 | LayerName: !FindInMap [EnvironmentMap, !Ref Environment, LayerName] 38 | Metadata: 39 | BuildMethod: python3.8 40 | 41 | Outputs: 42 | # ServerlessRestApi is an implicit API created out of Events key under Serverless::Function 43 | # Find out more about other implicit resources you can reference within SAM 44 | # https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api 45 | UseCaseLayerDev: 46 | Description: "UseCaseLayerDev Layer ARN" 47 | Value: !Ref UseCaseLayerDev 48 | UseCaseLayerName: 49 | Description: "UseCaseLayerDev Layer Name" 50 | Value: !FindInMap [EnvironmentMap, !Ref Environment, LayerName] 51 | Export: 52 | Name: MessagingAPILayerDev -------------------------------------------------------------------------------- /docs/en/README_en.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | 3 | This is the demo app source code for the [Messaging API](https://lineapiusecase.com/en/api/msgapi.html) provided on the [LINE API Use Case site](https://lineapiusecase.com/en/top.html). By referring to the steps described in this article, you can develop an app that uses Messaging API. 4 | 5 | Messaging API is an API that allows you to communicate with LINE users through the LINE Official Account you prepared. By using the Messaging API, you can offer your services in LINE chat rooms. 6 | 7 | The source code environment introduced on this page uses AWS. 8 | 9 | ※ [日本語ドキュメントはこちらからご確認いただけます。](../../README.md) 10 | 11 | # Libraries 12 | 13 | ## Python 14 | 15 | Install Python version 3.8 or later if it isn't already installed. 16 | 17 | You can check if it's installed by entering this command in Command Prompt or Terminal: 18 | 19 | ``` 20 | python --version 21 | ``` 22 | 23 | If Python is installed, the version will be returned. For example: 24 | 25 | ``` 26 | Python 3.8.3 27 | ``` 28 | 29 | Install Python (3.8 or higher), used for back-end development, in your local development environment if it's not already installed. 30 | 31 | Python installation reference site: 32 | 33 | Windows: https://docs.python.org/3/using/windows.html 34 | Mac: https://docs.python.org/3/using/mac.html 35 | 36 | ## AWS SAM 37 | 38 | The AWS Serverless Application Model (AWS SAM) is used to deploy this app. 39 | 40 | See the [official AWS documentation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) to register and set up an AWS account, and install the AWS SAM CLI and Docker. 41 | 42 | *Recommended version of SAM CLI is 1.15.0 or later. 43 | *Docker installation is also required, with or without local testing. 44 | 45 | ### Reference points in the official documentation 46 | 47 | Complete these items in the official documentation and proceed to the next step. If you have already installed it, you can skip this section. 48 | 49 | *This document was created in December 2020 and may be inconsistent with the latest official documentation. 50 | 51 | 1. Install AWS SAM CLI 52 | 1. Set up AWS authentication credentials 53 | 1. (Optional) Tutorial: Deploying the Hello World app 54 | 55 | # Getting Started / Tutorial 56 | 57 | This procedure explains how to create a LINE channel, build the backend and frontend, and check the operation, which are necessary for app development. 58 | 59 | See these steps to build your local and production (AWS) environment: 60 | 61 | - **[Create a LINE channel](liff-channel-create.md)** 62 | - **[Create a rich menu](richmenu-create.md)** 63 | - **[Build the back-end](back-end-construction.md)** 64 | *** 65 | - **[Check operation](validation.md)** 66 | *** 67 | 68 | # License 69 | 70 | All files on Messaging API are free to use without conditions. 71 | 72 | Download and clone to start developing apps using LINE API. 73 | 74 | See [LICENSE](LICENSE) for details. (English) 75 | 76 | # How to contribute 77 | 78 | Thank you for taking the time to contribute. LINE API Use Case Messaging API isn't different from any other open source projects. You can help by: 79 | 80 | - Filing an issue in [the issue tracker](https://github.com/line/line-api-use-case-messaging-api/issues) to report bugs and propose new features and improvements. 81 | - Asking a question using [the issue tracker](https://github.com/line/line-api-use-case-messaging-api/issues). 82 | - Contributing your work by submitting [a pull request](https://github.com/line/line-api-use-case-messaging-api/pulls). 83 | 84 | When you are sending a pull request, be aware of and accepting the following: 85 | 86 | - Grant [the same license](LICENSE) to the contribution 87 | - Represent the contribution is your own creation 88 | - Not expected to give support for your contribution 89 | -------------------------------------------------------------------------------- /docs/en/back-end-construction.md: -------------------------------------------------------------------------------- 1 | # Steps to build the backend 2 | 3 | ## Deploy peripheral resources 4 | 5 | These peripheral resources need to be deployed for this app: 6 | 7 | 1. Common processing layer (Layer) 8 | 9 | ### 1. Common processing layer (Layer) 10 | 11 | In AWS Lambda, you can describe the process you want to use in common with multiple Lambda functions as a layer. 12 | Since this app uses layers, first deploy the layers by following these steps: 13 | 14 | - Change template.yaml 15 | Open template.yaml in the backend > Layer folder and change this parameter item in the EnvironmentMap dev: 16 | 17 | - `LayerName` any layer name 18 | 19 | - Run this command: 20 | 21 | ``` 22 | cd [backend > Layer folder] 23 | sam build --use-container 24 | sam deploy --guided 25 | *Must be specified when using profile information that's not the default (`sam deploy --guided --profile xxx`) 26 | Stack Name: any stack name 27 | AWS Region: ap-northeast-1 28 | Parameter Environment: dev 29 | #Shows you resources changes to be deployed and require a 'Y' to initiate deploy Confirm changes before deploy [Y/n]: Y 30 | #SAM needs permission to be able to create roles to connect to the resources in your template Allow SAM CLI IAM role creation[Y/n]: Y 31 | Save arguments to samconfig.toml [Y/n]: Y 32 | 33 | SAM configuration file [samconfig.toml]: Press Enter only 34 | SAM configuration environment [default]: Press Enter only 35 | 36 | Deploy this changeset? [y/N]: y 37 | ``` 38 | 39 | - Note the layer version 40 | After deployment, the layer ARN and layer version will be displayed in the Output section of the terminal, so make sure to note the layer version. 41 | The layer version is the part with the numbers at the end 42 | *The version is updated every time you deploy, so the correct version for your first deployment is version 1. 43 | ![Output section of the command prompt](../images/en/out-put-description-en.png) 44 | 45 | - [Confirmation] Open the Lambda console in the AWS Management Console, select "Layers" from the left tab, and confirm that the layer you deployed this time exists. 46 | 47 | 48 | ## Deploy the application (APP) 49 | 50 | Follow these steps to deploy the app: 51 | 52 | - Change template.yaml 53 | Open template.yaml in the backend > APP folder, and modify these parameter items of dev in EnvironmentMap: 54 | 55 | - `LineChannelSecret` Channel secret for the Messaging API channel created in [Creating a LINE channel] 56 | - `LineChannelAccessToken` Channel access token for the Messaging API channel created in [Creating a LINE channel] 57 | - `RichMenuMessage` Rich menu ID for <1. send message menu> created in [Creating a Rich Menu] 58 | - `RichMenuFlex` Rich menu ID for <2. send flex-message menu> created in [Creating a Rich Menu] 59 | - `RichMenuCarousel` Rich menu ID for <3. send carousel-message menu> created in [Creating a Rich Menu] 60 | - `LayerVersion` The version number of the layer deployed in the [1. Common processing layer] procedure 61 | Example: LayerVersion: 1 62 | - `LoggerLevel` INFO or Debug 63 | - `LambdaMemorySize` Lambda memory size 64 | Example) LambdaMemorySize: 128 *If you don't need to change it, specify the minimum size of 128 65 | 66 | - Run this command: 67 | 68 | ``` 69 | cd [backend > APP folder] 70 | sam build --use-container 71 | sam deploy --guided 72 | *Must be specified when using profile information that's not the default (`sam deploy --guided --profile xxx`) 73 | Stack Name: any stack name 74 | AWS Region: ap-northeast-1 75 | Parameter Environment: dev 76 | #Shows you resources changes to be deployed and require a 'Y' to initiate deploy Confirm changes before deploy [Y/n]: Y 77 | #SAM needs permission to be able to create roles to connect to the resources in your template Allow SAM CLI IAM role creation[Y/n]: Y 78 | ××××× may not have authorization defined, Is this okay? [y/N]: y (Input "y" for all) 79 | 80 | SAM configuration file [samconfig.toml]: Press Enter only 81 | SAM configuration environment [default]: Press Enter only 82 | 83 | Save arguments to samconfig.toml [Y/n]: Y 84 | Deploy this changeset? [y/N]: y 85 | ``` 86 | 87 | - Notes for API Gateway URL 88 | Make a note of the API Gateway endpoint that is displayed in OutPut when the deployment is successful. It will be used in later steps. 89 | 90 | ## Error handling 91 | 92 | - If you encounter the following error when deploying, follow this procedure to resolve it. 93 | ``` 94 | Export with name xxxxx is already exported by stack sam-app. Rollback requested by user. 95 | ``` 96 | - Deploy after modifying backend > Layer > template.yaml with reference to the following: 97 | ``` 98 | Outputs: 99 | UseCaseLayerName: 100 | Description: "UseCaseLayerDev Layer Name" 101 | Value: !FindInMap [EnvironmentMap, !Ref Environment, LayerName] 102 | Export: 103 | Name: MessagingAPILayerDev > Modify this to any name you want 104 | ``` 105 | - Modify backend > batch > template.yaml with reference to the following description. 106 | ``` 107 | !ImportValue MessagingAPILayerDev > Modify MessagingAPILayerDev to the name you just entered 108 | ``` 109 | - Modify backend > APP > template.yaml with reference to the following description. 110 | ``` 111 | !ImportValue MessagingAPILayerDev > Modify MessagingAPILayerDev to the name you just entered 112 | ``` 113 | 114 | [Next page](validation.md) 115 | 116 | [Back to Table of Contents](README_en.md) 117 | -------------------------------------------------------------------------------- /docs/en/liff-channel-create.md: -------------------------------------------------------------------------------- 1 | # Creating a LINE channel 2 | 3 | A channel is a communication path between a system created by a developer and the LINE Platform. 4 | The following LINE channels are required for this app. Follow these instructions to create them. 5 | 6 | 1. LINE channel for Messaging API 7 | ・Channel creation (Japanese only): https://developers.line.biz/ja/docs/clova-extensions-kit/create-messaging-api-channel-t4/ 8 | ・About Messaging API: https://lineapiusecase.com/en/api/msgapi.html 9 | 10 | ## 1. Create a LINE account 11 | 12 | *Skip this step if you already have a LINE account. 13 | 14 | 1. Download the LINE app from the download link below and create a LINE account 15 | https://line.me/en/ 16 | 17 | ## 2. Log in to LINE Developers 18 | 19 | LINE Developers is a site for developers to create LINE Official Accounts and LIFF apps required for this app. You can develop apps by logging in to the LINE Developers site using your LINE account. 20 | 21 | 1. Click this link and go to the login screen. 22 | https://developers.line.biz/en/ 23 | 1. Log in with your LINE account. 24 | 1. Enter the email address and password set for your LINE account, or use the QR code login to scan the QR code from another device to log in. 25 | *If you want to log in with your email address, you'll need to set it up separately in the LINE app. For more information, see: 26 | https://appllio.com/line-mail-address-settings 27 | 28 | ## 3. Create a provider 29 | 30 | A provider is a team, company, or individual that manages multiple channels. Providers and channels have a one-to-many relationship. 31 | 32 | 1. While logged in to LINE Developers, access the LINE Developers Console. 33 | https://developers.line.biz/console/ 34 | 2. Click the Create button next to Provider. 35 | ![Creating a provider_1_ Image of the created part surrounded by a square](../images/en/line-provider-create-1-en.png) 36 | 3. Enter a provider name and click Create. 37 | 4. Confirm that the provider has been created and that your see this screen. 38 | ![Creating a Provider_2](../images/en/line-provider-create-2-en.png) 39 | 40 | ## 4. Create a channel 41 | 42 | 1. Create a channel for the Messaging API 43 | 1. On the provider screen that you just created, click Messaging API. 44 | ![Create Channel_Image surrounding the Messaging API part](../images/en/line-channel-create-1-en.png) 45 | 1. Set the items as follows: 46 | 1. Channel type: No change 47 | 1. Provider: No change 48 | 1. Channel icon: No change 49 | 1. Channel name: Any channel name 50 | *The channel name is the account name that will be displayed when the end user adds your account a friend. You can change it later. 51 | 1. Channel description: Any description 52 | 1. Large industry: Industry that matches the application content 53 | 1. Small industry: Industry that matches the application content 54 | 1. Email: No change 55 | 1. Privacy Policy URL: Optional 56 | 1. Terms of Service URL: Optional 57 | 1. Read the LINE Official Account Terms of Service and LINE Official Account API Terms of Service, and select "I agree." 58 | 1. Click Create to create a channel. 59 | 1. The screen of the created channel will appear as shown in the image below, confirming that the channel creation is complete.. 60 | ![Creating a channel_2](../images/en/line-channel-create-2-en.png) 61 | The channel secret shown in the Channel Preferences tab will be used in the following steps, so make a note of it. 62 | 1. Go to the Messaging API tab, issue a channel access token (long-term), and make a note of it. It will be used in the following steps. 63 | 64 | [Next page](richmenu-create.md) 65 | 66 | [Back to Table of Contents](README_en.md) 67 | -------------------------------------------------------------------------------- /docs/en/richmenu-create.md: -------------------------------------------------------------------------------- 1 | # Rich menu settings 2 | 3 | The rich menu used in this application uses the API for creating the Messaging API's rich menu. We'll also walk you through the steps using Postman to make it easier to set up. See below for other details. 4 | 5 | Rich Menu specs: https://developers.line.biz/en/docs/messaging-api/using-rich-menus/ 6 | Rich Menu API: https://developers.line.biz/en/reference/messaging-api/#rich-menu 7 | 8 | ## Install Postman 9 | 10 | In the procedure for creating a rich menu, we will use Postman. 11 | If you want to install the rich menu according to this procedure, install the one that suits your environment from this URL. 12 | https://www.postman.com/downloads/ 13 | 14 | ## Rich menu settings 15 | 16 | 1. Creating a Rich Menu 17 | 1. Start Postman 18 | 1. From Import, open richmenu_setting > rich menu.postman_collection.json folder 19 | ![postman_import](../images/en/postman_import-en.png) 20 | 1. Enter the long-term access token for the channel issued in [Create a channel for the Messaging API] in the {channel access token} field of the Headers/Authorization value in the <1. send message menu> and save the file by overwriting 21 | At this time, please put a space between Bearer and {channel access token} 22 | 1. Press "Send" to confirm the Rich Menu ID from Response, and write it down 23 | ![send_richmenu](../images/en/send_richmenu-en.png) 24 | 1. For <2.send flex-message menu> and <3.send carousel-message menu>, follow steps 3 and 4 to issue a rich menu ID 25 | 1. Set the image for the rich menu 26 | 1. Enter the long-term access token for the channel issued in [Create a channel for the Messaging API] in the {channel access token} field of the Headers/Authorization value in the <4. link richmenu and image> and save the file by overwriting 27 | At this time, please put a space between Bearer and {channel access token} 28 | 1. In the URL of <4.link richmenu and image>, enter the richmenuID returned by <1. send message menu> in the {richmenuid returned by 1,2,3} field and overwrite the file 29 | 1. In the Body tab, select binary, and in selectFile, select message_ja.png in the richmenu_setting > menu_img folder 30 | ![richmenu-image-link](../images/en/richmenu-image-link-en.png) 31 | 1. Click Send and make sure that {} is returned in Response 32 | *If the response is other than {}, there is an error. Please check and try again 33 | 1. The above steps are also performed for the richmenu IDs issued in <2. send flex-message menu> and <3. send carousel-message menu>. For the image, select flex_en.png for the richmenuID of <2.send flex-message menu> and select carousel_en.png for the richmenuID of <3.send carousel-message menu>. 34 | 35 | 36 | [Next page](back-end-construction.md) 37 | 38 | [Back to Table of Contents](README_en.md) 39 | -------------------------------------------------------------------------------- /docs/en/validation.md: -------------------------------------------------------------------------------- 1 | # Operation check 2 | 3 | ## Configure the Webhook Url 4 | 5 | Set the Webhook URL for the Messaging API channel you created in [Create a LINE Channel > Create a channel for the Messaging API]. 6 | 7 | 1. In the [LINE Developers Console](https://developers.line.biz/console/), go to the Messaging API channel you created in [Create a LINE Channel > Create a channel for the Messaging API]. 8 | 9 | 1. Select the Messaging API Settings tab and, in the Webhook URL, enter the API Gateway endpoint that you made a note of in the "Building the Backend > Deploying the App" procedure. 10 | ![webhook-setting](../images/en/webhook-setting-en.png) 11 | 12 | 1. The setting is displayed, so update it so that it can be used. 13 | 14 | ## Disable the default response settings. 15 | 16 | In addition to the response settings set in the app, the response settings are enabled by default in LINE Official Account Manager, so disable them. 17 | 18 | 1. In the [LINE Developers Console](https://developers.line.biz/console/), go to the Messaging API channel you created in [Create a LINE Channel > Create a channel for the Messaging API]. 19 | 20 | 1. Select the Messaging API Settings tab, click the Edit Response Message link in the LINE Official Account function, and go to the LINE Official Account Manager. 21 | 22 | 1. Turn off response messages in LINE Official Account Manager. 23 | 24 | # Operation check 25 | 26 | After you have completed all the steps, go to [Create a LINE Channel > Create a channel for the Messaging API] and add friends using the QR code displayed on the LINE Messaging API channel you have created. 27 | 28 | [Back to Table of Contents](README_en.md) 29 | -------------------------------------------------------------------------------- /docs/images/access_token_en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/access_token_en.png -------------------------------------------------------------------------------- /docs/images/bot-basic-id-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/bot-basic-id-en.png -------------------------------------------------------------------------------- /docs/images/channel-access-token-table-record-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/channel-access-token-table-record-en.png -------------------------------------------------------------------------------- /docs/images/en/access_token_en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/access_token_en.png -------------------------------------------------------------------------------- /docs/images/en/bot-basic-id-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/bot-basic-id-en.png -------------------------------------------------------------------------------- /docs/images/en/channel-access-token-table-record-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/channel-access-token-table-record-en.png -------------------------------------------------------------------------------- /docs/images/en/end-point-url-description-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/end-point-url-description-en.png -------------------------------------------------------------------------------- /docs/images/en/liff-console-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/liff-console-en.png -------------------------------------------------------------------------------- /docs/images/en/line-channel-create-1-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/line-channel-create-1-en.png -------------------------------------------------------------------------------- /docs/images/en/line-channel-create-2-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/line-channel-create-2-en.png -------------------------------------------------------------------------------- /docs/images/en/line-channel-create-3-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/line-channel-create-3-en.png -------------------------------------------------------------------------------- /docs/images/en/line-channel-create-4-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/line-channel-create-4-en.png -------------------------------------------------------------------------------- /docs/images/en/line-channel-create-add-liff-app-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/line-channel-create-add-liff-app-en.png -------------------------------------------------------------------------------- /docs/images/en/line-channel-create-add-liff-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/line-channel-create-add-liff-en.png -------------------------------------------------------------------------------- /docs/images/en/line-provider-create-1-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/line-provider-create-1-en.png -------------------------------------------------------------------------------- /docs/images/en/line-provider-create-2-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/line-provider-create-2-en.png -------------------------------------------------------------------------------- /docs/images/en/messaging_api_tab-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/messaging_api_tab-en.png -------------------------------------------------------------------------------- /docs/images/en/out-put-description-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/out-put-description-en.png -------------------------------------------------------------------------------- /docs/images/en/postman_import-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/postman_import-en.png -------------------------------------------------------------------------------- /docs/images/en/richmenu-image-link-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/richmenu-image-link-en.png -------------------------------------------------------------------------------- /docs/images/en/send_richmenu-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/send_richmenu-en.png -------------------------------------------------------------------------------- /docs/images/en/webhook-setting-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/en/webhook-setting-en.png -------------------------------------------------------------------------------- /docs/images/end-point-url-description-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/end-point-url-description-en.png -------------------------------------------------------------------------------- /docs/images/end-point-url-editing-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/end-point-url-editing-en.png -------------------------------------------------------------------------------- /docs/images/jp/access_token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/access_token.png -------------------------------------------------------------------------------- /docs/images/jp/bot-basic-id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/bot-basic-id.png -------------------------------------------------------------------------------- /docs/images/jp/channel-access-token-table-record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/channel-access-token-table-record.png -------------------------------------------------------------------------------- /docs/images/jp/liff-console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/liff-console.png -------------------------------------------------------------------------------- /docs/images/jp/line-channel-create-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/line-channel-create-1.png -------------------------------------------------------------------------------- /docs/images/jp/line-channel-create-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/line-channel-create-2.png -------------------------------------------------------------------------------- /docs/images/jp/line-channel-create-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/line-channel-create-3.png -------------------------------------------------------------------------------- /docs/images/jp/line-channel-create-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/line-channel-create-4.png -------------------------------------------------------------------------------- /docs/images/jp/line-channel-create-add-liff-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/line-channel-create-add-liff-app.png -------------------------------------------------------------------------------- /docs/images/jp/line-channel-create-add-liff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/line-channel-create-add-liff.png -------------------------------------------------------------------------------- /docs/images/jp/line-provider-create-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/line-provider-create-1.png -------------------------------------------------------------------------------- /docs/images/jp/line-provider-create-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/line-provider-create-2.png -------------------------------------------------------------------------------- /docs/images/jp/messaging_api_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/messaging_api_tab.png -------------------------------------------------------------------------------- /docs/images/jp/out-put-description.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/out-put-description.png -------------------------------------------------------------------------------- /docs/images/jp/postman_import.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/postman_import.png -------------------------------------------------------------------------------- /docs/images/jp/richmenu-image-link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/richmenu-image-link.png -------------------------------------------------------------------------------- /docs/images/jp/send_richmenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/send_richmenu.png -------------------------------------------------------------------------------- /docs/images/jp/webhook-setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/jp/webhook-setting.png -------------------------------------------------------------------------------- /docs/images/liff-console-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/liff-console-en.png -------------------------------------------------------------------------------- /docs/images/line-channel-create-1-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/line-channel-create-1-en.png -------------------------------------------------------------------------------- /docs/images/line-channel-create-2-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/line-channel-create-2-en.png -------------------------------------------------------------------------------- /docs/images/line-channel-create-3-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/line-channel-create-3-en.png -------------------------------------------------------------------------------- /docs/images/line-channel-create-4-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/line-channel-create-4-en.png -------------------------------------------------------------------------------- /docs/images/line-channel-create-add-liff-app-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/line-channel-create-add-liff-app-en.png -------------------------------------------------------------------------------- /docs/images/line-channel-create-add-liff-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/line-channel-create-add-liff-en.png -------------------------------------------------------------------------------- /docs/images/line-provider-create-1-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/line-provider-create-1-en.png -------------------------------------------------------------------------------- /docs/images/line-provider-create-2-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/line-provider-create-2-en.png -------------------------------------------------------------------------------- /docs/images/messaging_api_tab_en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/messaging_api_tab_en.png -------------------------------------------------------------------------------- /docs/images/out-put-description-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/out-put-description-en.png -------------------------------------------------------------------------------- /docs/images/postman_import_en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/postman_import_en.png -------------------------------------------------------------------------------- /docs/images/richmenu-image-link-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/richmenu-image-link-en.png -------------------------------------------------------------------------------- /docs/images/send_richmenu_en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/send_richmenu_en.png -------------------------------------------------------------------------------- /docs/images/webhook-setting-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/docs/images/webhook-setting-en.png -------------------------------------------------------------------------------- /docs/jp/back-end-construction.md: -------------------------------------------------------------------------------- 1 | # バックエンドの構築手順 2 | 3 | ## 周辺リソースのデプロイ 4 | 5 | 本アプリでは以下の周辺リソースをデプロイする必要があります。 6 | 7 | 1. 共通処理レイヤー(Layer) 8 | 9 | ### 1.共通処理レイヤー(Layer) 10 | 11 | AWS Lambda では複数 Lambda 関数で共通化して利用したい処理をレイヤーとして記述することが出来ます。 12 | 本アプリではレイヤーを利用しているので、はじめに以下の手順で、レイヤーをデプロイしてください。 13 | 14 | - template.yaml の修正 15 | backend-> Layer フォルダ内の template.yaml を開き、EnvironmentMap の dev の以下のパラメータ項目を修正する。 16 | 17 | - `LayerName` 任意のレイヤー名 18 | 19 | - 以下コマンドの実行 20 | 21 | ``` 22 | cd [backend -> Layerのフォルダ] 23 | sam build --use-container 24 | sam deploy --guided 25 | ※プロファイル情報(default)以外を使用する場合は指定必要 sam deploy --guided --profile xxx 26 | Stack Name : 任意のスタック名 27 | AWS Region : ap-northeast-1 28 | Parameter Environment: dev 29 | #Shows you resources changes to be deployed and require a 'Y' to initiate deploy Confirm changes before deploy [Y/n]: Y 30 | #SAM needs permission to be able to create roles to connect to the resources in your template Allow SAM CLI IAM role creation[Y/n]: Y 31 | Save arguments to samconfig.toml [Y/n]: Y 32 | 33 | SAM configuration file [samconfig.toml]: 入力せずEnter 34 | SAM configuration environment [default]: 入力せずEnter 35 | 36 | Deploy this changeset? [y/N]: y 37 | ``` 38 | 39 | - レイヤーバージョンをメモ 40 | デプロイ後、ターミナルの Outputs の項目に、レイヤー ARN とレイヤーバージョンが表示されるので、レイヤーバージョンをメモをしておく。 41 | レイヤーバージョンは末尾の数字の部分。 42 | ※バージョンはデプロイするたびに更新されるので、初めてのデプロイの場合バージョン 1 となっているのが正しいです。 43 | ![コマンドプロンプトのOutput部の画像](../images/jp/out-put-description.png) 44 | 45 | - 【確認】AWS マネジメントコンソールで Lambda のコンソールを開き、左タブから「レイヤー」を選択し、今回デプロイしたレイヤーがあることを確認する。 46 | 47 | 48 | ## アプリのデプロイ(APP) 49 | 50 | 以下の手順で、アプリ本体をデプロイしてください。 51 | 52 | - template.yaml の修正 53 | backend -> APP フォルダ内の template.yaml を開き、EnvironmentMap の dev の以下のパラメータ項目を修正する。 54 | 55 | - `LineChannelSecret` 【LINE チャネルの作成】で作成したMessaging API 用のチャネルのチャネルシークレット 56 | - `LineChannelAccessToken` 【LINE チャネルの作成】で作成したMessaging API 用のチャネルのチャネルアクセストークン 57 | - `RichMenuMessage` 【リッチメニューの作成】で作成した<1.send message menu>のリッチメニューID 58 | - `RichMenuFlex` 【リッチメニューの作成】で作成した<2.send flex-message menu>のリッチメニューID 59 | - `RichMenuCarousel` 【リッチメニューの作成】で作成した<3.send carousel-message menu>のリッチメニューID 60 | - `LayerVersion` 【1.共通処理レイヤー】の手順にてデプロイしたレイヤーのバージョン番号 61 | 例)LayerVersion: 1 62 | - `LoggerLevel` INFO or Debug 63 | - `LambdaMemorySize` Lambdaのメモリサイズ 64 | 例)LambdaMemorySize: 128 ※特に変更する必要がない場合、最小サイズの128を指定してください。 65 | 66 | - 以下コマンドの実行 67 | 68 | ``` 69 | cd [backend -> APP のフォルダ] 70 | sam build --use-container 71 | sam deploy --guided 72 | ※プロファイル情報(default)以外を使用する場合は指定必要 sam deploy --guided --profile xxx 73 | Stack Name : 任意のスタック名 74 | AWS Region : ap-northeast-1 75 | Parameter Environment: dev 76 | #Shows you resources changes to be deployed and require a 'Y' to initiate deploy Confirm changes before deploy [Y/n]: Y 77 | #SAM needs permission to be able to create roles to connect to the resources in your template Allow SAM CLI IAM role creation[Y/n]: Y 78 | ××××× may not have authorization defined, Is this okay? [y/N]: y (全てyと入力) 79 | 80 | SAM configuration file [samconfig.toml]: 入力せずEnter 81 | SAM configuration environment [default]: 入力せずEnter 82 | 83 | Save arguments to samconfig.toml [Y/n]: Y 84 | Deploy this changeset? [y/N]: y 85 | ``` 86 | 87 | - API Gateway URLのメモ 88 | デプロイ成功時にOutPutにて表示されるAPI Gateway endpointのメモを取ってください。後の手順にて利用します。 89 | 90 | ## エラー対応 91 | - デプロイ時、以下のようなエラーが出た場合、こちらの手順で解消してください。 92 | ``` 93 | Export with name xxxxx is already exported by stack sam-app. Rollback requested by user. 94 | ``` 95 | - backend -> Layer -> template.yamlを以下を参考に、修正後デプロイ 96 | ``` 97 | Outputs: 98 | UseCaseLayerName: 99 | Description: "UseCaseLayerDev Layer Name" 100 | Value: !FindInMap [EnvironmentMap, !Ref Environment, LayerName] 101 | Export: 102 | Name: MessagingAPILayerDev -> こちらを任意の名称に修正 103 | ``` 104 | - backend -> batch -> template.yamlを、以下の記載を参考に修正する。 105 | ``` 106 | !ImportValue MessagingAPILayerDev -> MessagingAPILayerDev を先ほど入力した名称に修正 107 | ``` 108 | - backend -> APP -> template.yamlを、以下の記載を参考に修正する。 109 | ``` 110 | !ImportValue MessagingAPILayerDev -> MessagingAPILayerDev を先ほど入力した名称に修正 111 | ``` 112 | 113 | [次の頁へ](validation.md) 114 | 115 | [目次へ戻る](../../README.md) 116 | -------------------------------------------------------------------------------- /docs/jp/liff-channel-create.md: -------------------------------------------------------------------------------- 1 | # LINE チャネルの作成 2 | 3 | チャネルは開発者が作成したシステムと LINE プラットフォームの通信を行うための通信路です。 4 | 本アプリでは以下の LINE チャネルが必要となるので、手順に従って作成してください。 5 | 6 | 1. MessagingAPI 用 LINE チャネル 7 | ・チャネル作成:https://developers.line.biz/ja/docs/clova-extensions-kit/create-messaging-api-channel-t4/ 8 | ・Messaging APIについて:https://lineapiusecase.com/ja/api/msgapi.html 9 | 10 | ## 1.LINE アカウントの作成 11 | 12 | ※LINE アカウントを所持していない場合のみ、こちらの手順を行ってください。 13 | 14 | 1. 以下リンクのダウンロードより、LINE アプリをダウンロードし、LINE アカウントを作成する 15 | https://line.me/ja/ 16 | 17 | ## 2.LINE Developers へのログイン 18 | 19 | LINE Developers は本アプリで必要な LINE 公式アカウントの作成や、LIFF アプリの作成を行うための開発者向けサイトです。LINE アカウントを用いて LINE Developers サイトにログインすることで、アプリの開発が可能になります。 20 | 21 | 1. 以下リンクにアクセスし、ログイン画面に遷移する 22 | https://developers.line.biz/ja/ 23 | 1. 「LINE アカウントでログイン」を行う 24 | 1. LINE アカウントに設定したメールアドレスとパスワードの入力を行うか、QR コードログインにより QR コードを別デバイスより読み取ってログインを行う 25 | ※メールアドレスによるログインを利用したい場合は別途 LINE アプリ側で設定する必要があります。詳細は以下のリンク参照。 26 | https://appllio.com/line-mail-address-settings 27 | 28 | ## 3.プロバイダーの作成 29 | 30 | プロバイダーは複数のチャネルを管理するチーム・会社・個人のようなひとまとまりの単位となります。プロバイダーとチャネルは一対多の関係です。 31 | 32 | 1. LINE Developes にログインした状態で、以下のコンソールに遷移する 33 | https://developers.line.biz/console/ 34 | 2. プロバイダー見出しの横にある作成ボタンを押下する 35 | ![プロバイターの作成_1_作成部分を四角で囲んだ画像](../images/jp/line-provider-create-1.png) 36 | 3. 任意のプロバイダー名を入力し、作成を押下する 37 | 4. プロバイダーが作成され、以下のような画面に遷移したことを確認する 38 | ![プロバイターの作成_2](../images/jp/line-provider-create-2.png) 39 | 40 | ## 4.チャネルの作成 41 | 42 | 1. Messaging API 用のチャネルを作成 43 | 1. 先ほど作成したプロバイダーの画面にて、Messaging API を押下する 44 | ![チャネルの作成_Messaging APIの部分を資格で囲んだ画像](../images/jp/line-channel-create-1.png) 45 | 1. 以下の通り、項目を設定する 46 | 1. チャネルの種類: 変更無し 47 | 1. プロバイダー: 変更無し 48 | 1. チャネルアイコン: 変更無し 49 | 1. チャネル名: 任意のチャネル名 50 | ※チャネル名はエンドユーザーが友達追加する際に表示されるアカウント名となります。後から変更可能です。 51 | 1. チャネル説明: 任意の説明 52 | 1. 大業種: アプリ内容に即した業種 53 | 1. 小業種: アプリ内容に即した業種 54 | 1. メールアドレス: 変更無し 55 | 1. プライバシーポリシー URL: 任意 56 | 1. サービス利用規約 URL: 任意 57 | 1. LINE 公式アカウント利用規約と LINE 公式アカウント API 利用規約に目を通して同意にチェックを入れる 58 | 1. 作成を押下し、チャネルを作成する 59 | 1. 以下画像のような作成したチャネルの画面が表示され、チャネルの作成が完了したことを確認する。 60 | ![チャネルの作成_2](../images/jp/line-channel-create-2.png) 61 | ※チャネル基本設定のタブに表示されているチャネルシークレットを以降の手順にて使用するので、メモを取っておいてください。 62 | 1. Messaging APIのタブに移動し、チャネルアクセストークン(長期)を発行して、メモを取っておく。※後の手順で利用します。 63 | 64 | [次の頁へ](richmenu-create.md) 65 | 66 | [目次へ戻る](../../README.md) 67 | -------------------------------------------------------------------------------- /docs/jp/richmenu-create.md: -------------------------------------------------------------------------------- 1 | # リッチメニューの設定 2 | 3 | 本アプリで使用するリッチメニューはMessagingAPIのリッチメニューを作成用APIを使用します。また、より簡単に設定いただけるようPostmanを使用した手順を説明します。その他の詳細は以下を参照ください。 4 | 5 | リッチメニューの仕様: https://developers.line.biz/ja/docs/messaging-api/using-rich-menus/ 6 | リッチメニューのAPI: https://developers.line.biz/ja/reference/messaging-api/#rich-menu 7 | 8 | ## Postmanのインストール 9 | リッチメニュー作成の手順では、Postmanを利用します。 10 | 本手順に従ってリッチメニューを導入する場合、以下URLから自身の環境に合ったものをインストールしてください。 11 | https://www.postman.com/downloads/ 12 | 13 | ## リッチメニューの設定 14 | 1. リッチメニューの作成 15 | 1. Postmanを起動する 16 | 1. Importから、richmenu_setting -> フォルダ内の rich menu.postman_collection.jsonを開く 17 | ![postman_import](../images/jp/postman_import.png) 18 | 1. <1.send message menu>のHeaders/AuthorizationのValueの{channel access token}に【Messaging API 用のチャネルを作成】で発行したチャネルの長期アクセストークンを入力してファイルを上書き保存する 19 | ※このとき、Bearerと{channel access token}の間には半角スペースを入れてください 20 | 1. Sendを押下するとResponseよりリッチメニューIDを確認できるので、控えておく 21 | ![send_richmenu](../images/jp/send_richmenu.png) 22 | 1. <2.send flex-message menu>と<3.send carousel-message menu>についても3,4の手順に従い、リッチメニューIDを発行する 23 | 1. リッチメニューの画像を設定する 24 | 1. <4.link richmenu and image>のHeaders/AuthorizationのValueの{channel access token}に【Messaging API 用のチャネルを作成】で発行したチャネルの長期アクセストークンを入力してファイルを上書き保存する 25 | ※このとき、Bearerと{channel access token}の間には半角スペースを入れてください 26 | 1. <4.link richmenu and image>のURLの{1,2,3で返却されたrichmenuid}に、<1.send message menu>にて返却されたrichmenuIDを入力して、ファイルを上書き保存する 27 | 1. Bodyタブにて、binaryを選択し、selectFileにて、ricimenu_setting -> menu_imgフォルダ のmessage_ja.pngを選択する。 28 | ![richmenu-image-link](../images/jp/richmenu-image-link.png) 29 | 1. Sendを押下し、Responseで {} と返ってきていることを確認する。 30 | ※{} 以外の場合間違いがあるので、誤りがないか確認し、再度試してください。 31 | 1. 以上の手順を、<2.send flex-message menu>と<3.send carousel-message menu>にて発行されたrichmenuIDに対しても行う。なお、画像は<2.send flex-message menu>のrichmenuIDのとき、flex_ja.pngを選択し、<3.send carousel-message menu>のrichmenuIDのとき、carousel_ja.pngを選択する。 32 | 33 | 34 | [次の頁へ](back-end-construction.md) 35 | 36 | [目次へ戻る](../../README.md) 37 | -------------------------------------------------------------------------------- /docs/jp/validation.md: -------------------------------------------------------------------------------- 1 | # 動作確認 2 | ## Webhook Urlの設定 3 | 【LINEチャネルの作成 -> Messaging API 用のチャネルを作成】にて作成したMessaging API用チャネルにWebhook URLを設定します。 4 | 5 | 1. [LINE Developersコンソール](https://developers.line.biz/console/)にて、【LINEチャネルの作成 -> Messaging API 用のチャネルを作成】にて作成したMessaging APIチャネルのページに遷移する。 6 | 7 | 1. Messaging API設定のタブを選択し、Webhook URLに、【バックエンドの構築 -> アプリのデプロイ】の手順にてメモを取ったAPI Gateway endpointを入力する。 8 | ![webhook-setting](../images/jp/webhook-setting.png) 9 | 10 | 1. の設定項目が表示されるので、利用する状態に変更する。 11 | 12 | ## デフォルトの応答設定を無効にする 13 | アプリで設定している応答設定の他に、LINE Official Account Managerにてデフォルトで応答設定が有効になっているため、そちらを無効にします。 14 | 15 | 1. [LINE Developersコンソール](https://developers.line.biz/console/)にて、【LINEチャネルの作成 -> Messaging API 用のチャネルを作成】にて作成したMessaging APIチャネルのページに遷移する。 16 | 17 | 1. Messaging API設定のタブを選択し、LINE公式アカウント機能の応答メッセージの編集リンクを押下し、LINE Official Account Managerに移動する。 18 | 19 | 1. LINE Official Account Managerにて、応答メッセージをオフにする。 20 | 21 | ## 動作確認 22 | すべての手順が完了後、【LINEチャネルの作成 -> Messaging API 用のチャネルを作成】の手順にて作成したLINE Messaging APIのチャネルに表示されているQRコードから友達登録を行い、動作を確認してください。 23 | 24 | [目次へ戻る](../../README.md) 25 | -------------------------------------------------------------------------------- /richmenu_setting/menu_img/carousel_ja.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/richmenu_setting/menu_img/carousel_ja.png -------------------------------------------------------------------------------- /richmenu_setting/menu_img/flex_ja.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/richmenu_setting/menu_img/flex_ja.png -------------------------------------------------------------------------------- /richmenu_setting/menu_img/message_ja.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/line/line-api-use-case-messaging-api/1dbfb1e0bd502dbdf138c87502b6481e3f7dd895/richmenu_setting/menu_img/message_ja.png -------------------------------------------------------------------------------- /richmenu_setting/rich menu.postman_collection.json: -------------------------------------------------------------------------------- 1 | { 2 | "variables": [], 3 | "info": { 4 | "name": "rich menu", 5 | "_postman_id": "26618ead-ff9d-c06e-3d37-8b8e21777013", 6 | "description": "", 7 | "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" 8 | }, 9 | "item": [ 10 | { 11 | "name": "1.send message menu", 12 | "request": { 13 | "url": "https://api.line.me/v2/bot/richmenu", 14 | "method": "POST", 15 | "header": [ 16 | { 17 | "key": "Authorization", 18 | "value": "Bearer {channel access token}", 19 | "description": "" 20 | }, 21 | { 22 | "key": "Content-Type", 23 | "value": "application/json", 24 | "description": "" 25 | } 26 | ], 27 | "body": { 28 | "mode": "raw", 29 | "raw": "{\n \"size\": {\n \"width\": 2500,\n \"height\": 843\n },\n \"selected\": false,\n \"name\": \"message\",\n \"chatBarText\": \"メニュー\",\n \"areas\": [\n {\n \"bounds\": {\n \"x\": 11,\n \"y\": 17,\n \"width\": 820,\n \"height\": 280\n },\n \"action\": {\n \"type\": \"postback\",\n \"data\": \"action=change_menu&action_type=message\",\n \"label\": \"message\"\n }\n },\n {\n \"bounds\": {\n \"x\": 860,\n \"y\": 17,\n \"width\": 820,\n \"height\": 280\n },\n \"action\": {\n \"type\": \"postback\",\n \"label\": \"flex\",\n \"data\": \"action=change_menu&action_type=flex\"\n }\n },\n {\n \"bounds\": {\n \"x\": 1686,\n \"y\": 17,\n \"width\": 820,\n \"height\": 280\n },\n \"action\": {\n \"type\": \"postback\",\n \"data\": \"action=change_menu&action_type=carousel\",\n \"label\": \"carousel\"\n }\n },\n {\n \"bounds\": {\n \"x\": 11,\n \"y\": 390,\n \"width\": 2453,\n \"height\": 563\n },\n \"action\": {\n \"type\": \"postback\",\n \"data\": \"action=send_message&type=message\",\n \"label\": \"message\"\n }\n }\n ]\n}" 30 | }, 31 | "description": "メッセージ送信メニューの作成" 32 | }, 33 | "response": [] 34 | }, 35 | { 36 | "name": "2.send flex-message menu", 37 | "request": { 38 | "url": "https://api.line.me/v2/bot/richmenu", 39 | "method": "POST", 40 | "header": [ 41 | { 42 | "key": "Authorization", 43 | "value": "Bearer {channel access token}", 44 | "description": "" 45 | }, 46 | { 47 | "key": "Content-Type", 48 | "value": "application/json", 49 | "description": "" 50 | } 51 | ], 52 | "body": { 53 | "mode": "raw", 54 | "raw": "{\n \"size\": {\n \"width\": 2500,\n \"height\": 843\n },\n \"selected\": false,\n \"name\": \"message\",\n \"chatBarText\": \"メニュー\",\n \"areas\": [\n {\n \"bounds\": {\n \"x\": 11,\n \"y\": 17,\n \"width\": 820,\n \"height\": 280\n },\n \"action\": {\n \"type\": \"postback\",\n \"data\": \"action=change_menu&action_type=message\",\n \"label\": \"message\"\n }\n },\n {\n \"bounds\": {\n \"x\": 860,\n \"y\": 17,\n \"width\": 820,\n \"height\": 280\n },\n \"action\": {\n \"type\": \"postback\",\n \"label\": \"flex\",\n \"data\": \"action=change_menu&action_type=flex\"\n }\n },\n {\n \"bounds\": {\n \"x\": 1686,\n \"y\": 17,\n \"width\": 820,\n \"height\": 280\n },\n \"action\": {\n \"type\": \"postback\",\n \"data\": \"action=change_menu&action_type=carousel\",\n \"label\": \"carousel\"\n }\n },\n {\n \"bounds\": {\n \"x\": 11,\n \"y\": 390,\n \"width\": 2453,\n \"height\": 563\n },\n \"action\": {\n \"type\": \"postback\",\n \"data\": \"action=send_message&type=flex\",\n \"label\": \"flex\"\n }\n }\n ]\n}" 55 | }, 56 | "description": "FLEXメッセージ送信メニューの作成" 57 | }, 58 | "response": [] 59 | }, 60 | { 61 | "name": "3.send carousel-message menu", 62 | "request": { 63 | "url": "https://api.line.me/v2/bot/richmenu", 64 | "method": "POST", 65 | "header": [ 66 | { 67 | "key": "Authorization", 68 | "value": "Bearer {channel access token}", 69 | "description": "" 70 | }, 71 | { 72 | "key": "Content-Type", 73 | "value": "application/json", 74 | "description": "" 75 | } 76 | ], 77 | "body": { 78 | "mode": "raw", 79 | "raw": "{\n \"size\": {\n \"width\": 2500,\n \"height\": 843\n },\n \"selected\": false,\n \"name\": \"message\",\n \"chatBarText\": \"メニュー\",\n \"areas\": [\n {\n \"bounds\": {\n \"x\": 11,\n \"y\": 17,\n \"width\": 820,\n \"height\": 280\n },\n \"action\": {\n \"type\": \"postback\",\n \"data\": \"action=change_menu&action_type=message\",\n \"label\": \"message\"\n }\n },\n {\n \"bounds\": {\n \"x\": 860,\n \"y\": 17,\n \"width\": 820,\n \"height\": 280\n },\n \"action\": {\n \"type\": \"postback\",\n \"label\": \"flex\",\n \"data\": \"action=change_menu&action_type=flex\"\n }\n },\n {\n \"bounds\": {\n \"x\": 1686,\n \"y\": 17,\n \"width\": 820,\n \"height\": 280\n },\n \"action\": {\n \"type\": \"postback\",\n \"data\": \"action=change_menu&action_type=carousel\",\n \"label\": \"carousel\"\n }\n },\n {\n \"bounds\": {\n \"x\": 11,\n \"y\": 390,\n \"width\": 2453,\n \"height\": 563\n },\n \"action\": {\n \"type\": \"postback\",\n \"data\": \"action=send_message&type=carousel\",\n \"label\": \"carousel\"\n }\n }\n ]\n}" 80 | }, 81 | "description": "Carouselメッセージ送信メニューの作成" 82 | }, 83 | "response": [] 84 | }, 85 | { 86 | "name": "4.link richmenu and image", 87 | "request": { 88 | "url": "https://api-data.line.me/v2/bot/richmenu/{1,2,3で返却されたrichmenuid}/content", 89 | "method": "POST", 90 | "header": [ 91 | { 92 | "key": "Authorization", 93 | "value": "Bearer {channel access token}", 94 | "description": "" 95 | }, 96 | { 97 | "key": "Content-Type", 98 | "value": "image/png", 99 | "description": "" 100 | }, 101 | { 102 | "key": "Expect", 103 | "value": "", 104 | "description": "", 105 | "disabled": true 106 | } 107 | ], 108 | "body": { 109 | "mode": "file", 110 | "file": { 111 | "src": "" 112 | } 113 | }, 114 | "description": "リッチメニューと画像を紐付ける:bodyのSelect Fileから使用する画像を選択してください" 115 | }, 116 | "response": [] 117 | } 118 | ] 119 | } --------------------------------------------------------------------------------