Skip to main content
配信メッセージ作成
curl --request POST \
  --url https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "status": "draft",
  "title": "<string>",
  "use_ab_test": true,
  "send_type": "<string>",
  "send_date": "2023-12-25",
  "send_day": 123,
  "send_hour": 11,
  "send_min": 29,
  "base_date": "<string>",
  "line": {
    "sender_id": "<string>",
    "messages": [
      {}
    ]
  },
  "sms": {
    "message": "<string>"
  },
  "action_id": "<string>",
  "shorten_type": "shorten_url",
  "shorten_domain": "<string>",
  "conditions": [
    {}
  ],
  "url_actions": [
    {}
  ]
}
'
import requests

url = "https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/messages"

payload = {
"status": "draft",
"title": "<string>",
"use_ab_test": True,
"send_type": "<string>",
"send_date": "2023-12-25",
"send_day": 123,
"send_hour": 11,
"send_min": 29,
"base_date": "<string>",
"line": {
"sender_id": "<string>",
"messages": [{}]
},
"sms": { "message": "<string>" },
"action_id": "<string>",
"shorten_type": "shorten_url",
"shorten_domain": "<string>",
"conditions": [{}],
"url_actions": [{}]
}
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({
status: 'draft',
title: '<string>',
use_ab_test: true,
send_type: '<string>',
send_date: '2023-12-25',
send_day: 123,
send_hour: 11,
send_min: 29,
base_date: '<string>',
line: {sender_id: '<string>', messages: [{}]},
sms: {message: '<string>'},
action_id: '<string>',
shorten_type: 'shorten_url',
shorten_domain: '<string>',
conditions: [{}],
url_actions: [{}]
})
};

fetch('https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/messages', 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}/scenarios/{scenario_id}/messages",
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([
'status' => 'draft',
'title' => '<string>',
'use_ab_test' => true,
'send_type' => '<string>',
'send_date' => '2023-12-25',
'send_day' => 123,
'send_hour' => 11,
'send_min' => 29,
'base_date' => '<string>',
'line' => [
'sender_id' => '<string>',
'messages' => [
[

]
]
],
'sms' => [
'message' => '<string>'
],
'action_id' => '<string>',
'shorten_type' => 'shorten_url',
'shorten_domain' => '<string>',
'conditions' => [
[

]
],
'url_actions' => [
[

]
]
]),
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}/scenarios/{scenario_id}/messages"

payload := strings.NewReader("{\n \"status\": \"draft\",\n \"title\": \"<string>\",\n \"use_ab_test\": true,\n \"send_type\": \"<string>\",\n \"send_date\": \"2023-12-25\",\n \"send_day\": 123,\n \"send_hour\": 11,\n \"send_min\": 29,\n \"base_date\": \"<string>\",\n \"line\": {\n \"sender_id\": \"<string>\",\n \"messages\": [\n {}\n ]\n },\n \"sms\": {\n \"message\": \"<string>\"\n },\n \"action_id\": \"<string>\",\n \"shorten_type\": \"shorten_url\",\n \"shorten_domain\": \"<string>\",\n \"conditions\": [\n {}\n ],\n \"url_actions\": [\n {}\n ]\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}/scenarios/{scenario_id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"draft\",\n \"title\": \"<string>\",\n \"use_ab_test\": true,\n \"send_type\": \"<string>\",\n \"send_date\": \"2023-12-25\",\n \"send_day\": 123,\n \"send_hour\": 11,\n \"send_min\": 29,\n \"base_date\": \"<string>\",\n \"line\": {\n \"sender_id\": \"<string>\",\n \"messages\": [\n {}\n ]\n },\n \"sms\": {\n \"message\": \"<string>\"\n },\n \"action_id\": \"<string>\",\n \"shorten_type\": \"shorten_url\",\n \"shorten_domain\": \"<string>\",\n \"conditions\": [\n {}\n ],\n \"url_actions\": [\n {}\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/messages")

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 \"status\": \"draft\",\n \"title\": \"<string>\",\n \"use_ab_test\": true,\n \"send_type\": \"<string>\",\n \"send_date\": \"2023-12-25\",\n \"send_day\": 123,\n \"send_hour\": 11,\n \"send_min\": 29,\n \"base_date\": \"<string>\",\n \"line\": {\n \"sender_id\": \"<string>\",\n \"messages\": [\n {}\n ]\n },\n \"sms\": {\n \"message\": \"<string>\"\n },\n \"action_id\": \"<string>\",\n \"shorten_type\": \"shorten_url\",\n \"shorten_domain\": \"<string>\",\n \"conditions\": [\n {}\n ],\n \"url_actions\": [\n {}\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": "<string>",
    "title": "<string>",
    "mail": {},
    "line": {
      "sender_id": "<string>",
      "messages": [
        {}
      ]
    },
    "sms": {},
    "url_actions": [
      {}
    ]
  },
  "warnings": [
    "<string>"
  ]
}
{
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}
{
"error": {
"code": "unauthorized",
"message": "認証に失敗しました"
}
}
{
"error": {
"code": "not_found",
"message": "リソースが見つかりません"
}
}
{
"error": {
"code": "validation_error",
"message": "バリデーションエラーが発生しました"
}
}
{
"error": {
"code": "rate_limit_exceeded",
"message": "リクエスト上限を超えました。しばらく時間を空けて再試行してください"
}
}
POST
https://api.utage-system.com/v1/accounts/{account_id}/scenarios/{scenario_id}/messages
この機能はプレビュー版です。仕様が変更される場合があります。

Authorizations

Authorization
string
header
required

APIキーをBearerトークンとして指定

Path Parameters

account_id
string
required

アカウントID

scenario_id
string
required

シナリオID

Body

application/json

配信メッセージ作成リクエスト。type に応じて送信タイミング系フィールドを指定します。 送信タイミングの詳細な指定方法は MCPツール(message_create)の説明も参照してください。

channel
enum<string>
required

媒体(作成後に変更不可)

Available options:
mail,
line,
sms,
action
type
enum<string>
required

配信タイプ(作成後に変更不可)

Available options:
broadcast,
step,
reminder
status
enum<string>
default:draft

ステータス。reserved(予約)にすると配信安全制御・DKIM/SMS前提チェックが実行されます。

Available options:
draft,
reserved
title
string

管理名称

Maximum string length: 255
use_ab_test
boolean

A/Bテスト使用

send_type
string

送信タイプ。broadcast: immediately(即時)/scheduled(日時指定)。 step: immediately / scheduled(日数指定)/scheduled_addition(追加配信)。

send_date
string<date>

送信日(broadcast用、YYYY-MM-DD)

send_day
integer

送信日数(step / reminder 用)。step: 登録からの日数(0=当日)。 reminder: 基準日からの日数(0以上)。

send_hour
integer

送信時(0-23)

Required range: 0 <= x <= 23
send_min
integer

送信分(0-59)

Required range: 0 <= x <= 59
send_timing
enum<string>

送信タイミング(reminder用)。before=基準日の前、after=基準日の後、today=基準日当日、 addition_before/addition_after=追加配信。

Available options:
before,
after,
today,
addition_before,
addition_after
base_date
string

基準日の読者項目名(reminder用)。置き換え文字一覧の reader_item から取得。

step_send_type
enum<string>

ステップ送信タイプ(step用)。none=指定日時に送信、immediately=登録直後に即時送信。

Available options:
none,
immediately
mail
object

メール原稿(channel=mail 時に必須)

line
object

LINE原稿(channel=line 時に必須)

sms
object

SMS原稿(channel=sms 時に必須)

action_id
string

配信後に実行するアクションID(channel=action かつ status=reserved 時に必須)

shorten_type
enum<string>
default:shorten_url

URL置換方法(shorten_url: 置換URLを表示、original_url: 元のURLを表示)

Available options:
shorten_url,
original_url
shorten_domain
string

URL置換ドメイン

conditions
object[]

配信条件。グループ間はOR結合、グループ内の rules はAND結合。 使用可能な key / condition / value は配信条件タイプ定義を参照してください。

url_actions
object[]

URLアクションの配列

Response

作成された配信メッセージ

data
object

配信メッセージの詳細。共通フィールドに加え、type に応じた送信タイミング系フィールド (send_type / send_date / send_day / send_hour / send_min / base_date / send_timing / step_send_type 等)と、channel に応じた原稿(mail / line / sms)、 url_actions を含みます。

warnings
string[]

予約(reserved)化時に検出された警告(DKIM未設定・配信安全制御など)。 警告がある場合のみ返されることがあります。