Email Assistant for Salesforce

Email Assistant for Salesforce

The Email Assistant lets an approved sender forward email into Salesforce and launch an iDialogue Agent from the captured email record.

This workflow is designed for one-way email-to-agent processing. It is not intended for threaded replies or case conversation handling.

What the package provides

The package provides:

  • AgentEmailHandler, a Salesforce Email Service handler
  • AgentInboundEmail__c, the intake record created for each accepted email
  • File storage for original email attachments
  • File storage for oversized plain text or HTML email bodies
  • hash-based duplicate detection for retry-safe intake

The package does not create the final record-triggered Flow because the Agent Name is specific to each Salesforce org.

Create the Email Service

In Salesforce Setup:

  1. Open Email Services.
  2. Create a new Email Service.
  3. Select the Apex class AgentEmailHandler.
  4. Set the attachment option to accept attachments.
  5. Configure authorized senders or authorized sender domains.
  6. Save the Email Service.
  7. Create an Email Service Address.
  8. Copy the generated email address.
  9. Configure your mailbox or forwarding rule to forward approved email to that generated address.

Salesforce Email Services authorized senders and domains are the trust boundary for this feature. Only configure senders that should be allowed to trigger the agent workflow.

Salesforce enforces a maximum total email size of 25 MB for inbound email processing.

Create the Flow

Create a record-triggered Flow:

  • Object: AgentInboundEmail__c
  • Trigger: created
  • Entry condition: Status__c Equals New
  • Optimize for: actions and related records

Add one Apex action:

  • Action: Run Agent Action (AI)
  • agentName: the exact name of the iDialogue Agent that should process these emails
  • recordId: $Record.Id
  • runAsync: true
  • userPrompt: a short instruction such as Process this inbound email and take the appropriate Salesforce action.

Activate the Flow after testing it in a sandbox or development org.

The Flow should only launch the async agent action. It should not mark the email as completed, because RunAgentAction returns as soon as the async job is queued.

What the Agent receives

The Agent receives the AgentInboundEmail__c record as its record context.

Important fields include:

  • Subject__c
  • FromName__c
  • FromAddress__c
  • ToAddress__c
  • PlainTextBody__c
  • HtmlBody__c
  • BodyStorageMode__c
  • BodyContentVersionIds__c
  • Status__c
  • AgentName__c
  • RelatedRecordId__c
  • HashSignature__c
  • DuplicateOf__c
  • ProcessingError__c
  • Source__c

Use the sample prompt in agents/InboundEmailHandler.md as a starting point for the Agent's system instructions.

Body and attachment handling

Most email bodies are stored directly on the intake record.

If a plain text or HTML body exceeds inline storage limits, the package stores that body as a Salesforce File linked to the AgentInboundEmail__c record. The corresponding body field contains instructions telling the Agent to read the linked body file.

Original email attachments are also stored as Salesforce Files linked to the intake record.

The Agent should inspect linked Files when:

  • the body field says the body was stored as a file
  • the sender refers to an attachment
  • the requested task depends on document content

Operational notes

This feature is for one-way inbound processing. For threaded conversations, replies, and customer support email workflows, use a future Email-to-Case based agent.

Duplicate inbound email retries are ignored using the intake hash. If an email already exists with the same hash, the handler returns success to Salesforce Email Services and does not create another intake record.

If the Agent can update Salesforce records, it may update Status__c to Completed or Failed and write a concise error to ProcessingError__c.

Generated 2026-04-26T21:57:26.136829Z
iDialogue Agent

Ask about this page, related knowledge or specific iDialogue product and support features.