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.

Outbound Message with Citations Payload Excerpt
1{
2  "staticContent": {
3    "formatType": "Text",
4    "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.",
5    "citationContent": {
6      "citations": [
7        {
8          "citedReference": {
9            "citedReferenceType": "Link",
10            "link": {
11              "url": "https://www.example.com/Wiki/iPhone_Battery_Replacement"
12             },
13             "recordId": null,
14             "label": "https://www.example.com/Wiki/iPhone_Battery_Replacement"
15           },
16         "citedDetails": {
17           "citedDetailsType": "InlineMetadata",
18           "inlineMetadata": [
19             {
20               "claim": {
21                  "claimStartOffset": 0,
22                  "claimEndOffset": 309
23                },
24              "citedLocationOffset": 309
25             }
26           ]
27         }
28       },
29       {
30         "citedReference": {
31           "citedReferenceType": "Link",
32           "link": {
33              "url": "https://www.example.com/News/11220/3-ways-replace-iphone-battery"
34            },
35           "recordId": null,
36           "label": "https://www.example.com/News/11220/3-ways-replace-iphone-battery"
37         },
38         "citedDetails": {
39           "citedDetailsType": "InlineMetadata",
40           "inlineMetadata": [
41              {
42                "claim": {
43                  "claimStartOffset": 309,
44                  "claimEndOffset": 391
45                },
46              "citedLocationOffset": 391
47             }
48           ]
49         }
50       }
51     ]
52   }
53 }
54}

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.

FieldTypeDescription
CitationContentObjectContains an array of citation objects.
citationsArrayArray of citation objects
citationObjectRepresents a single citation reference and its metadata.
citedReferenceObjectThe source being cited (currently supports Link type).
citedDetailsObjectMetadata about where the citation applies in the message text.
LinkCitedReferenceObjectCitation reference pointing to a URL.
citedReferenceTypeStringMust be "Link".
linkObjectLink object containing a url field.
labelStringDisplay label for the citation (e.g., “example” for example.com).
recordIdStringSalesforce record ID if citation links to a Salesforce object.
InlineMetadataCitedDetailsObjectSpecifies where citations should appear in the message text.
citedDetailsTypeStringMust be "InlineMetadata".
inlineMetadataArrayArray of metadata objects (minimum 1).
citedLocationOffsetIntegerZero-indexed character position where citation marker should be inserted.
claimObjectDefines the text span this citation supports with claimStartOffset and claimEndOffset (both integers).