| name | cohere-webhooks-events |
| description | Implement Cohere streaming event handling, SSE patterns, and connector webhooks.
Use when building streaming UIs, handling chat/tool events,
or registering Cohere connectors for RAG.
Trigger with phrases like "cohere streaming", "cohere events",
"cohere SSE", "cohere connectors", "cohere webhook".
|
| allowed-tools | Read, Write, Edit, Bash(curl:*) |
| version | 1.5.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","ai","nlp","cohere"] |
| compatibility | Designed for Claude Code |
Cohere Streaming Events & Connectors
Overview
Handle Cohere's streaming chat events (SSE), tool-call events, citation events, and register data connectors for RAG. Cohere does not use traditional webhooks — its event model is streaming-based.
Prerequisites
cohere-ai SDK v7+
- Understanding of Server-Sent Events (SSE)
- For connectors: HTTPS endpoint accessible from internet
Instructions
Step 1: Chat Streaming Events
Cohere's chatStream returns a stream of typed events:
import { CohereClientV2 } from 'cohere-ai';
const cohere = new CohereClientV2();
async function handleStream(userMessage: string) {
const stream = await cohere.chatStream({
model: 'command-a-03-2025',
messages: [{ role: 'user', content: userMessage }],
});
for await (const event of stream) {
switch (event.type) {
case 'content-start':
console.log('--- Generation started ---');
break;
case 'content-delta':
const text = event.delta?.?.?. ?? ;
process..(text);
;
:
.();
;
:
.(, event.?.?.);
;
:
.(, event.?.?.?.?.);
;
:
;
:
.();
;
:
.(, event.);
;
:
.(, event.?.);
.(, event.?.);
;
}
}
}