MailAgentReplyRequest mail.agent-reply-request@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
mail
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/mail/agent-reply-request.v1.json

mail.agent.reply-request@1: the body of mail.agent.reply (POST /internal/mail/agents/:agent_id/reply), an agent answering a letter to its own address. The reply goes FROM the agent's inbox, never from the person's mailbox: the person's own address is not the agent's to write from. `body` is plain text, cut to 10000 characters; `in_reply_to` and `references` are Message-IDs WITHOUT the angle brackets, and Mail wraps each in one, so a thread stays one thread in the reader that receives it. A reply to an address that is not the sender's answers nothing: Mail refuses it rather than write to a stranger the agent's answer was not for. Nothing here says who the person is; the token does.

Fields

FieldTypeRequiredDescriptionConstraints
message_idstringThe message being answered, as mail.agent.read gave it. Mail takes the sender and the subject from it, so a caller cannot write to someone the message did not come from.
  • minLength 1
  • maxLength 512
tostringWho the reply goes to. Optional: without it the reply goes to the sender of message_id. When both are given they must be the same address.
  • format email
  • maxLength 254
bodystringyesThe reply, as plain text. Mail builds the message from it and sends no HTML.
  • minLength 1
  • maxLength 10000
in_reply_tostring | nullThe Message-ID this reply answers, without angle brackets. Mail wraps it: In-Reply-To: <…>.
  • maxLength 998
referencesarray of stringThe Message-IDs of the conversation, oldest first, without angle brackets. Mail wraps each: References: <…> <…>.
  • maxItems 100
  • items: maxLength 998

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: threaded
{
  "message_id": "m-4711",
  "to": "[email protected]",
  "body": "Tuesday at 10 is still good. See you then.\n\n— Helper, answering for Alice",
  "in_reply_to": "[email protected]",
  "references": [
    "[email protected]"
  ]
}
Valid: to-the-sender
{
  "message_id": "m-4711",
  "body": "Thanks, noted."
}
Rejected: from-and-html
{
  "message_id": "m-4711",
  "body": "An answer sent from the person's own mailbox, which is not the agent's to write from.",
  "from": "[email protected]",
  "html": "<p>An answer</p>"
}
Rejected: no-body
{
  "message_id": "m-4711",
  "to": "[email protected]",
  "body": ""
}
Rejected: with-attachments
{
  "message_id": "m-4711",
  "body": "At most 10000 characters, said the contract.",
  "attachments": [
    {
      "name": "a.pdf",
      "blob": "AAA"
    }
  ]
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('mail.agent-reply-request@1', value);   // { valid, errors: [{ path, message }] }