Before you start
- Generate an API key. Visit workspace settings to create an API key.
- Configure agents and workflows in the app. Visit agent settings to add and configure agents, and visit workflow settings to add and configure workflows.
https://api-v2.getomni.ai. Use your workspace API key to authenticate
with the x-api-key header.
1. Create a lead
If you already create leads through the API or a CRM sync, you can reuse existing leads and skip to step 2. To create a lead through the API:POST /api/v1/leads
2. Identify your agents and workflows
Agents and workflows can be configured within the Monumint app. Once they are set up, you can retrieve ids that identify each workflow and agent. To retrieve the agents configured in your workspace:GET /api/v1/agents
GET /api/v1/workflows
type that defines what work actually gets performed:
3. Create the workflow run
Up until this point, we’ve configured agents and workflows, and we’ve created leads in Monumint, but no work is actually being performed. To tell an agent to start conducting a workflow on a particular lead, we need to create a workflow run:POST /api/v1/workflow-runs
workflowRun.id for use with the additional endpoints and webhooks described below.
4. Subscribe to events
Monumint dispatches webhook events so that you can stay informed of activity tied to a workflow run. You can register to receive workflow run events with Create Webhook:POST /api/v1/webhooks
Each event carries the workflow run under
workflowRun — the same object the
endpoints above return — alongside the workspace, the lead, and your own
externalLeadId:
Event payload
5. Create another workflow run
An agent generally conducts one workflow at a time on a given lead. But once that workflow finishes, you can tell the agent to perform another job on that lead by calling the workflow run creation endpoint again, usually with a different workflow id:POST /api/v1/workflow-runs
409 Agent is already linked to this lead. Wait for the agent to
finish, or cancel the current workflow run first.
6. Manage the workflow run
Once a workflow run exists, you may wish to control it through various operations. Each is aPOST with no body, and returns the workflow run in its new state.
Each of these acts on a single workflow run rather than on the agent or the lead. Cancelling
one frees the agent to take on its next job for that lead.
7. Monitor workflow runs
In addition to staying apprised of workflow run activity using the events described above, you can also use the following endpoints to check the current state of workflow runs. To read one workflow run:GET /api/v1/workflow-runs/{workflowRunId}
GET /api/v1/workflow-runs?leadId={leadId}
8. Wrapping up with a lead
In the lifespan of a lead, you may ask your agents to perform multiple workflows. A lead can remain active in your system even if no work is actively being conducted on it. For leads that you consider fully complete, you can mark the lead as completed to wrap up their entire record:PUT /api/v1/leads
9. Putting it all together
The script below wires the whole guide together: it creates a lead, looks up the agent and workflow to use, subscribes to the events, puts the agent to work, and reads the result back. It usesjq to pull ids out of each response.
