My agentic slop goes here. Not intended for anyone else!

Query 7: VIP Contacts Marked Important#

Use Case Description#

Find recent emails from VIP contacts that have been marked as important. This combines sender filtering with keyword-based importance detection, useful for prioritizing communications from key stakeholders.

Key JMAP Concepts Used#

  • Multiple sender filtering: Using OR conditions for specific email addresses
  • Keyword importance: Using $flagged and custom importance keywords
  • Complex filtering: Combining sender and keyword conditions with AND/OR logic
  • Contact-based queries: Filtering by specific email addresses or domains
  • Priority email management: Identifying high-value communications

JMAP Request#

{
  "using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail"],
  "methodCalls": [
    [
      "Email/query",
      {
        "accountId": "u12345678",
        "filter": {
          "operator": "AND",
          "conditions": [
            {
              "operator": "OR",
              "conditions": [
                {
                  "from": "ceo@company.com"
                },
                {
                  "from": "board@company.com" 
                },
                {
                  "from": "legal@company.com"
                },
                {
                  "from": "*@important-client.com"
                },
                {
                  "from": "partner@strategic-partner.com"
                }
              ]
            },
            {
              "operator": "OR",
              "conditions": [
                {
                  "hasKeyword": "$flagged"
                },
                {
                  "hasKeyword": "important"
                },
                {
                  "hasKeyword": "urgent"
                },
                {
                  "hasKeyword": "vip"
                }
              ]
            },
            {
              "after": "2024-08-15T00:00:00Z"
            }
          ]
        },
        "sort": [
          {
            "property": "receivedAt",
            "isAscending": false
          }
        ],
        "limit": 15
      },
      "q0"
    ],
    [
      "Email/get",
      {
        "accountId": "u12345678",
        "#ids": {
          "resultOf": "q0",
          "name": "Email/query",
          "path": "/ids"
        },
        "properties": [
          "id", "threadId", "mailboxIds", "keywords", "from", "to", "cc",
          "subject", "receivedAt", "sentAt", "hasAttachment", "preview",
          "textBody", "htmlBody", "size"
        ]
      },
      "g0"
    ]
  ]
}

Expected Response Structure#

{
  "methodResponses": [
    [
      "Email/query",
      {
        "accountId": "u12345678",
        "queryState": "q1234567895",
        "canCalculateChanges": true,
        "position": 0,
        "ids": ["Memail401", "Memail402", "Memail403"],
        "total": 8,
        "limit": 15
      },
      "q0"
    ],
    [
      "Email/get",
      {
        "accountId": "u12345678",
        "state": "s9876543216",
        "list": [
          {
            "id": "Memail401",
            "threadId": "Tthread601",
            "mailboxIds": {"Minbox": true, "Mvip": true},
            "keywords": {
              "$flagged": true,
              "$seen": true,
              "urgent": true,
              "vip": true
            },
            "from": [{"email": "ceo@company.com", "name": "Jane CEO"}],
            "to": [{"email": "me@example.com", "name": "John Doe"}],
            "cc": [{"email": "board@company.com", "name": "Board of Directors"}],
            "subject": "Q4 Strategic Planning - Board Meeting Required",
            "receivedAt": "2024-08-24T08:30:00Z",
            "sentAt": "2024-08-24T08:28:00Z",
            "hasAttachment": true,
            "preview": "John, we need to accelerate our Q4 planning process. Please prepare a comprehensive review...",
            "textBody": [{"id": "text1", "mimeType": "text/plain"}],
            "htmlBody": null,
            "size": 3456
          },
          {
            "id": "Memail402",
            "threadId": "Tthread602", 
            "mailboxIds": {"Minbox": true},
            "keywords": {
              "$flagged": true,
              "$seen": false,
              "important": true
            },
            "from": [{"email": "legal@company.com", "name": "Sarah Legal"}],
            "to": [{"email": "me@example.com", "name": "John Doe"}],
            "cc": [],
            "subject": "Contract Amendment - Immediate Review Needed",
            "receivedAt": "2024-08-23T16:45:00Z",
            "sentAt": "2024-08-23T16:42:00Z",
            "hasAttachment": true,
            "preview": "John, we've received an amended contract from our client that requires immediate attention...",
            "textBody": [{"id": "text2", "mimeType": "text/plain"}],
            "htmlBody": [{"id": "html1", "mimeType": "text/html"}],
            "size": 8923
          },
          {
            "id": "Memail403",
            "threadId": "Tthread603",
            "mailboxIds": {"Minbox": true, "Mclients": true},
            "keywords": {
              "$seen": true,
              "$answered": true,
              "vip": true,
              "important": true
            },
            "from": [{"email": "director@important-client.com", "name": "Mike Director"}],
            "to": [{"email": "me@example.com", "name": "John Doe"}], 
            "cc": [{"email": "account-team@important-client.com", "name": "Account Team"}],
            "subject": "Project Timeline Concerns - Discussion Needed",
            "receivedAt": "2024-08-22T14:20:00Z",
            "sentAt": "2024-08-22T14:18:00Z",
            "hasAttachment": false,
            "preview": "Hi John, I wanted to discuss some concerns about our current project timeline...",
            "textBody": [{"id": "text3", "mimeType": "text/plain"}],
            "htmlBody": null,
            "size": 2134
          }
        ],
        "notFound": []
      },
      "g0"
    ]
  ]
}

Explanation of Key Features#

VIP Contact Identification#

The query identifies VIP contacts through:

  • Specific addresses: ceo@company.com, legal@company.com
  • Functional addresses: board@company.com (group addresses)
  • Domain wildcards: *@important-client.com (entire organization)
  • Individual contacts: partner@strategic-partner.com

Multi-Level Importance Filtering#

{
  "operator": "OR",
  "conditions": [
    {"hasKeyword": "$flagged"},      // Standard IMAP flag
    {"hasKeyword": "important"},     // Custom importance keyword  
    {"hasKeyword": "urgent"},        // Custom urgency keyword
    {"hasKeyword": "vip"}           // Custom VIP keyword
  ]
}

Advanced Keyword Strategy#

  • System keywords: $flagged (standard IMAP importance flag)
  • Custom keywords: important, urgent, vip (user-defined labels)
  • Hybrid approach: Combines standard and custom importance indicators
  • Flexible matching: OR logic catches any importance marker

Priority Mailbox Organization#

The response shows sophisticated mailbox organization:

  • Mvip: Dedicated VIP mailbox for important senders
  • Mclients: Client-specific mailbox for external communications
  • Minbox: Primary inbox (emails can be in multiple mailboxes)

Contact Classification Patterns#

Executive Communications:

  • CEO, Board, C-level executives
  • Often includes attachments (reports, presentations)
  • High-priority keywords and flags
  • CC lists include other executives

Legal/Compliance Communications:

  • Legal department emails
  • Contract-related communications
  • Time-sensitive review requirements
  • Often flagged as urgent and important

Client/External VIP Communications:

  • Major client contacts
  • Strategic partners
  • Domain-based matching for organizations
  • Often in specialized client mailboxes

Advanced VIP Management Queries#

Unread VIP Emails:

{
  "operator": "AND",
  "conditions": [
    {"from": "*@vip-domain.com"},
    {"hasKeyword": "$seen", "value": false}
  ]
}

VIP Thread Activity:

{
  "operator": "AND",
  "conditions": [
    {"from": "vip@client.com"},
    {"hasKeyword": "$answered", "value": false},
    {"after": "2024-08-20T00:00:00Z"}
  ]
}

Multi-Keyword Importance:

{
  "operator": "AND",
  "conditions": [
    {"hasKeyword": "$flagged"},
    {"hasKeyword": "urgent"},
    {"hasKeyword": "vip"}
  ]
}

Business Process Integration#

This query pattern supports:

  • Executive briefings: Quick identification of C-level communications
  • Legal compliance: Tracking time-sensitive legal communications
  • Client relationship management: Monitoring VIP client interactions
  • Escalation workflows: Identifying emails requiring immediate attention
  • Response time monitoring: Tracking VIP communication response requirements

Response Pattern Analysis#

The keywords in the results reveal email handling patterns:

  • $answered: User has responded to VIP communications
  • $seen + $answered: Complete handling cycle
  • $flagged + urgent: Multi-level importance marking
  • Mailbox placement indicates organizational workflow