Knowledge & tools

LeanPBX CRM tool

The LeanPBX CRM tool gives an agent full read/write access to your LeanPBX CRM — contacts, companies, deals, tasks, notes, and reference data — behind a single action the agent picks per call. One configuration holds an API key.

Automatic caller awareness. On live voice/chat sessions this tool knows who's calling. When the agent omits them, create_contact.phone and list_contacts.search default to the caller's number (so "look me up" just works), and create_note.call_uniqueid defaults to the conversation id (notes auto-link to the call). An explicitly supplied value always wins. No configuration required — it's automatic.

Connect your CRM

The single credential is a LeanPBX API key (a Bearer token) with CRM read/write access. Generate one in your LeanPBX workspace's API settings and paste it into the API Key field. It's stored encrypted and never shown again; on edit, leave it blank to keep the stored key. One key = one CRM workspace.

Capabilities

The agent picks one action per call, grouped by entity:

Contacts

  • list_contacts — search/list (filters: search, type, limit, page).
  • get_contact / update_contact / delete_contact — by id.
  • create_contact — needs first_name, phone.
  • list_contact_notes / _tasks / _deals / _calls / _sms — a contact's sub-records (by id).
  • attach_tags (id, tag_ids array) / detach_tag (id, tag_id).

Companies

  • list_companies / get_company / create_company (needs name) / update_company / delete_company (by id).
  • list_company_contacts / list_company_deals — sub-records (by id).

Deals

  • list_deals — filters: status, pipeline_id, stage_id, assigned_to, contact_id, company_id
  • get_deal / update_deal / delete_deal — by id.
  • create_deal — needs name, pipeline_id, stage_id.
  • list_deal_notes / list_deal_tasks — sub-records (by id).

Tasks

  • list_tasks (filters), get_task / update_task / delete_task (by id), create_task (needs title).

Notes

  • list_notes (filters contact_id / deal_id), get_note / update_note / delete_note (by id), create_note (needs contact_id, content).

Lookups (reference data)

  • list_pipelines / get_pipeline (by id), list_tags / create_tag (needs name) / delete_tag (by id), list_dispositions.
Deals need a pipeline_id + stage_id — the agent should call list_pipelines first (stages are returned inline) to get valid ids. Notes need a contact_id — call list_contacts first. Disposition ids come from list_dispositions.

Field reference

  • Contact typelead / prospect / customer / vendor (default customer).
  • Deal statusopen / won / lost (won/lost auto-stamp the close date).
  • Task statuspending / in_progress / completed / cancelled (completed auto-stamps completion time).
  • Task prioritylow / medium / high (default medium).
  • Tag colorgray / primary / success / warning / danger / info (default gray).
  • Formats — dates YYYY-MM-DD; due_time is HH:MM (24-hour); country is ISO-2; currency is ISO-4217.

Common recipes

  • Look up the callerlist_contacts with no search (it defaults to the caller's number on a live call).
  • Log a call notecreate_note with the contact and content; call_uniqueid auto-links to the call.
  • Create a follow-up taskcreate_task with a title (add due_date / priority as needed).
  • Open a deal in a pipelinelist_pipelines to get a pipeline_id + stage_id, then create_deal.

Errors & troubleshooting

  • 401 / 403 — invalid or under-privileged API key → re-enter the key on the config card.
  • 409 (duplicate) — on create_contact / create_company; the record already exists.
  • 422 (validation) — e.g. invalid phone, or a bad pipeline/stage/contact id; the field message says what's wrong.
  • 404 — bad id on a get/update/delete.
  • Misconfigured — a missing API key is caught before any network call.

Classification & lifecycle

This is a read and write tool, and it can delete records (delete_*). If you run it on an autonomous bot, consider its safety classification — marking it destructive makes the platform's destructive-action gate apply (requiring "Allow destructive actions in autonomous runs" on the bot). It's post-call-hook eligible (runs outside the LLM turn), so it can power post-call automations like logging a note or creating a follow-up task.

Migration: this replaces the five api.leanpbx_* API-Call presets, which remain available (not retired) — bots using them keep working. New configurations should use this dedicated tool.