Request
// Send a cash-flow update as blocks
const response = await fetch('https://api.todo.work/api_integrations/chat/send_message', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': 'YOUR_API_KEY',
'X-API-SECRET': 'YOUR_API_SECRET'
},
body: JSON.stringify({
conversation_id: 5,
content: 'Cash-flow update: balance 2,998 ₪, forecast low -30,070 ₪ on 09/10, collect at least 50,070 ₪.',
blocks: [
{ type: 'header', text: 'Cash-flow update, next 30 days' },
{ type: 'text', text: 'One decision is needed **before 09/10**.' },
{ type: 'facts', items: [
{ label: 'Balance', value: '2,998 ₪' },
{ label: 'Forecast low', value: '-30,070 ₪', tone: 'danger' },
{ label: 'To collect', value: '50,070 ₪', tone: 'success' }
]},
{ type: 'table',
columns: [{ label: 'Date', kind: 'date' }, { label: 'Movement' }, { label: 'Amount', kind: 'number' }],
rows: [
['10/09/2026', 'Payme Ltd', '+33,988 ₪'],
['15/09/2026', 'Diners 7704', '-25,207 ₪'],
['09/10/2026', 'Payroll 09/2026 (4 people)', '-67,798 ₪']
],
footer: '3 movements in the forecast' },
{ type: 'chart', kind: 'line', title: 'Balance', unit: '₪',
points: [{ x: '09/09', y: 2998 }, { x: '10/09', y: 36986 }, { x: '15/09', y: 11779 }, { x: '09/10', y: -56019 }],
markers: [{ y: 20000, label: 'Alert floor' }] },
{ type: 'callout', tone: 'danger', title: 'Forecast low', text: '-30,070 ₪ on 09/10/2026, below the 20,000 ₪ floor.' },
{ type: 'context', text: 'Source: checking account, as of 09/09/2026.' },
{ type: 'actions', items: [
{ label: 'Open full report', kind: 'url', url: 'https://app.todo.work/reports' },
{ label: 'Ask Sara', kind: 'reply', value: 'What should I collect first?' }
]}
]
})
});
const data = await response.json();
console.log(data.response);
Response
{
"response": {
"status": true,
"message": {
"id": 902,
"message_type": "blocks",
"content": "Cash-flow update: balance 2,998 ₪, ...",
"widget_data": { "blocks": [ { "type": "header", "text": "Cash-flow update, next 30 days" }, "..." ] }
}
}
}
// Validation failure (HTTP 200, status false):
{ "response": { "status": false, "error": "blocks: block #3 (table): rows is required" } }