Smartgroups

Retrieve all Smart Groups

GETpeople/smartgroups

A Smart Group is a filtered list of users that has been saved in People CRM. This endpoint retrieves a list of all the Smart Groups associated with a specific project. It also returns the filters that have been applied to each Smart Group.

Definition

GET https://api.gosquared.com/people/v1/smartgroups

Example Request

curl "https://api.gosquared.com/people/v1/smartgroups?api_key=demo&site_token=GSN-106863-S" 

Live Responseundefined undefined

Your API Key is not authorised for this endpoint

Please fill in the required fields in the Query Builder

Add a Smart Group

POSTpeople/smartgroups

Add a new Smart Group.

Filters

You can use filters to create the criteria for a smart group to add using the filters parameter,

Smart Groups can be built around events (see Event Types) or properties (see Property Types).

The filters parameter can be complex so we advise that you look at an existing Smart Group to begin with to see how your pre-existing Smart Groups filter results. Using the Query Builder on the right you can graphically build up a filters object using any combination of filters. You can then see the Example Request below with the generated json query.

For reference, when using filters key will be element you are filtering on, either a property or event. Path will be the specific property or event you are filtering on, for example for a property that could be 'email'. Operator will be the notation or criteria for that path, such as 'contains'. Value will be the specific value of that path you are filtering on.

For example, if wanted to build a Smart Group of any users with an email containing 'GoSquared', it would be as follows:

key: 'property'

path: 'email'

operator: 'contains'

value: 'GoSquared'

POST Body

name

StringRequired

filters

ArrayRequired

prefs

Object

sortField

String

sortDir

String

Accepted values: asc, desc

Definition

POST https://api.gosquared.com/people/v1/smartgroups

Example Request

curl -X POST -H "Content-Type: application/json" \
  "https://api.gosquared.com/people/v1/smartgroups?api_key=demo&site_token=GSN-106863-S" 

Live Responseundefined undefined

Your API Key is not authorised for this endpoint

Retrieve a Smart Group

GETpeople/smartgroups/{groupID}

Retrieves a single Smart Group by its groupID. The groupID is usually the lower-case name of the Smart Group. You can check the groupID by viewing the URL path that links you to the group in the People dashboard.

Path Parameters

groupID

StringRequired

The ID of the group

Definition

GET https://api.gosquared.com/people/v1/smartgroups/{groupID}

Example Request

curl "https://api.gosquared.com/people/v1/smartgroups/{groupID}?api_key=demo&site_token=GSN-106863-S" 

Live Responseundefined undefined

Your API Key is not authorised for this endpoint

Please fill in the required fields in the Query Builder

Retrieve a feed of events from everyone in a smart group

GETpeople/smartgroups/{groupID}/feed

Requests an export of all pageview activity of users in a smart group into a downloadable CSV.

The response contains a link to download the CSV. This link is active for 15 minutes, after which it will expire.

A maximum of 60 days' worth of data can be queried at a time. Longer time ranges can be broken down into multiple smaller requests.

Path Parameters

groupID

StringRequired

The ID of the group

Query String Parameters

from

String

The start date-time for the query

to

String

The end date-time for the query

Definition

GET https://api.gosquared.com/people/v1/smartgroups/{groupID}/feed

Example Request

curl "https://api.gosquared.com/people/v1/smartgroups/{groupID}/feed?api_key=demo&site_token=GSN-106863-S" 

Live Responseundefined undefined

Your API Key is not authorised for this endpoint

Please fill in the required fields in the Query Builder

Retrieve a list of people in Smart Group

GETpeople/smartgroups/{groupID}/people

Retrieves the list of people in a given Smart Group. This function is the equivalent of mapping the Smart Group's 'filters' property to the Search People method.

Using the query parameter you can search through this smartgroup

Path Parameters

groupID

StringRequired

The ID of the group

Query String Parameters

query

String

The query term you would you like to search for

fields

String

A comma delimited list of fields to be returned. (e.g. id,email). See Property Types for available options.

sort

StringDefault Value: last.seen:desc

Which property to sort by followed by :desc or :asc for direction. See Property Types for available options.

presenter

StringDefault Value: plain

Accepted values: plain, csv

Modifies the response data structure

limit

StringDefault Value: 0,10

The maximum number of results e.g. 10 to return with an optional offset e.g. 5,10. You can request a maximum of 250 results

dateFormat

String

The format that any date parameters will be returned in. This takes any value permitted by Moment.

Definition

GET https://api.gosquared.com/people/v1/smartgroups/{groupID}/people

Example Request

curl "https://api.gosquared.com/people/v1/smartgroups/{groupID}/people?api_key=demo&site_token=GSN-106863-S" 

Live Responseundefined undefined

Your API Key is not authorised for this endpoint

Please fill in the required fields in the Query Builder