Add Citations in Agent Responses

To build trust in Agentforce Service Agent responses, include citations to source information. Citations appear in static text messages as a citationContent field in the outbound message event payload. To support this optional feature, parse the citationContent field and render inline markers and a sources list in your UI. For example, include inline markers like [1], [2] and a Sources section at the end of the message. There’s no capability registration required to turn on the feature.

Citations appear in static text messages as an optional citationContent field. This field contains:

  • Citation references: Links to source articles with optional display labels and optional Salesforce record IDs
  • Inline metadata: Character offset positions indicating where citation markers should appear in the message text

Structure of Outbound Message Event with Citations

When a message includes citations, the staticContent object contains a citationContent field.

{
  "staticContent": {
    "formatType": "Text",
    "text": "To replace your iPhone battery, you can follow step-by-step instructions available on various platforms. Here are some options: 1. DIY Replacement: You can replace the battery yourself using DIY kits. Detailed instructions and comparisons of costs, savings, and time for different models can be found here. 2. Professional Repair Shop: You can take your iPhone to a reputable repair shop.",
    "citationContent": {
      "citations": [
        {
          "citedReference": {
            "citedReferenceType": "Link",
            "link": {
              "url": "https://www.example.com/Wiki/iPhone_Battery_Replacement"
             },
             "recordId": null,
             "label": "https://www.example.com/Wiki/iPhone_Battery_Replacement"
           },
         "citedDetails": {
           "citedDetailsType": "InlineMetadata",
           "inlineMetadata": [
             {
               "claim": {
                  "claimStartOffset": 0,
                  "claimEndOffset": 309
                },
              "citedLocationOffset": 309
             }
           ]
         }
       },
       {
         "citedReference": {
           "citedReferenceType": "Link",
           "link": {
              "url": "https://www.example.com/News/11220/3-ways-replace-iphone-battery"
            },
           "recordId": null,
           "label": "https://www.example.com/News/11220/3-ways-replace-iphone-battery"
         },
         "citedDetails": {
           "citedDetailsType": "InlineMetadata",
           "inlineMetadata": [
              {
                "claim": {
                  "claimStartOffset": 309,
                  "claimEndOffset": 391
                },
              "citedLocationOffset": 391
             }
           ]
         }
       }
     ]
   }
 }
}

Handle Citation Offsets

All offsets are zero-indexed character positions in the staticContent.text field.

  • citedLocationOffset specifies where to insert a citation marker (e.g., [1])
  • claimStartOffset / claimEndOffset define which portion of the text the citation supports.

Citation Schema Reference

The citation schema uses a discriminator pattern with the following fields.

Field Type Description
CitationContent Object Contains an array of citation objects.
citations Array Array of citation objects
citation Object Represents a single citation reference and its metadata.
citedReference Object The source being cited (currently supports Link type).
citedDetails Object Metadata about where the citation applies in the message text.
LinkCitedReference Object Citation reference pointing to a URL.
citedReferenceType String Must be "Link".
link Object Link object containing a url field.
label String Display label for the citation (e.g., "example" for example.com).
recordId String Salesforce record ID if citation links to a Salesforce object.
InlineMetadataCitedDetails Object Specifies where citations should appear in the message text.
citedDetailsType String Must be "InlineMetadata".
inlineMetadata Array Array of metadata objects (minimum 1).
citedLocationOffset Integer Zero-indexed character position where citation marker should be inserted.
claim Object Defines the text span this citation supports with claimStartOffset and claimEndOffset (both integers).