Download user feedback

In this section, we will explain how to download them from Stream on the server-side. The user feedback and ratings collected are also shown in our dashboard

To integrate user ratings and feedback please follow the client SDK documentation to implement the functionality

Download user feedback

The collected feedback can be downloaded with the server side SDKs as follows

The example below shows fetching feedback (with built-in pagination support) using our SDK client

const response = await client.video().queryUserFeedback({});

You can filter the feedback by various criteria. The table lists supported filter types and their description

FilterDescription
Call CIDFilter feedback submitted for a particular call CID
User IDFilter feedback submitted by a particular user
User ratingFilter reports by user rating (supports less than, greater than etc operators)
Call Session ID(Advanced) When you re-use call CID, they will have different session IDs. For example, think of recurring calls

The examples below show various common use cases. It is also possible to use multiple filters to narrow the query results.

Filter by call

The below example shows downloading all the feedback submitted for the call “call CID”

const callCID = "default:1234";
const response = await client.video().queryUserFeedback({
  filter_conditions: {
    call_cid: callCID,
  },
});

An advanced use case is specifying both call CID and the call session ID.

const callCID = "default:1234";
const callSessionID = "d1a5803b-6121-4fc2-b070-e5eed3277ed4";
const response = await client.video().queryUserFeedback({
  filter_conditions: {
    call_cid: callCID,
    call_session_id: callSessionID,
  },
});

Filter by user(s)

This example demonstrates downloading feedback from a user across calls

const userID = "foo";
const response = await client.video().queryUserFeedback({
  filter_conditions: {
    user_id: callCID,
  },
});

A slight variation of the previous example is querying feedback for multiple users at the same time

const users = ["foo", "bar"];
const response = await client.video().queryUserFeedback({
  filter_conditions: {
    user_id: { $in: users },
  },
});

Filter by rating

Reports can be filtered by ratings. More often than not, negative reports are more interesting and people usually report only when they run into some issues.

  1. Negative feedback (rated less than 3)
const response = await client.video().queryUserFeedback({
  filter_conditions: {
    rating: { $lt: 3 },
  },
});
  1. Neutral feedback (rated 3)
const response = await client.video().queryUserFeedback({
  filter_conditions: { rating: 3 },
});
  1. Positive feedback (rated 4 or 5)
const response = await client.video().queryUserFeedback({
  filter_conditions: {
    rating: { $gte: 4 },
  },
});

The full list of supported operators is as follows

OperatorMeaning
$lteLess than or equal to (<=)
$ltLess than (<)
$gteGreater than or equal to (>=)
$gtGreater than (>)

Combine multiple conditions

You can combine multiple conditions. The below example shows querying only the negative feedback provided by a particular user.

const user = "foo";
const response = await client.video().queryUserFeedback({
  filter_conditions: {
    user_id: user,
    rating: { $lt: 3 },
  },
});

Specifying sort order

By default, most recent feedback is returned. However, you can specify the sort condition so that the earliest reported feedback is returned

const response = await client.video().queryUserFeedback({
  sort: [
    // 1  = ascending order
    // -1 = descending order (default for created_at)
    { field: "created_at", direction: 1 },
  ],
});

Specifying the maximum number of items to be retrieved

You can specify the number of items to be retrieved with the limit option.

The following example shows retrieving the 5 most recent feedback received

const response = await client.video().queryUserFeedback({ limit: 5 });

Note: The maximum items that can be retrieved with a single call is 100. If limit parameter exceeds this, then it is an error (HTTP 400)

Downloading with custom data

By default the custom data is NOT included. However, you can download that with full option as follows

const response = await client.video().queryUserFeedback({ full: true });
© Getstream.io, Inc. All Rights Reserved.