This workflow follows the Postgres → Telegram recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "\u041f\u043e\u0434\u0440\u044f\u0434 PRO / Material order events",
"meta": {
"description": "Webhook receiver for {type: 'material_order.created'} events from the bot. Notifies the owner (Telegram) and writes a marker into public.events for audit. Trigger URL is the same N8N_WEBHOOK_URL the bots use; events are dispatched by `type`."
},
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "lead-events",
"options": {}
},
"name": "Webhook (lead/material events)",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1.1,
"position": [
200,
320
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$headers['x-n8n-secret']}}",
"operation": "equals",
"value2": "={{$env.N8N_INBOUND_SECRET}}"
}
]
}
},
"name": "IF auth secret matches",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
440,
320
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json.body.type}}",
"operation": "equals",
"value2": "material_order.created"
}
]
}
},
"name": "IF type = material_order.created",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
680,
220
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "ownerText",
"value": "\ud83e\uddf1 <b>\u041d\u043e\u0432\u0430\u044f \u0437\u0430\u044f\u0432\u043a\u0430 \u043d\u0430 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b</b>\n\u041a\u043b\u0438\u0435\u043d\u0442: {{$json.body.customerType === 'b2b' ? '\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f' : '\u0447\u0430\u0441\u0442\u043d\u0438\u043a'}} ({{$json.body.region}})\n\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b: {{$json.body.materialKind}} {{$json.body.gradeCode}}\n\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e: {{$json.body.quantity}} {{$json.body.unit}}\n\u0414\u043e\u0441\u0442\u0430\u0432\u043a\u0430: {{$json.body.deliveryAddress || '\u2014'}}\n\u0414\u0430\u0442\u0430: {{$json.body.when || '\u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0430'}}\n\u0414\u043e\u043f: {{ ($json.body.extras && $json.body.extras.pump) ? '\u043d\u0430\u0441\u043e\u0441 \u2713 ' : '' }}{{ ($json.body.extras && $json.body.extras.manipulator) ? '\u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0442\u043e\u0440 \u2713 ' : '' }}{{ ($json.body.extras && $json.body.extras.deliveryOnly) ? '\u0440\u0430\u0437\u0433\u0440\u0443\u0437\u043a\u0430 \u0441 \u0431\u043e\u0440\u0442\u0430 \u2713' : '' }}\n\u041a\u0430\u043d\u0430\u043b: {{$json.body.channel}}\nID: {{$json.body.orderId}}"
}
]
}
},
"name": "Set (owner text)",
"type": "n8n-nodes-base.set",
"typeVersion": 3,
"position": [
900,
160
]
},
{
"parameters": {
"chatId": "={{$env.TELEGRAM_OWNER_CHAT_ID}}",
"text": "={{$json.ownerText}}",
"additionalFields": {
"parse_mode": "HTML"
}
},
"name": "Telegram (owner)",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.1,
"position": [
1140,
160
],
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "INSERT INTO public.events (type, contact_id, channel, payload)\nVALUES ('material_order.notified', $1::uuid, $2::messenger_channel, $3::jsonb)\nON CONFLICT DO NOTHING;",
"additionalFields": {
"queryParams": "={{$json.body.contactId}},{{$json.body.channel}},{{JSON.stringify($json.body)}}"
}
},
"name": "Postgres (audit)",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.4,
"position": [
1140,
280
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={\n \"ok\": true,\n \"type\": $json.body.type,\n \"orderId\": $json.body.orderId\n}"
},
"name": "Respond 200",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
1380,
220
]
},
{
"parameters": {
"respondWith": "json",
"responseCode": 403,
"responseBody": "={\"ok\": false, \"error\": \"forbidden\"}"
},
"name": "Respond 403",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
680,
480
]
}
],
"connections": {
"Webhook (lead/material events)": {
"main": [
[
{
"node": "IF auth secret matches",
"type": "main",
"index": 0
}
]
]
},
"IF auth secret matches": {
"main": [
[
{
"node": "IF type = material_order.created",
"type": "main",
"index": 0
}
],
[
{
"node": "Respond 403",
"type": "main",
"index": 0
}
]
]
},
"IF type = material_order.created": {
"main": [
[
{
"node": "Set (owner text)",
"type": "main",
"index": 0
}
],
[
{
"node": "Respond 200",
"type": "main",
"index": 0
}
]
]
},
"Set (owner text)": {
"main": [
[
{
"node": "Telegram (owner)",
"type": "main",
"index": 0
}
]
]
},
"Telegram (owner)": {
"main": [
[
{
"node": "Postgres (audit)",
"type": "main",
"index": 0
}
]
]
},
"Postgres (audit)": {
"main": [
[
{
"node": "Respond 200",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"active": false,
"version": 1
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
postgrestelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Подряд PRO / Material order events. Uses telegram, postgres. Webhook trigger; 8 nodes.
Source: https://github.com/alexdmitrievi/Podryad_PRO/blob/main/n8n/workflows/09-material-order-events.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Admin Handler. Uses telegram, postgres. Webhook trigger; 50 nodes.
Settings. Uses httpRequest, postgres, telegram. Webhook trigger; 38 nodes.
This n8n workflow automates task creation and scheduled reminders for users via a Telegram bot, ensuring timely notifications across multiple channels like email and Slack. It streamlines task managem
Teams that need a manager approval step before a ticket or request can change status. Great for internal ops, IT requests, or any workflow where “a human must sign off.” 📨 Manager receives approval/re