People Set

Create, update and delete dynamic people sets on Workplace via Graph API.

Create a Dynamic People Set

POST /community/people_sets

Creates a new dynamic people set with the specified configuration.

Request Parameters

Fields passed in the request body as an object:

Field NameDescriptionData Type

name

Required. A name for the people set being created.

string

conditions

Required. A set of conditions to be used by the dynamic people set.

object array containing the following fields:

  • field (string): Required. One of the following: ACCOUNT_STATUS, DEPARTMENT, DIVISION, LOCATION, MANAGER, MANAGER_RECURSIVE, MEMBER_TYPE, ORGANIZATION, START_DATE, TITLE.
  • operator (string): Required. One of the following: CONTAINS, ENTITY_SET_IS, ENUM_SET_IS, GREATER_THAN, LESS_THAN, IS, IS_ANY_OF, STARTS_WITH.
  • values (string array): Required. Values for the operator.

Not all combinations of field & operator are supported, so it is best to consult with the People Sets UI in the Admin Panel on Workplace if you’re not sure whether a specific combination is supported or not.

Endpoint Response

    {
        "id": {id_of_people_set}
    }

Sample Request

POST
/community/people_sets?name=TSet2&conditions=[
  {
    "field": "TITLE",
    "operator": "CONTAINS",
    "values": [
      "Software"
    ]
  }
]

Get a Dynamic People Set By ID

GET /{people_set_id}

Retrieves the configuration of the dynamic people set by its id.

Request Parameters

  • people_set_id - path param - id of a people set

Endpoint Response

An object containing the following fields (later referred to as People Set Object):

Field NameDescriptionData Type

id

The id of the people set being retrieved.

fbid

name

The name of the people set being retrieved.

string

conditions

The set of conditions used by the people set being retrieved.

Array of objects containing the following fields:

  • field (string): Name of the field
  • operator (string): Condition operator
  • values (string array): Values for the operator

Sample Request

GET
/{people_set_id}?fields=name,conditions

Update a Dynamic People Set

POST /{people_set_id}

Update a people set using the specified configuration.

Request Parameters

Path parameters:

  • people_set_id (int): Required. The id of the people set to update.

Fields passed in the request body as an object should match the fields outlined in the request parameters for the create endpoint.

Endpoint Response

    {
        "success":"true"
    }

Sample Request

POST /{people_set_id}?name=TSet3&conditions=[
  {
    "field": "TITLE",
    "operator": "CONTAINS",
    "values": [
      "Software"
    ]
  },
  {
    "field": "LOCATION",
    "operator": "CONTAINS",
    "values": [
      "London"
    ]
  }
]

Delete a Dynamic People Set

DELETE /{people_set_id}

Delete the dynamic people set with the specified id

Request Parameters

Path parameters:

  • people_set_id (int): Required. The id of the people set to delete

Endpoint Response

    {
        "success":"true"
    }

Sample Request

DELETE /{people_set_id}

Get a People Set by Name

GET /community/people_sets?name={people_set_name}

Retrieves the configuration of the dynamic people set by its name.

Request Parameters

  • name - query string param - name of a people set

Endpoint Response

If there is a dynamic people set with an exact name match, it returns an object with the following field:

  • data - an array containing a People Set Object with a name matching the name parameter value.

Sample Request

GET /community/people_sets?name=TSet3

Get All Existing Dynamic People Sets

GET /community/people_sets

Endpoint to get all existing dynamic people sets.

Request Parameters

  • None

Endpoint Response

Returns an object with the following field:

Sample Request

GET /community/people_sets

Webhooks

People Set API supports sending updates via the people_sets webhook topic. See Webhooks for more information on subscribing to Workplace webhooks.

Webhook for Changes to Dynamic People Sets

When a people set is created, updated or deleted, a request is sent containing an object with the following fields:

  • object (string): “workplace_community”
    • entry: array of the objects with the following fields:
      • changes: array of the objects with the following fields:
        • field (string): “people_sets”
        • value: Object with the following fields:
          • people_set: People Set Object. If the People Set was deleted, this object will contain only the `id` field.
          • verb (string): One of {“add”, “update”, “delete”}. Denotes the action that happened