Basics
Notion Users
Accessing existing Notion users within a connected workspace is possible with the following functions.
Query all Users
Use the all()
function to retrieve all users. A maximum of 100 users can be fetched this way.
Notion::users()
->all()
->asCollection(); // or `asJson()`
Find one User
Use the find()
method to query a specific user.
$user = Notion::users()->find($userId);
Retreive User Data
You can access user data by prepared get methods. For any additional information, please use the raw structure.
$userId = $user->getId();
$userName = $user->getName();
$userAvatarUrl = $user->getAvatarUrl();
Raw Data Structure
This is an example of the Notion users raw structure. Please check Handling Results on how to retrieve raw data in detail.
{
"object": "user",
"id": "d40e767c-d7af-4b18-a86d-55c61f1e39a4",
"type": "person",
"person": {
"email": "avo@example.org"
},
"name": "Avocado Lovelace",
"avatar_url": "https://secure.notion-static.com/e6a352a8-8381-44d0-a1dc-9ed80e62b53d.jpg"
}
Source: Example from Notion API Docs ( Retrieve a user )