รับอีเมล: กฎ

Rule Options

ทุกอย่างที่กฎใช้ได้: ฟิลด์พร้อมตัวดำเนินการ การกระทำ ผู้ให้บริการ และขีดจำกัด ใช้สร้างตัวแก้ไขกฎ

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

อาร์กิวเมนต์

endpoint นี้ไม่มีอาร์กิวเมนต์

เริ่มต้นอย่างรวดเร็ว

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

    เกิน 15 คำขอ/วินาที หรือ 15 คำขอพร้อมกันสำหรับ IP + กล่องจดหมายเดียวกัน รอจำนวนวินาทีใน Retry-After

  • CMDINTERNAL

    ข้อผิดพลาดของเซิร์ฟเวอร์ รายละเอียดเขียนเฉพาะในล็อกเซิร์ฟเวอร์