---
title: "Log Deal Message Route"
method: POST
path: "/api/pipeline/deals/{deal_id}/log-message"
tags: ["pipeline"]
---

# Log Deal Message Route

`POST /api/pipeline/deals/{deal_id}/log-message`

Log a completed activity as a message → async replan that records + replans.

Async sibling of the synchronous deal-agent chat. The operator logs what
they did (e.g. after a call); the shared `enqueue_log_activity_replan`
helper stamps a fresh `pipeline_run_token`, supersedes any pending replans
for this deal (newest wins), persists the note as an operator chat message
so it renders immediately, then enqueues a `pipeline_deal_replan` carrying
the logged activity as `user_context` so the agent records it on the
timeline, marks the completed step done, and surgically refreshes the plan.
The same helper backs the Every-agent `log_deal_activity` tool.

## Query parameters

- `user_id` string, nullable
- `org_id` string, nullable

## Request body

- LogMessageRequest — Body for /deals/{deal_id}/log-message. The operator logs a completed off-platform activity as free text (e.g. "Called Avery, she wants pricing by Friday"). The backend enqueues an async replan that records the activity on the timeline, optionally marks the named plan step done, and surgically refreshes the remaining plan. When triggered from a sales-plan row, `completed_plan_action_id` is that row's step id. `attachments` carries files/screenshots dropped or pasted into the composer (omitted/empty when none) — capped at 10, matching the chat composer's MAX_FILES. The replan agent reads each one via `read_deal_attachment`.
  - `text` string, required
  - `completed_plan_action_id` string, nullable
  - `attachments` LogMessageAttachment[], nullable
    - `storage_name` string, required
    - `original_name` string, required
    - `file_size` integer, required

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/every/apis/every-api.md) · [All operations](https://skmtc.net/every/apis/every-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/every/every-api/versions/f8600f7a4ae3/schema)
