KosmoKrator

field-service

ServiceM8 Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the ServiceM8 KosmoKrator integration.

7 functions 6 read 1 write Manual OAuth token auth

Lua Namespace

Agents call this integration through app.integrations.service_m8.*. Use lua_read_doc("integrations.service_m8") inside KosmoKrator to discover the same reference at runtime.

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

ServiceM8 Integration

Tools

servicem8_list_jobs

List jobs from ServiceM8.

  • Parameters: status (string, optional), limit (integer, optional), offset (integer, optional)
  • Returns: Array of job objects with UUID, status, client, dates, and description.

servicem8_get_job

Get a specific job by UUID.

  • Parameters: uuid (string, required)
  • Returns: Full job details.

servicem8_list_clients

List clients from ServiceM8.

  • Parameters: limit (integer, optional), offset (integer, optional)
  • Returns: Array of client objects.

servicem8_get_client

Get a specific client by UUID.

  • Parameters: uuid (string, required)
  • Returns: Full client details.

servicem8_create_job

Create a new job in ServiceM8.

  • Parameters: client_id (string, required), template_id (string, optional), description (string, optional)
  • Returns: The created job object.

servicem8_list_activities

List activity records from ServiceM8.

  • Parameters: job_uuid (string, optional), limit (integer, optional), offset (integer, optional)
  • Returns: Array of activity objects.

servicem8_get_current_user

Get the currently authenticated ServiceM8 user.

  • Parameters: (none)
  • Returns: User profile object.
Raw agent markdown
# ServiceM8 Integration

## Tools

### servicem8_list_jobs
List jobs from ServiceM8.
- **Parameters:** `status` (string, optional), `limit` (integer, optional), `offset` (integer, optional)
- **Returns:** Array of job objects with UUID, status, client, dates, and description.

### servicem8_get_job
Get a specific job by UUID.
- **Parameters:** `uuid` (string, required)
- **Returns:** Full job details.

### servicem8_list_clients
List clients from ServiceM8.
- **Parameters:** `limit` (integer, optional), `offset` (integer, optional)
- **Returns:** Array of client objects.

### servicem8_get_client
Get a specific client by UUID.
- **Parameters:** `uuid` (string, required)
- **Returns:** Full client details.

### servicem8_create_job
Create a new job in ServiceM8.
- **Parameters:** `client_id` (string, required), `template_id` (string, optional), `description` (string, optional)
- **Returns:** The created job object.

### servicem8_list_activities
List activity records from ServiceM8.
- **Parameters:** `job_uuid` (string, optional), `limit` (integer, optional), `offset` (integer, optional)
- **Returns:** Array of activity objects.

### servicem8_get_current_user
Get the currently authenticated ServiceM8 user.
- **Parameters:** (none)
- **Returns:** User profile object.

Metadata-Derived Lua Example

local result = app.integrations.service_m8.servicem8_list_jobs({
  status = "example_status",
  limit = 1,
  offset = 1
})
print(result)

Functions

servicem8_list_jobs

List jobs from ServiceM8. Returns job details including status, client, dates, and descriptions. Supports filtering by status and pagination.

Operation
Read read
Full name
service_m8.servicem8_list_jobs
ParameterTypeRequiredDescription
status string no Filter by job status (e.g. "open", "in_progress", "completed", "cancelled").
limit integer no Maximum number of jobs to return per page.
offset integer no Number of records to skip for pagination.

servicem8_get_job

Get detailed information about a specific ServiceM8 job by its UUID. Returns full job details including status, client, description, dates, and assigned staff.

Operation
Read read
Full name
service_m8.servicem8_get_job
ParameterTypeRequiredDescription
uuid string yes The UUID of the job to retrieve.

servicem8_list_clients

List clients from ServiceM8. Returns client details including name, email, phone, and address. Supports pagination.

Operation
Read read
Full name
service_m8.servicem8_list_clients
ParameterTypeRequiredDescription
limit integer no Maximum number of clients to return per page.
offset integer no Number of records to skip for pagination.

servicem8_get_client

Get detailed information about a specific ServiceM8 client by their UUID. Returns client details including name, email, phone, billing address, and notes.

Operation
Read read
Full name
service_m8.servicem8_get_client
ParameterTypeRequiredDescription
uuid string yes The UUID of the client to retrieve.

servicem8_create_job

Create a new job in ServiceM8. Requires a client UUID. Optionally specify a job template and description to pre-populate the job.

Operation
Write write
Full name
service_m8.servicem8_create_job
ParameterTypeRequiredDescription
client_id string yes The UUID of the client to assign the job to.
template_id string no The UUID of a job template to apply.
description string no A description for the new job.

servicem8_list_activities

List activity records from ServiceM8. Returns a timeline of events such as job status changes, comments, and notes. Supports filtering by job and pagination.

Operation
Read read
Full name
service_m8.servicem8_list_activities
ParameterTypeRequiredDescription
job_uuid string no Filter activities to a specific job by its UUID.
limit integer no Maximum number of activities to return per page.
offset integer no Number of records to skip for pagination.

servicem8_get_current_user

Get the profile of the currently authenticated ServiceM8 user. Returns name, email, role, and account details.

Operation
Read read
Full name
service_m8.servicem8_get_current_user
ParameterTypeRequiredDescription
No parameters.