Skip to content

Activity Types

MC0RE edited this page Mar 31, 2026 · 2 revisions

Activity Types

Read activity type definitions in Teamleader Focus.

Overview

The Activity Types resource provides read-only access to the activity type categories used on calendar events and meetings. Types are defined in Teamleader and cannot be created or modified through the API.

Access via Teamleader::activityTypes().

Endpoint

activityTypes

Capabilities

Capability Supported
Pagination βœ… Supported
Filtering βœ… Supported (ids only)
Sorting ❌ Not supported
Sideloading ❌ Not supported
Creation ❌ Not supported
Update ❌ Not supported
Deletion ❌ Not supported

Methods

list(array $filters = [], array $options = [])

use McoreServices\TeamleaderSDK\Facades\Teamleader;

$types = Teamleader::activityTypes()->list();

$types = Teamleader::activityTypes()->list([
    'ids' => ['type-uuid-1', 'type-uuid-2'],
]);

$types = Teamleader::activityTypes()->list([], [
    'page_size' => 50, 'page_number' => 1,
]);

info(string $id)

$type = Teamleader::activityTypes()->info('type-uuid');

Helper Methods

byIds(array $ids)

$types = Teamleader::activityTypes()->byIds(['type-uuid-1', 'type-uuid-2']);

all(array $options = [])

Calls list() with page_size: 100. For accounts with more than 100 activity types, this will not return everything β€” use paginated list() calls instead.

$types = Teamleader::activityTypes()->all();

exists(string $id)

Returns true if an activity type with that UUID exists. Calls byIds([$id]) internally.

$exists = Teamleader::activityTypes()->exists('type-uuid');

findByName(string $name)

Client-side β€” calls list() then searches in PHP (case-insensitive). Returns the matching type array or null.

$type = Teamleader::activityTypes()->findByName('Client Meeting');
// returns array or null

selectOptions(array $options = [])

Returns [['value' => uuid, 'label' => name], ...] β€” an array of objects (not a flat [id => name] map). Calls all() internally.

$options = Teamleader::activityTypes()->selectOptions();
// [['value' => 'uuid', 'label' => 'Client Meeting'], ...]

// For a plain [id => name] map
$map = array_column($options, 'label', 'value');

Filters

Filter Type Description
ids array Filter by activity type UUIDs

Response Structure

[
    'data' => [
        ['id' => 'type-uuid', 'name' => 'Client Meeting'],
        ['id' => 'type-uuid', 'name' => 'Internal Sync'],
        ['id' => 'type-uuid', 'name' => 'Training'],
    ],
    'meta' => ['page' => ['size' => 20, 'number' => 1], 'matches' => 8],
]

Usage Examples

Build a type selector for event creation

$types = Teamleader::activityTypes()->list();
$map   = array_column($types['data'], 'name', 'id');
// ['uuid-1' => 'Client Meeting', 'uuid-2' => 'Internal Sync', ...]

Find a type and use it on create

$type = Teamleader::activityTypes()->findByName('Client Meeting');

if ($type) {
    Teamleader::calenderEvents()->create([
        'title'            => 'Discovery call',
        'activity_type_id' => $type['id'],
        'starts_at'        => '2025-05-10T10:00:00+02:00',
        'ends_at'          => '2025-05-10T11:00:00+02:00',
    ]);
}

Cache activity types

$types = Cache::remember('tl_activity_types', 86400, function () {
    return Teamleader::activityTypes()->list();
});

Error Handling

use McoreServices\TeamleaderSDK\Exceptions\TeamleaderException;

try {
    $types = Teamleader::activityTypes()->list();
} catch (TeamleaderException $e) {
    Log::error('Teamleader error', ['message' => $e->getMessage()]);
}

Related Resources

  • Calendar Events β€” activity_type_id is required on event creation
  • Meetings β€” Activity type can be set on meetings via activity_type_id
  • Call Outcomes β€” Outcome definitions for calls (parallel concept)

Clone this wiki locally