コンテンツにスキップ

メールの文面を追加する

POST
/api/v1/email/templates
curl --request POST \
--url https://app.goyoka.com/api/v1/email/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "kind": "example", "scope": "example", "booking_kind": "example", "subject": "example", "body": "example", "anchor": "example" }'

鍵やトークンの持ち主が今のこのお店のメンバーでないと409 EMAIL_OPERATION_BLOCKED(NOT_CURRENT_MEMBER)です。作成直後はenabled:false⁠です。target_service_ids⁠は作成body⁠では受け付けず、常に空配列で作られます(空は全メニューの予約が対象という意味そのもので、あとから対象を絞るには更新を使ってください)。ANNOUNCEMENT(次回のご案内)は409 EMAIL_OPERATION_BLOCKED(details.blocks[].code:TEMPLATE_KIND_NOT_WRITABLE)です。掃引でしか送らない種別(リマインド・お礼・フォローアップ等)は開始/終了のどちらを基準にするか必須です。個別の出来事に合わせて即時に送る種別は、anchor⁠に何を送ってもBOOKED・offset_minutes 0・send_at_local_time null⁠へ揃えます。イベント(booking_kind:EVENT)にリモート(出張)は選べません。お店の追加上限に達している場合は409 EMAIL_OPERATION_BLOCKED(details.blocks[].code:TEMPLATE_LIMIT_REACHED)です。任意の冪等キーを使えます。

kind・scope・booking_kind⁠は作成時の必須入力です。

応答前に不足する形態別の標準文面を補います。

保存競合は409 EMAIL_OPERATION_BLOCKED⁠で、details.blocks[].code⁠はCONCURRENT_UPDATE⁠です。

必要な範囲: email:write

ヘッダーのパラメータ

「ヘッダーのパラメータ」の節へ
Idempotency-Key
string

同じ内容の再送に同じ値を使います。異なる内容との再利用や処理中の再送は409 IDEMPOTENCY_KEY_REUSED⁠です。

メディアタイプapplication/json
object
kind
必須
string
scope
必須
string
booking_kind
必須
string
subject
必須
string
body
必須
string
anchor
必須
string | null
例自動生成
{
"kind": "example",
"scope": "example",
"booking_kind": "example",
"subject": "example",
"body": "example",
"anchor": "example"
}

メールの文面を追加する

メディアタイプapplication/json
object
data
必須
object
id
必須
string 形式: uuid
kind
必須
string
scope
必須
string
booking_kind
必須
string
subject
必須
string
body
必須
string
enabled
必須
boolean
anchor
必須
string
offset_minutes
必須
number
send_at_local_time
必須
string | null
target_service_ids
必須
Array<string>
is_custom
必須
boolean
sort_order
必須
number
tab
必須
string
取りうる値: session event inquiry
created_at
必須
string 形式: date-time
updated_at
必須
string 形式: date-time
例
{
"data": {
"tab": "session"
}
}

利用できないヘッダ

メディアタイプapplication/json
object
error
必須
object
code
必須
string
message
必須
string
details
object
任意のキー
追加の項目
request_id
必須
string
例自動生成
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"request_id": "example"
}
}

鍵が無い・無効

メディアタイプapplication/json
object
error
必須
object
code
必須
string
message
必須
string
details
object
任意のキー
追加の項目
request_id
必須
string
例自動生成
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"request_id": "example"
}
}

範囲不足

メディアタイプapplication/json
object
error
必須
object
code
必須
string
message
必須
string
details
object
任意のキー
追加の項目
request_id
必須
string
例自動生成
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"request_id": "example"
}
}

見つからない

メディアタイプapplication/json
object
error
必須
object
code
必須
string
message
必須
string
details
object
任意のキー
追加の項目
request_id
必須
string
例自動生成
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"request_id": "example"
}
}

予約・冪等キーの競合

メディアタイプapplication/json
object
error
必須
object
code
必須
string
message
必須
string
details
object
任意のキー
追加の項目
request_id
必須
string
例自動生成
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"request_id": "example"
}
}

本文が1 MiB⁠を超えている

メディアタイプapplication/json
object
error
必須
object
code
必須
string
message
必須
string
details
object
任意のキー
追加の項目
request_id
必須
string
例自動生成
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"request_id": "example"
}
}

入力の検証失敗

メディアタイプapplication/json
object
error
必須
object
code
必須
string
message
必須
string
details
object
任意のキー
追加の項目
request_id
必須
string
例自動生成
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"request_id": "example"
}
}

回数の上限

メディアタイプapplication/json
object
error
必須
object
code
必須
string
message
必須
string
details
object
任意のキー
追加の項目
request_id
必須
string
例自動生成
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"request_id": "example"
}
}
RateLimit-Limit
integer
>= 1

固定窓内の回数上限

RateLimit-Remaining
integer

固定窓内の残り回数

RateLimit-Reset
integer

窓終了までの秒数

Retry-After
integer
>= 1

再試行までの待機秒数

内部エラー

メディアタイプapplication/json
object
error
必須
object
code
必須
string
message
必須
string
details
object
任意のキー
追加の項目
request_id
必須
string
例自動生成
{
"error": {
"code": "example",
"message": "example",
"details": {
"additionalProperty": "example"
},
"request_id": "example"
}
}