このページはAIにより自動翻訳されており、不正確な内容が含まれている可能性があります。翻訳の誤りを報告するには、 GitHubでイシューを作成してください.
メールテンプレートを作成する
post
/templates/email/create
このエンドポイントを使用して、Brazeダッシュボードでメールテンプレートを作成します。
これらのテンプレートはテンプレートとメディアページで利用できます。このエンドポイントからの応答にはemail_template_idフィールドが含まれており、後続のAPI呼び出しでテンプレートを更新するために使用できます。
前提条件
このエンドポイントを使用するには、templates.email.create権限を持つAPIキーが必要です。
レート制限
APIレート制限に記載されているように、このエンドポイントにはデフォルトのBrazeレート制限(1時間あたり250,000リクエスト)が適用されます。
リクエスト本文
1
2
Content-Type: application/json
Authorization: Bearer YOUR_REST_API_KEY
1
2
3
4
5
6
7
8
9
{
"template_name": (required, string) The name of your email template,
"subject": (required, string) The email template subject line,
"body": (required, string) The email template body that may include HTML,
"plaintext_body": (optional, string) A plaintext version of the email template body,
"preheader": (optional, string) The email preheader used to generate previews in some clients,
"tags": (optional, Array of Strings) Tags must already exist,
"should_inline_css": (optional, Boolean) If `true`, the `inline_css` feature is used on this template.
}
リクエストパラメーター
| パラメーター | 必須 | データタイプ | 説明 |
|---|---|---|---|
template_name |
必須 | 文字列 | メールテンプレートの名前。 |
subject |
必須 | 文字列 | メールテンプレートの件名。 |
body |
必須 | 文字列 | HTMLを含むことができるメールテンプレート本文。最大400 KB。 |
plaintext_body |
オプション | 文字列 | メールテンプレート本文のプレーンテキストバージョン。 |
preheader |
オプション | 文字列 | 一部のクライアントでプレビューを生成するために使用されるメールプリヘッダー。 |
tags |
オプション | 文字列 | タグはすでに存在している必要があります。 |
should_inline_css |
オプション | ブール値 | テンプレートごとにinline_css機能を有効または無効にします。指定されない場合、Brazeはアプリグループのデフォルト設定を使用します。trueまたはfalseのいずれかが期待されます。 |
リクエスト例
1
2
3
4
5
6
7
8
9
10
11
curl --location --request POST 'https://rest.iad-01.braze.com/templates/email/create' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_REST_API_KEY' \
--data-raw '{
"template_name": "email_template_name",
"subject": "Welcome to my email template!",
"body": "This is the text within my email body and https://www.braze.com/ here is a link to Braze.com.",
"plaintext_body": "This is the text within my email body and here is a link to https://www.braze.com/.",
"preheader": "My preheader is pretty cool.",
"tags": ["Tag1", "Tag2"]
}'
応答例
1
2
3
4
{
"email_template_id": "232b6d29-7e41-4106-a0ab-1c4fe915d701",
"message": "success"
}
トラブルシューティング
以下の表は、返される可能性のあるエラーと、該当する場合の関連するトラブルシューティング手順を示しています。
| エラー | トラブルシューティング |
|---|---|
| テンプレート名は必須です | テンプレート名を入力してください。 |
| タグは配列でなければなりません | タグは文字列の配列としてフォーマットする必要があります。例: ["marketing", "promotional", "transactional"]。 |
| すべてのタグは文字列でなければなりません | タグが引用符("")で囲まれていることを確認してください。 |
| 一部のタグが見つかりませんでした | メールテンプレート作成時にタグを追加するには、そのタグがすでにBrazeに存在している必要があります。 |
| メールには有効なContent Blocks名が必要です | メールにこの環境に存在しないContent Blocksが含まれている可能性があります。 |
should_inline_cssの値が無効です。trueまたはfalseのいずれかが期待されます |
このパラメーターはブール値(trueまたはfalse)のみを受け付けます。should_inline_cssの値が引用符("")で囲まれていないことを確認してください。囲まれている場合、値は文字列として送信されます。 |
New Stuff!