Query members

Members have the most powerful querying capabilities of any entity in crowd.dev. On top of being able to filter and order by the standard member fields, you can also filter by any custom attribute you might have created.

Fields and types for filtering and sorting

The following table shows all the possible fields for which members can be filtered and sorted. The filter type defines which type-specific operators can be used. All fields can be used with general operators and composition.

Sortable fields can always be sent as {fieldName}_{ASC | DESC}

FieldFilter typeExampleSortable
displayNameString{"username": {"textContains": "Gilfoyle"}}✔️
usernameJSON{"username": {"jsonContains": "gilfoyle"}}
identitiesArray{"identities": {"overlaps": ["github", "discord"]}}
platformJSON{"platform": {"jsonContains": "github"}}
emailString{"email": {"textContains": "@crowd.dev"}}✔️
scoreNumber{"score": {"gte": 7}}✔️
reachNumber{"reach": {"gt": 42}}✔️
reach.[platform]String{"reach.twitter": {"gte": 100}}
averageSentimentNumber{"averageSentiment": {"lt": 50}}✔️
activityCountNumber{"activityCount": {"gt": 42}}✔️
activityTypeString{"activityType": "message"}
activityChannelString{"activityChannel": "dev"}
activeOnArray{"activeOn": {"contains": ["twitter", "github"]}}
joinedAtDate{"joinedAt": {"gte": "2022-01-01"}}✔️
lastActiveDate{"lastActive": {"lte": "2022-09-29"}}✔️
tagsMany-to-Many{"notes: ["9cf6b6b1-2d25-4695-a91e-f79586af853a"]}
notesMany-to-Many{"notes: ["390c4788-c2ee-47d9-bff6-97822d87512e"]}
tasksMany-to-Many{"tasks: ["94924f9e-b23e-463f-984e-f75a34f021aa"]}
createdAtDate{"createdAt": {"gte": "2022-01-01"}}✔️

Filtering on custom attributes

📘

Creation of custom attributes

This section assumes that the custom attributes have already been defined. Otherwise, please refer to the defining custom attributes section.

For members, filtering is also supported on custom attributes. The type of the custom attribute defines which type-specific operators can be used. If you want to filter by the default value (not platform-specific), you can just send the attribute name directly. For example, imagine we want to filter by attribute location:

{
    "filter": {
        "location": "Barcelona"
    }
}

This will return any member that has their default location attribute set to exactly Barcelona.

If, on the other hand, we wanted to filter by the attribute location on the platform GitHub only, we could send

{
    "filter": {
        "attributes.location.github": "Barcelona"
    }
}

Examples

Get all members that are active, unhappy and have a reasonably high reach:

  • at least 10 activities, and
  • average sentiment is unhappy (below 50), and
  • reach is at least 100
    Sorted by average sentiment.
{
    "filter": {
        "activityCount": {
            "gte": 10
        },
        "averageSentiment": {
            "lt": 50
        },
        "range": {
            "gte": 100
        }
    },
    "orderBy": "averageSentiment_ASC",
    "limit": 10,
    "offset": 0
}

Get all members that have been interviewed, and in a specific location or with a specific tag

  • the custom attribute goneThroughUserIntereview is set to true, and
  • either:
    • location is in Berlin or Barcelona, or
    • they contain the tag Digital nomad (imagine it has ID 9cf6b6b1-2d25-4695-a91e-f79586af853a)
{
    "filter": {
        "goneThroughUserIntereview": true,
        "or": [
            {
                "location": {
                    "in": [
                        "Berlin",
                        "Barcelona"
                    ]
                }
            },
            {
                "tags": [
                    "9cf6b6b1-2d25-4695-a91e-f79586af853a"
                ]
            }
        ]
    },
    "orderBy": "joinedAt_DESC",
    "limit": 10,
    "offset": 0
}

Get all Twitter users with high Twitter reach that are very happy

  • platform contains twitter, and
  • Twitter's reach is at least 500, and
  • the sentiment is at least 70
{
    "filter": {
        "platform": {
            "jsonContains": "twitter"
        },
        "reach.twitter": {
            "gte": 500
        },
        "averageSentiment": {
            "gte": 70
        }
    },
    "orderBy": "joinedAt_DESC",
    "limit": 10,
    "offset": 0
}