Skip to main content

Surveys - NPS Widget

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint

/o/surveys/nps/widget

Overview

Returns one NPS widget (widget_id) or multiple NPS widgets (widget_ids).

Authentication

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions

  • Surveys: Read permission.

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
app_idStringYesApp ID
widget_idStringConditionalSingle widget ID
widget_idsStringConditionalComma-separated widget IDs
shownBoolean/StringNoRecord display/impression metadata
platformStringNoShown context
app_versionStringNoShown context
journeyIdStringNoOptional source tagging

Examples

/o/surveys/nps/widget?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&widget_id=67b9db56f67aab0012cd8899

Response

Success Response

{
"_id": "67b9db56f67aab0012cd8899",
"type": "nps",
"name": "NPS Q1",
"msg": {
"mainQuestion": "How likely are you to recommend us?"
},
"followUpType": "score"
}

Response Fields

FieldTypeDescription
_idStringWidget ID
typeStringnps
nameStringWidget name
msgObjectNPS message texts
followUpTypeStringNPS follow-up mode

Error Responses

  • HTTP 400 - Missing/invalid widget identifier:
{
"result": "Missing parameter \"widget_id\" or \"widget_ids\""
}
  • HTTP 404 - Not found:
{
"result": "Widget not found."
}

Behavior

  • Requires either widget_id or comma-separated widget_ids.
  • Reads only active widgets (status=true) from feedback_widgets.
  • For widget_id, returns a single object; for widget_ids, returns an array.
  • Returned fields are limited to app/type/name/message/score/appearance/link/final text/version/consent fields used by SDK clients.
  • If shown is present with a single widget, increments widget shown, records a custom metric in the Survey/NPS aggregate collection, and stores metric metadata for the widget/platform/app version/source key.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.feedback_widgetsEndpoint data sourceStores endpoint-related records this endpoint reads or modifies.
countly.appsApp configuration and metadataStores app-level feature settings and metadata used or modified by this endpoint.