const response = await client.video().queryUserFeedback({});
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
response = client.video.query_user_feedback()
import "github.com/GetStream/getstream-go"
response, err := client.Video().QueryUserFeedback(context.Background(),
&getstream.QueryUserFeedbackRequest{})
You can filter the feedback by various criteria. The table lists supported filter types and their description
Filter | Description |
---|---|
Call CID | Filter feedback submitted for a particular call CID |
User ID | Filter feedback submitted by a particular user |
User rating | Filter 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,
},
});
call_cid = "default:1234"
response = client.video.query_user_feedback(
filter_conditions = {
'call_cid': call_cid,
}
)
import "github.com/GetStream/getstream-go"
callCID := "default:1234"
response, err := client.Video().QueryUserFeedback(context.Background(), &getstream.QueryUserFeedbackRequest{
FilterConditions: map[string]any{
"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,
},
});
call_cid = "default:1234"
call_session_id = "d1a5803b-6121-4fc2-b070-e5eed3277ed4"
response = client.video.query_user_feedback(
filter_conditions = {
"call_cid": call_cid,
"call_session_id": call_session_id,
}
)
import "github.com/GetStream/getstream-go"
callCID := "default:1234"
callSessionID := "d1a5803b-6121-4fc2-b070-e5eed3277ed4"
response, err := client.Video().QueryUserFeedback(context.Background(), &getstream.QueryUserFeedbackRequest{
FilterConditions: map[string]any{
"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,
},
});
user_id = "foo"
response = client.video.query_user_feedback(
filter_conditions = {
'user_id': user_id,
}
)
import "github.com/GetStream/getstream-go"
userID := "foo"
response, err := client.Video().QueryUserFeedback(context.Background(), &getstream.QueryUserFeedbackRequest{
FilterConditions: map[string]any{
"user_id": userID,
},
})
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 },
},
});
users = ['foo', 'bar']
response = client.video.query_user_feedback(
filter_conditions = {
'user_id': { '$in': users }
}
)
import "github.com/GetStream/getstream-go"
users := []string{"foo", "bar"}
response, err := client.Video().QueryUserFeedback(context.Background(), &getstream.QueryUserFeedbackRequest{
FilterConditions: map[string]any{
"call_cid": map[string]any{ "$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.
- Negative feedback (rated less than 3)
const response = await client.video().queryUserFeedback({
filter_conditions: {
rating: { $lt: 3 },
},
});
response = client.video.query_user_feedback(
filter_conditions = {
'rating': { '$lt': 3 }
}
)
import "github.com/GetStream/getstream-go"
response, err := client.Video().QueryUserFeedback(context.Background(), &getstream.QueryUserFeedbackRequest{
FilterConditions: map[string]any{
"rating": map[string]any{ "$lt": 3 },
},
})
- Neutral feedback (rated 3)
const response = await client.video().queryUserFeedback({
filter_conditions: { rating: 3 },
});
response = client.video.query_user_feedback(
filter_conditions = { 'rating': 3 }
)
import "github.com/GetStream/getstream-go"
response, err := client.Video().QueryUserFeedback(context.Background(), &getstream.QueryUserFeedbackRequest{
FilterConditions: map[string]any{"rating": 3},
})
- Positive feedback (rated 4 or 5)
const response = await client.video().queryUserFeedback({
filter_conditions: {
rating: { $gte: 4 },
},
});
response = client.video.query_user_feedback(
filter_conditions = {
'rating': { '$gte': 4 }
}
)
import "github.com/GetStream/getstream-go"
response, err := client.Video().QueryUserFeedback(context.Background(), &getstream.QueryUserFeedbackRequest{
FilterConditions: map[string]any{
"rating": map[string]any{ "$gte": 4 },
},
})
The full list of supported operators is as follows
Operator | Meaning |
---|---|
$lte | Less than or equal to (<= ) |
$lt | Less than (< ) |
$gte | Greater than or equal to (>= ) |
$gt | Greater 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 },
},
});
user = "foo"
response = client.video.query_user_feedback(
filter_conditions = {
"user_id": user,
"rating": { "$lt": 3 },
},
)
import "github.com/GetStream/getstream-go"
user := "foo"
response, err := client.Video().QueryUserFeedback(context.Background(), &getstream.QueryUserFeedbackRequest{
FilterConditions: map[string]any{
"user_id": user,
"rating": map[string]any{
"$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 },
],
});
from getstream.models import SortParamRequest
response = client.video.query_user_feedback(
sort = [
SortParamRequest(field = 'created_at', direction = 1),
],
)
import "github.com/GetStream/getstream-go"
createdAtFieldName, ascendingOrder := "created_at", 1
response, err := client.Video().QueryUserFeedback(context.Background(),
&getstream.QueryUserFeedbackRequest{
Sort: []getstream.SortParamRequest{
{
Field: &createdAtFieldName,
Direction: &ascendingOrder,
},
},
})
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 });
response = client.video.query_user_feedback(limit = 5)
import "github.com/GetStream/getstream-go"
limit := 5
response, err := client.Video().QueryUserFeedback(context.Background(),
&getstream.QueryUserFeedbackRequest{ Limit: &limit })
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 });
response = client.video.query_user_feedback(full = True)
import "github.com/GetStream/getstream-go"
downloadCustomData := true
response, err := client.Video().QueryUserFeedback(context.Background(),
&getstream.QueryUserFeedbackRequest{ Full: &downloadCustomData })