メールの受信:送信と信頼

Set Trust

送信者を信頼済みまたは信頼しないに設定するか、デフォルトに戻します。

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

defaultで判断を削除します。メッセージをSpamに移すと、その送信者もuntrustedになります。

emailsで多くの送信者をまとめて更新できます。たとえばmoveでSpamから出したときに返るsenderの値です。ゲストにはrules権限が必要です。

引数

  • idstring任意

    メッセージid。その会話の外部送信者を使います。

  • from_emailstring任意

    送信者のメールアドレス。これかidを使います。

  • emailsstring[]任意

    送信者のメールアドレスを最大100件。レスポンスは一括形式で、メールアドレスごとに1件。

  • valuestring必須

    default、trusted、untrusted。

クイックスタート

import axios from 'axios';

const response = await axios.post(
  'https://g.sendcorex.com/v1',
  {
    commands: [
      {
        command: "set_trust",
        args: {
          from_email: "client@example.com",
          value: "trusted"
        }
      }
    ]
  },
  { 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": "set_trust",
      "id": "0",
      "type": "SUCCESS",
      "data": {
        "from_email": "client@example.com",
        "trust_status": "trusted",
        "is_trusted": true
      }
    }
  ]
}

レスポンスの項目

  • from_email

    更新した送信者。

  • trust_status

    新しいステータス。

  • is_trusted

    ステータスがtrustedの場合のみtrue。

  • items

    emailsの場合:アドレスごとに1件、およびok_countとfailed_count。

多くの送信者をまとめて信頼

1つのコマンドで最大100件のアドレス。

Request · Response

{
  "commands": [
    {
      "command": "set_trust",
      "args": {
        "emails": [
          "john@acme.com",
          "ana@foo.io"
        ],
        "value": "trusted"
      }
    }
  ]
}

{
  "items": [
    {
      "id": "john@acme.com",
      "ok": true,
      "data": {
        "from_email": "john@acme.com",
        "trust_status": "trusted",
        "is_trusted": true
      }
    },
    {
      "id": "ana@foo.io",
      "ok": true,
      "data": {
        "from_email": "ana@foo.io",
        "trust_status": "trusted",
        "is_trusted": true
      }
    }
  ],
  "ok_count": 2,
  "failed_count": 0
}

エラー

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

  • 401TOKEN_EXPIRED

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

  • 401INVALID_TOKEN

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

  • 429RATE_LIMITED

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

  • CMDINVALID_ARGS

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

  • CMDNOT_FOUND

    このトークンでは、そのメッセージ、スレッド、フォルダーは存在しません。

  • CMDINTERNAL

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