Smore API Help

Example Payload

The payload of a Webhook is a JSON object that contains all the information about the responses. Here is an example:

{ "id": "82a176e3-b0e6-4d0c-8cc2-04c00376e159", "type": "responses", "responses": [ { "id": "qSlokcnTqx", "token": "XKl8BpoITbOmPDQk", "submittedAt": "2023-12-04T10:50:54.522Z", "ending": { "name": "Thank you!", "score": null }, "metadata": { "browser": "Chrome", "duration": 220, "device": "Mac", "referrer": "Direct", "location": { "country": "KR", "region": "Seoul" } }, "customFields": [ { "name": "user_id", "value": "xxxxx" }, { "name": "source", "value": "xxxxx" } ], "answers": [ { "id": "field-769da8bf5166", "question": "What is your gender?", "questionType": "button-selection", "answerType": "string", "string": "Female" }, { "id": "field-045ce7b5389c", "question": "What is your full name?", "questionType": "input-short", "answerType": "string", "string": "Doda Churu" }, { "id": "field-a16efde0183b", "question": "What is your email address?", "questionType": "input-email", "answerType": "email", "email": "doda@smore.im" }, { "id": "field-dcb799037916", "question": "Please enter your date of birth", "questionType": "input-date", "answerType": "date", "date": "2019-02-17" }, { "id": "field-e0e38c6195fe", "question": "Please select your appointment time", "questionType": "input-time", "answerType": "time", "time": "19:49" }, { "id": "field-25b2128f437a", "question": "Please enter your age", "questionType": "input-number", "answerType": "integer", "integer": 4 }, { "id": "field-e3d7b41cde45", "question": "Please select your favorite fruit", "questionType": "input-dropdown", "answerType": "string", "string": "Apple" }, { "id": "field-44e143517973", "question": "How would you rate our service?", "questionType": "input-rating", "answerType": "integer", "integer": 5 }, { "id": "field-852654a1d09e", "question": "How much would you like to recommend our service?", "questionType": "input-nps", "answerType": "integer", "integer": 10 }, { "id": "field-6fa169c0654c", "question": "How are you feeling today?", "questionType": "input-slider", "answerType": "integer", "integer": 84 }, { "id": "field-bc8814149dd8", "question": "Please select an option", "questionType": "input-single-choice", "answerType": "string", "string": "Option2" }, { "id": "field-4ede03da87ca", "question": "Please select multiple options", "questionType": "input-multiple-choice", "answerType": "stringArray", "stringArray": [ "Option1", "Option2" ] }, { "id": "field-4bdc732854e3", "question": "Please elaborate on your issue", "questionType": "input-long", "answerType": "string", "string": "Occaecat elit veniam veniam qui" }, { "id": "field-8807adf59000", "question": "Please enter your company’s website URL", "questionType": "input-url", "answerType": "url", "url": "https://smore.im" }, { "id": "field-2ce88d105c19-1", "question": "Monday [Please select all possible time slots]", "questionType": "input-grid-row", "answerType": "stringArray", "stringArray": [ "12:00~13:00" ] }, { "id": "field-2ce88d105c19-3", "question": "Wednesday [Please select all possible time slots]", "questionType": "input-grid-row", "answerType": "stringArray", "stringArray": [ "15:00~16:00" ] }, { "id": "field-2ce88d105c19-2", "question": "Tuesday [Please select all possible time slots]", "questionType": "input-grid-row", "answerType": "stringArray", "stringArray": [ "17:00~18:00" ] }, { "id": "field-1e3a75b5294b", "question": "Please upload the screenshot", "questionType": "input-file", "answerType": "file", "file": "https://smore.im/api/form/download-file?id=YLF10pKLsFwjdFZb51IMO0sHdb4HiL&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } ] } ] }

Payload Fields

The Webhook Payload triggered upon receiving a new response contains the following fields:

{ "id": "82a176e3-b0e6-4d0c-8cc2-04c00376e159", "type": "responses", "responses": [/* ... */] }
id

The unique ID of the Webhook event. Each Webhook event has its own ID, which you can record to prevent a Webhook event from being processed multiple times.

type

Indicates the type of the Webhook event and the data fields, here being `response`.

responses

An array containing one or multiple response information.

Response Fields

Each element in the responses array contains the following fields:

{ "id": "qSlokcnTqx", "token": "XKl8BpoITbOmPDQk", "submittedAt": "2023-12-04T10:50:54.522Z", "ending": { "name": "Thank you!", "score": null }, "metadata": { /* ... */ }, "customFields": [ /* ... */ ], "answers": [ /* ... */ ] }
id

Form ID.

token

Unique ID of the response. Each response has a unique ID, which you can use to avoid duplicate processing.

submittedAt

Submission time of the response.

ending

Ending page information of the response. The `name` is the name of the ending, and if the response is from a scored Quiz, the `score` field will be set to the user's score.

metadata

Metadata of the response. This field is only available to Premium plan users; if you are not a Premium plan user, you will receive `null`.

customFields

Custom fields of the response.

answers

Answers information of the response.

Metadata Field

If you are a Premium plan user, you will receive the following metadata:

{ "browser": "Chrome", "duration": 220, "device": "Mac", "referrer": "Direct", "location": { "country": "KR", "region": "Seoul" } }
browser

Browser used by the user.

duration

Time taken by the user to complete the form (in seconds).

device

Device used by the user.

referrer

Referrer from where the user accessed the form.

location

Geographical IP location information of the user.

If you are not a Premium plan user, you will receive "metadata": null.

CustomFields Field

If you use the Hidden Field feature, you will receive the following custom fields:

[ { "name": "user_id", "value": "xxxxx" }, { "name": "source", "value": "xxxxx" } ]
name

Name of the custom field.

value

Value of the custom field, type is string.

Answers Field

This field contains all the answers information of the user. For example, if the user answered a single-choice question, you will receive the following answer information:

{ "id": "field-769da8bf5166", "question": "What is your gender?", "questionType": "button-selection", "answerType": "string", "string": "Female" }
id

ID of the question. Each question has its unique ID, which changes when the question type is modified.

question

Title of the question.

questionType

Type of the question.

answerType

Data type of the question's answer, which is also the name of the answer field. You can use this field to retrieve the answer; here, the value of this field is `string`, so you can use the `string` field to get the answer.

string

User's answer content. In this example, since `answerType` is `string`, this field contains the user's answer.

You can determine the type of the question based on questionType, and then use the corresponding field of answerType to retrieve the value of the answer.

Last modified: 08 December 2023