LINE自動応答作成
curl --request POST \
--url https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"response_type": "keyword",
"action_type": "message",
"autoreply_group_id": "<string>",
"keywords": [
"<string>"
],
"message": "<string>",
"action_id": "<string>",
"line_template_id": "<string>"
}
'import requests
url = "https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies"
payload = {
"name": "<string>",
"response_type": "keyword",
"action_type": "message",
"autoreply_group_id": "<string>",
"keywords": ["<string>"],
"message": "<string>",
"action_id": "<string>",
"line_template_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
response_type: 'keyword',
action_type: 'message',
autoreply_group_id: '<string>',
keywords: ['<string>'],
message: '<string>',
action_id: '<string>',
line_template_id: '<string>'
})
};
fetch('https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'response_type' => 'keyword',
'action_type' => 'message',
'autoreply_group_id' => '<string>',
'keywords' => [
'<string>'
],
'message' => '<string>',
'action_id' => '<string>',
'line_template_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"response_type\": \"keyword\",\n \"action_type\": \"message\",\n \"autoreply_group_id\": \"<string>\",\n \"keywords\": [\n \"<string>\"\n ],\n \"message\": \"<string>\",\n \"action_id\": \"<string>\",\n \"line_template_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"response_type\": \"keyword\",\n \"action_type\": \"message\",\n \"autoreply_group_id\": \"<string>\",\n \"keywords\": [\n \"<string>\"\n ],\n \"message\": \"<string>\",\n \"action_id\": \"<string>\",\n \"line_template_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"response_type\": \"keyword\",\n \"action_type\": \"message\",\n \"autoreply_group_id\": \"<string>\",\n \"keywords\": [\n \"<string>\"\n ],\n \"message\": \"<string>\",\n \"action_id\": \"<string>\",\n \"line_template_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"autoreply_group_id": "<string>",
"response_type": "keyword",
"keyword_type": "part",
"keywords": [
"<string>"
],
"action_type": "message",
"message": "<string>",
"action_id": "<string>",
"line_template_id": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}
}{
"error": {
"code": "validation_error",
"message": "このアカウントではLINE自動応答を利用できません"
}
}{
"error": {
"code": "unauthorized",
"message": "APIキーが無効です"
}
}{
"error": {
"code": "not_found",
"message": "ページが見つかりません"
}
}{
"error": {
"code": "validation_error",
"message": "入力内容に誤りがあります",
"details": {
"name": [
"管理用タイトルは必須です"
]
}
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "レート制限を超過しました"
}
}自動応答
LINE自動応答作成
LINE自動応答を作成します。作成した自動応答は一覧の末尾(最も低い優先度)に追加されます。
response_type=keyword(キーワード応答)のときkeyword_typeとkeywordsが必須です。keywordsは1〜100件、各255文字以内・改行不可、合計65,535バイト以内。"0"は指定できません(一致判定の対象にならないため)action_typeに応じてmessage(メッセージを送信)/action_id(アクションを実行)/line_template_id(テンプレートを送信)のうち対応する項目が必須です。対応しない項目はnullで送れます(取得応答の送り返し用)messageは最大5,000文字。配信済みメッセージの置換URL・rid付きURLを含む場合は422を返します(短縮されずにそのまま送信されるため)action_idは同じアカウントのアクション一覧にあるアクション、line_template_idは同じアカウントの削除されていないテンプレートのみ指定できますautoreply_group_idは省略・null・空文字で未分類です
種類が line / mail_line 以外のアカウントは400を返します。
LINE自動応答作成
curl --request POST \
--url https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"response_type": "keyword",
"action_type": "message",
"autoreply_group_id": "<string>",
"keywords": [
"<string>"
],
"message": "<string>",
"action_id": "<string>",
"line_template_id": "<string>"
}
'import requests
url = "https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies"
payload = {
"name": "<string>",
"response_type": "keyword",
"action_type": "message",
"autoreply_group_id": "<string>",
"keywords": ["<string>"],
"message": "<string>",
"action_id": "<string>",
"line_template_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
response_type: 'keyword',
action_type: 'message',
autoreply_group_id: '<string>',
keywords: ['<string>'],
message: '<string>',
action_id: '<string>',
line_template_id: '<string>'
})
};
fetch('https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'response_type' => 'keyword',
'action_type' => 'message',
'autoreply_group_id' => '<string>',
'keywords' => [
'<string>'
],
'message' => '<string>',
'action_id' => '<string>',
'line_template_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"response_type\": \"keyword\",\n \"action_type\": \"message\",\n \"autoreply_group_id\": \"<string>\",\n \"keywords\": [\n \"<string>\"\n ],\n \"message\": \"<string>\",\n \"action_id\": \"<string>\",\n \"line_template_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"response_type\": \"keyword\",\n \"action_type\": \"message\",\n \"autoreply_group_id\": \"<string>\",\n \"keywords\": [\n \"<string>\"\n ],\n \"message\": \"<string>\",\n \"action_id\": \"<string>\",\n \"line_template_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"response_type\": \"keyword\",\n \"action_type\": \"message\",\n \"autoreply_group_id\": \"<string>\",\n \"keywords\": [\n \"<string>\"\n ],\n \"message\": \"<string>\",\n \"action_id\": \"<string>\",\n \"line_template_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"autoreply_group_id": "<string>",
"response_type": "keyword",
"keyword_type": "part",
"keywords": [
"<string>"
],
"action_type": "message",
"message": "<string>",
"action_id": "<string>",
"line_template_id": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}
}{
"error": {
"code": "validation_error",
"message": "このアカウントではLINE自動応答を利用できません"
}
}{
"error": {
"code": "unauthorized",
"message": "APIキーが無効です"
}
}{
"error": {
"code": "not_found",
"message": "ページが見つかりません"
}
}{
"error": {
"code": "validation_error",
"message": "入力内容に誤りがあります",
"details": {
"name": [
"管理用タイトルは必須です"
]
}
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "レート制限を超過しました"
}
}POST
https://api.utage-system.com/v1/accounts/{account_id}/line/autoreplies
Body
application/json