SMSテンプレート

以下のAPIを使用して、SMSテンプレートの追加、変更、削除、またSMSおよびMMSテンプレートの照会と審査提出を行うことができます。

単一テンプレートの照会

SMSテンプレートの基本情報を返します。

URL

https://sms.api.engagelab.cc/v1/templates/{template_id}
              
              https://sms.api.engagelab.cc/v1/templates/{template_id}

            
このコードブロックはフローティングウィンドウ内に表示されます

HTTPリクエストメソッド

GET
              
              GET

            
このコードブロックはフローティングウィンドウ内に表示されます

リクエストヘッダー

ヘッダー タイプ 必須 説明
Authorization string true Basic base64(sms_user:sms_key)

リクエスト例

curl -X GET "https://sms.api.engagelab.cc/v1/templates/1235" --header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
              
              curl -X GET "https://sms.api.engagelab.cc/v1/templates/1235" 
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"

            
このコードブロックはフローティングウィンドウ内に表示されます

レスポンス説明

フィールド 説明
template_id テンプレートID
template_name テンプレート名(最大64文字)
msg_type SMSタイプ、2は国際SMSを表します
template_type SMSコンテンツタイプ、0は認証コード、1は業界通知、2はマーケティング
approval_status 承認ステータス、0は審査中、1は承認済み、-1は拒否、-2は未提出
approval_message 承認メッセージ(approval_statusが-1の場合のみ利用可能)
template_content テンプレート内容(最大512文字)
sign_id 署名ID
create_time 作成時間
update_time 更新時間

レスポンス例

Response-success

HTTP Status: 200

{ "result": { "template_id": 123, "template_name": "test", "msg_type": 2, "template_type": 1, "template_content": "Dear %name%,your consumption amount on the platform this month is:***", "approval_status": 1, "approval_message": "" "create_time": "2015-03-23T14:27:48+0800", "update_time": "2017-03-29T14:27:48+0800" } }
              
              {
    "result": {
        "template_id": 123,
        "template_name": "test",
        "msg_type": 2,
        "template_type": 1,
        "template_content": "Dear %name%,your consumption amount on the platform this month is:***",
        "approval_status": 1,
        "approval_message": ""
        "create_time": "2015-03-23T14:27:48+0800",
        "update_time": "2017-03-29T14:27:48+0800"
    }
}

            
このコードブロックはフローティングウィンドウ内に表示されます

Response-error

HTTP Status :400

{ "code": 33001, "message": "The template does not exist" }
              
              {
    "code": 33001,
    "message": "The template does not exist"
}

            
このコードブロックはフローティングウィンドウ内に表示されます

複数テンプレートの照会

SMSテンプレートの基本情報を返します。

URL

https://sms.api.engagelab.cc/v1/templates
              
              https://sms.api.engagelab.cc/v1/templates

            
このコードブロックはフローティングウィンドウ内に表示されます

HTTPリクエストメソッド

GET
              
              GET

            
このコードブロックはフローティングウィンドウ内に表示されます

リクエストヘッダー

ヘッダー タイプ 必須 説明
Authorization String true Basic base64(sms_user:sms_key)

パラメーター説明

パラメーター タイプ 必須 説明
template_ids string No テンプレートID、セミコロンで区切る
approval_status string No 承認ステータス、0は審査中、1は承認済み、-1は拒否、-2は未提出
template_name string No テンプレート名(あいまい検索、最大64文字)
offset int No 照会開始位置、範囲[0-]、デフォルトは0
limit int No 照会件数、範囲[0-100]、デフォルトは100

注意:

  1. ユーザーは照会するテンプレートIDを指定できます。指定しない場合、すべてのテンプレートがデフォルトで照会されます。

リクエスト例

curl -X GET "https://sms.api.engagelab.cc/v1/templates?approval_status=1" --header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
              
              curl -X GET "https://sms.api.engagelab.cc/v1/templates?approval_status=1" 
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"

            
このコードブロックはフローティングウィンドウ内に表示されます

レスポンス説明

フィールド 説明
template_id テンプレートID
template_name テンプレート名
msg_type ビジネスタイプ
template_type コンテンツタイプ
approval_status 承認ステータス
approval_message 承認メッセージ(approval_statusが-1の場合のみ利用可能)
template_content テンプレート内容
sign_id 署名ID
create_time 作成時間
update_time 更新時間

レスポンス例

Response-success

HTTP Status: 200

{ "result" : [{ "template_id" : 100, "template_name" : "tset", "msg_type" : 2, "template_type" : 1, "template_content" : "Dear %name%,your consumption amount on the platform this month is:***", "approval_status" : 1, "approval_message": "" "create_time" : "2016-08-25T14:27:48+0800", "update_time" : "2016-08-25T14:27:48+0800" } ], "count":1, "total" : 1 }
              
              {
    "result" :  [{
                "template_id" : 100,
                "template_name" : "tset",
                "msg_type" : 2,
                "template_type" : 1,
                "template_content" : "Dear %name%,your consumption amount on the platform this month is:***",
                "approval_status" : 1,
                "approval_message": ""
                "create_time" : "2016-08-25T14:27:48+0800",
                "update_time" : "2016-08-25T14:27:48+0800"
            }
        ],
        "count":1,
        "total" : 1
    }


            
このコードブロックはフローティングウィンドウ内に表示されます

Response-error

HTTP Status: 400

{ "code": 30002, "message": "invalid limit" }
              
              {
  "code": 30002,
  "message": "invalid limit"
}

            
このコードブロックはフローティングウィンドウ内に表示されます

テンプレートの追加

追加が成功したかどうかの情報を返します。

URL

https://sms.api.engagelab.cc/v1/templates
              
              https://sms.api.engagelab.cc/v1/templates

            
このコードブロックはフローティングウィンドウ内に表示されます

HTTPリクエストメソッド

POST
              
              POST

            
このコードブロックはフローティングウィンドウ内に表示されます

Content-type

application/json
              
              application/json

            
このコードブロックはフローティングウィンドウ内に表示されます

リクエストヘッダー

ヘッダー タイプ 必須 説明
Authorization string true Basic base64(sms_user:sms_key)

パラメーター説明

パラメーター タイプ 必須 説明
template_name string Yes テンプレート名(アカウント内で一意、最大64文字)
template_content string Yes テンプレート内容(【】, [], testなどの文字を含めない、最大512文字)
template_type string Yes SMSコンテンツタイプ、0は認証コード、1は業界通知、2はマーケティング
msg_type string No ビジネスタイプ、2は国際SMSを表し、デフォルトは2
sign_id Integer No SMS署名ID
sign_pos string No 署名位置、0はプレフィックス、1はサフィックス、デフォルトは0
submit bool No 審査に直接提出するかどうか、デフォルトはfalse

リクエスト例

curl -X POST "https://sms.api.engagelab.cc/v1/templates" --header "Authorization: Basic <<YOUR_API_KEY_HERE>>" --header "Content-Type: application/json" --data '{ "template_name": "test", "template_content": "Dear %name%,your consumption amount on the platform this month is:***", "sign_id": 1235, "template_type": "0" }'
              
              curl -X POST "https://sms.api.engagelab.cc/v1/templates"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>" 
--header "Content-Type: application/json" 
--data '{
    "template_name": "test",
    "template_content": "Dear %name%,your consumption amount on the platform this month is:***",
    "sign_id": 1235,
    "template_type": "0"
}'  

            
このコードブロックはフローティングウィンドウ内に表示されます

レスポンス説明

フィールド 説明
template_id テンプレートID
template_name テンプレート名
msg_type ビジネスタイプ
template_type コンテンツタイプ
approval_status 承認ステータス
approval_message 承認メッセージ(approval_statusが-1の場合のみ利用可能)
template_content テンプレート内容
sign_id 署名ID
create_time 作成時間
update_time 更新時間

レスポンス例

Response-success

HTTP Status: 200

{ "result" : { "template_id" : 200, "template_name" : "bill", "msg_type" : 2, "template_type" : 1, "template_content" : "Dear %name%,your consumption amount on the platform this month is:***", "approval_status" : 1, "approval_message": "" "create_time" : "2022-08-25T14:35:48+0800", "update_time" : "2022-08-25T14:35:48+0800" } }
              
              {
    "result" : {
        "template_id" : 200,
        "template_name" : "bill",
        "msg_type" : 2,
        "template_type" : 1,
        "template_content" : "Dear %name%,your consumption amount on the platform this month is:***",
        "approval_status" : 1,
        "approval_message": ""
        "create_time" : "2022-08-25T14:35:48+0800",
        "update_time" : "2022-08-25T14:35:48+0800"
        
    }
}

            
このコードブロックはフローティングウィンドウ内に表示されます

Response-error

HTTP Status: 400

{ "code": 33006, "message": "Template name only supports 64 characters" }
              
              {
    "code": 33006,
    "message": "Template name only supports 64 characters"
}

            
このコードブロックはフローティングウィンドウ内に表示されます

審査提出

提出が成功したかどうかの基本情報を返します。

URL

https://sms.api.engagelab.cc/v1/templates/{template_id}/submit
              
              https://sms.api.engagelab.cc/v1/templates/{template_id}/submit

            
このコードブロックはフローティングウィンドウ内に表示されます

HTTPリクエストメソッド

POST
              
              POST

            
このコードブロックはフローティングウィンドウ内に表示されます

Content-type

application/json
              
              application/json

            
このコードブロックはフローティングウィンドウ内に表示されます

リクエストヘッダー

ヘッダー タイプ 必須 説明
Authorization String true Basic base64(sms_user:sms_key)

リクエスト例

curl -X POST "https://sms.api.engagelab.cc/v1/templates/3381/submit" --header "Authorization: Basic <<YOUR_API_KEY_HERE>>" --header "Content-Type: application/x-www-form-urlencoded"
              
              curl -X POST "https://sms.api.engagelab.cc/v1/templates/3381/submit"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>" 
--header "Content-Type: application/x-www-form-urlencoded"

            
このコードブロックはフローティングウィンドウ内に表示されます

レスポンス例

Response-success

HTTP Status: 200

{ }
              
              { 
  
}

            
このコードブロックはフローティングウィンドウ内に表示されます

テンプレートの更新

更新が成功したかどうかの基本情報を返します。

URL

https://sms.api.engagelab.cc/v1/templates/{template_id}
              
              https://sms.api.engagelab.cc/v1/templates/{template_id}

            
このコードブロックはフローティングウィンドウ内に表示されます

HTTPリクエストメソッド

PUT
              
              PUT

            
このコードブロックはフローティングウィンドウ内に表示されます

Content-type

application/json
              
              application/json

            
このコードブロックはフローティングウィンドウ内に表示されます

リクエストヘッダー

ヘッダー タイプ 必須 説明
Authorization String true Basic base64(sms_user:sms_key)

パラメーター説明

パラメーター タイプ 必須 説明
template_name string No テンプレート名(最大64文字)
template_content string No テンプレート内容(【】, [], testなどの文字を含めない、最大512文字)
sign_id Integer No SMS署名ID
sign_pos string No 署名位置:0はプレフィックス、1はサフィックス、デフォルトは0
template_type string No SMSコンテンツタイプ、0は認証コード、1は業界通知、2はマーケティング
submit bool No 審査に直接提出するかどうか、デフォルトはfalse

注意:

  1. このAPIを呼び出した後、template_nameを更新してもテンプレートの承認ステータスは変更されませんが、他のパラメーターを更新すると変更されます。

リクエスト例

curl -X PUT "https://sms.api.engagelab.cc/v1/templates/3381" --header "Authorization: Basic <<YOUR_API_KEY_HERE>>" --header "Content-Type: application/json" --data '{ "template_name": "test", "template_content": "Dear %name%,your consumption amount on the platform this month is:***", "sign_id": 132, "template_type": 0 }'
              
              curl -X PUT "https://sms.api.engagelab.cc/v1/templates/3381"
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>" 
--header "Content-Type: application/json" 
--data '{
    "template_name": "test",
    "template_content": "Dear %name%,your consumption amount on the platform this month is:***",
    "sign_id": 132,
    "template_type": 0
    }'  

            
このコードブロックはフローティングウィンドウ内に表示されます

レスポンス例

Response-success

HTTP Status: 200

{ "count": 1 }
              
               { 
 "count": 1 
 }

            
このコードブロックはフローティングウィンドウ内に表示されます

Response-error

HTTP Status: 401

{ "code": 30000, "message": "Authentication failed" }
              
              {
  "code": 30000,
  "message": "Authentication failed"
}

            
このコードブロックはフローティングウィンドウ内に表示されます

テンプレートの削除

削除が成功したかどうかの基本情報を返します。

URL

https://sms.api.engagelab.cc/v1/templates/{template_id}
              
              https://sms.api.engagelab.cc/v1/templates/{template_id}

            
このコードブロックはフローティングウィンドウ内に表示されます

HTTPリクエストメソッド

DELETE
              
              DELETE

            
このコードブロックはフローティングウィンドウ内に表示されます

リクエストヘッダー

ヘッダー タイプ 必須 説明
Authorization String true Basic base64(sms_user:sms_key)

リクエスト例

curl -X DELETE "https://sms.api.engagelab.cc/v1/templates/3381" --header "Authorization: Basic <<YOUR_API_KEY_HERE>>"
              
              curl -X DELETE "https://sms.api.engagelab.cc/v1/templates/3381" 
--header "Authorization: Basic <<YOUR_API_KEY_HERE>>"

            
このコードブロックはフローティングウィンドウ内に表示されます

レスポンス例

Response-success

HTTP Status: 200

{ "count": 1 }
              
               { 
 "count": 1 
 }

            
このコードブロックはフローティングウィンドウ内に表示されます
icon
お問い合わせ