メールの受信:テンプレート

Delete Template

テンプレートを削除します。

POSThttps://g.sendcorex.com/v1command: delete_template

このテンプレートで返信するルールは返信しなくなります。

引数

  • idstring必須

    template_id。

クイックスタート

import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1',
  {
    commands: [
      {
        command: "delete_template",
        args: {
          id: "Vj0xVFBMMDAx"
        }
      }
    ]
  },
  { headers: { Authorization: process.env.SENDCOREX_TOKEN } },
);

const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);

レスポンス

{
  "type": "SUCCESS",
  "results": [
    {
      "command": "delete_template",
      "id": "0",
      "type": "SUCCESS",
      "data": {
        "deleted": true,
        "id": "Vj0xVFBMMDAx"
      }
    }
  ]
}

エラー

HTTPレベルのエラーはtype、code、messageを返します。CMDと表示されたエラーは、HTTP 200でコマンドの結果内に返ります。

  • 401TOKEN_EXPIRED

    access tokenの有効期限が切れました。Refresh Tokenを呼んでリクエストを繰り返してください。

  • 401INVALID_TOKEN

    トークンの形式が不正、不明、または取り消されています。

  • 429RATE_LIMITED

    同じIP + メールボックスで毎秒15リクエストまたは同時15件を超えました。Retry-Afterの秒数だけ待ってください。

  • CMDINVALID_ARGS

    必須の引数がないか不正です。

  • CMDINTERNAL

    サーバーエラー。詳細はサーバーのログにのみ記録されます。