Survey Responses Using Invitation Configurations (POST, PATCH)

Create responses using the invitation configuration details and initiate the process of submitting the survey responses by making a POST request. Submit the survey responses using the PATCH request. You can create a survey to collect data from customers, employees, or other people whose feedback you need. The survey responses are stored in the SurveyResponse object and the responses to individual questions in the SurveyQuestionResponse object.

Salesforce Feedback Management (SFM) Business API performance can be impacted if a POST request exceeds 5,400 calls per minute and if a PATCH request exceeds 2,700 calls per minute at the org level. For more rate limit information, see Connect REST API Limits.

Note

Special Access Rules 

The Feedback Management - Starter and Feedback Management - Growth licenses are required to use this resource.

Resource 

1/connect/surveys/SURVEY_ID/survey-response

Where SURVEY_ID is a variable.

Resource Example 

1https://yourInstance.salesforce.com/services/data/56.0/connect​/surveys/0Kdx00000000H46CAE/survey-response

Available Version 

56.0

HTTP Methods 

PATCH, POST

The HTTP header request format only accepts Content-Type: application/json.

Note

Request Body for POST 

Root XML tag 

<SurveyDescriptionInput>

JSON Example 

1{
2  "languageCode": "",
3  "relatedRecordIds": [
4    "500xx000000bo3dAAA"
5  ],
6  "recipientEngagementContext": {
7    "test_key1": "test_value1",
8    "test_key2": "test_value1"
9  },
10  "invitationSettings": {
11    "recipientId": "005xx000001X7ibAAC",
12    "allowGuestUserResponse": false,
13    "allowParticipantsAccessTheirResponse": false,
14    "collectAnonymousResponse": false,
15    "invitationExpirationDate": "2022-07-31T21:32:54",
16    "communityId": "",
17    "invitationOwner": ""
18  }
19}

Properties 

NameTypeDescriptionRequired or OptionalAvailable Version
invitationSettingsSurvey Invitation Settings InputInvitation settings of the survey. The Invitation ID API doesn’t require the invitation configuration settings to be passed with the Survey Invitations.Required56.0
languageCodeStringCode of the language in which the survey is created.Optional56.0
recipient​Engagement​ContextMap<String, String>Engagement context settings for a recipient of the survey.Optional56.0
relatedRecordIdsString[]IDs of the records that are related to the survey.Optional56.0
shouldLoad​PartiallyCmpl​SurveyBooleanIndicates whether to load partially completed surveys when a partially completed survey is selected (true), or to start a new survey (false). The default value is false.Optional63.0
staticMergeFieldsMap<String, String>Map of static merge field values.Optional56.0

Response Body for POST 

Survey Description Output

Request Body for PATCH 

Root XML tag 

<SurveyResponseInput>

JSON Example 

Here’s an example for multiple questions.

1{
2  "invitationId": "0Kixx0000004DbMCAU",
3  "languageCode": "en",
4  "flowInterviewState": "ewqJgw",
5  "navigationAction" : "Next",
6  "surveyPageResponses": {
7    "name" :  "p_ff794819_c0f0_4e0d_b357_29ca1694cfc4",
8    "questionResponses": [
9      {
10        "name": "q_d217f330_05a6_4e2b_859b_1f1ef210bf84",
11        "questionType": "NPS",
12        "responseValue": 5
13      },
14      {
15        "name": "q_ab781617_3665_4a41_b4ff_f236d73ecb30",
16        "questionType": "FreeText",
17        "responseValue": "Free Text Question Response"
18      },
19      {
20        "name": "q_b1cdfe4c_9c7d_4c2f_ad9d_1915d301d780",
21        "questionType": "ShortText",
22        "responseValue": "Short Text Question Response"
23      },
24      {
25        "name": "q_f84a6a3c_683c_4ed5_864e_5b486baed308",
26        "questionType": "Boolean",
27        "responses": [
28          {
29            "name": "choice1"
30          }
31        ]
32      },
33      {
34        "name": "q_113419b1_5d29_4bb9_8b10_e3fe324ae040",
35        "questionType": "MultiChoice",
36        "responses": [
37          {
38            "name": "c_9775c2e5_9086_44a8_a5c9_89fdc886c99a"
39          },
40          {
41            "name": "c_0f1f63cc_608a_4560_9d29_72b203f195f2"
42          }
43        ]
44      },
45      {
46        "name": "q_1d8690a9_ae95_4e7c_86be_b8057205facc",
47        "questionType": "RadioButton",
48        "responses": [
49          {
50            "name": "c_4867edc8_e9a6_4e86_9fea_b80758e90caf"
51          }
52        ]
53      },
54      {
55        "name": "q_8946f212_25ff_43a8_a507_d267637eee1f",
56        "questionType": "Rating",
57        "responses": [
58          {
59            "name": "c_f51c509a_9643_4a05_89f1_42464de618a6"
60          }
61        ]
62      }
63    ]
64  }
65}

Here’s an example for a single question.

1{
2  "invitationId": "0Kixx0000004EdsCAE",
3  "languageCode": "en",
4  "navigationAction" : "Next",
5  "surveyPageResponses": {
6    "questionResponses": [
7      {
8        "name": "q_3e501184_bb93_4a9c_a66b_6f2d81c92316",
9        "questionType": "FreeText",
10        "responseValue": "Answer for text question"
11      }
12    ]
13  },
14  "flowInterviewState": "eg"
15}

Properties 

NameTypeDescriptionRequired or OptionalAvailable Version
flowInterview​StateStringState of the flow interview.Required56.0
invitationIdStringID of the survey invitation.Required56.0
languageCodeStringCode of the language that the survey is created in.Optional56.0
navigationActionStringAvailable navigation actions on the survey page. Possible values are:
  • Back—Navigate to the previous survey page.
  • Next—Navigate to the next survey page.
Required57.0
surveyPage​ResponsesSurvey Page Response InputResponses to the survey questions on a page.Required56.0

Response Body for PATCH 

Survey Response Output