メールの受信:ルール

Rule Options

ルールで使えるすべて:項目と演算子、アクション、プロバイダー、制限。ルールエディターの作成に使います。

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

引数

このエンドポイントに引数はありません。

クイックスタート

import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1',
  {
    commands: [
      {
        command: "rule_options"
      }
    ]
  },
  { 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": "rule_options",
      "id": "0",
      "type": "SUCCESS",
      "data": {
        "fields": {
          "from": "text",
          "from_domain": "domain",
          "provider": "enum",
          "received_hour": "number",
          "has_attachment": "bool"
        },
        "operators": {
          "text": [
            "contains",
            "not_contains",
            "is",
            "…"
          ],
          "enum": [
            "is_any_of",
            "is_none_of"
          ]
        },
        "actions": {
          "move": "folder",
          "keep_inbox": "",
          "label": "label",
          "snooze": "hours",
          "auto_reply": "template"
        },
        "providers": {
          "microsoft_365": "Microsoft 365",
          "google_workspace": "Google Workspace",
          "icloud": "iCloud",
          "other": "Other / own server"
        },
        "limits": {
          "rules": 100,
          "conditions": 20,
          "actions": 12,
          "value": 2000,
          "regex": 300,
          "list_items": 500
        }
      }
    }
  ]
}

エラー

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

  • 401TOKEN_EXPIRED

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

  • 401INVALID_TOKEN

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

  • 429RATE_LIMITED

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

  • CMDINTERNAL

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