Download integrations/n8n/README.md from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 3.47 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/integrations/n8n/README.md
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/integrations/n8n/README.md
-
curl -L -o README.md https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/integrations/n8n/README.md
Patchwise β Telegram (n8n)
patchwise-telegram.json is an n8n workflow that receives Patchwise's notifications and posts them to a Telegram chat. Each message has an Open in Patchwise button. Nothing is approved from the chat: the button opens the screen where you confirm.
Patchwise ββ signed POST βββΆ n8n webhook βββΆ check signature βββΆ Telegram message
What Patchwise sends
Patchwise sends a POST with a JSON body:
{
"id": 42,
"kind": "run.waiting_approval",
"title": "79 scenarios are ready for your approval",
"body": "Procure-to-Pay test run on Local mock pod",
"coworker": "Test generator",
"run_id": "...",
"link": "https://your-patchwise/runs/...",
"created_at": "..."
}
It also sends these headers:
| Header | Content |
|---|---|
X-Patchwise-Event |
The kind of event |
X-Patchwise-Delivery |
The event id |
X-Patchwise-Signature |
sha256=<HMAC-SHA256 of the raw body with FPT_NOTIFY_SECRET> |
Kinds:
| Kind | Meaning |
|---|---|
run.waiting_approval |
Scenarios are waiting for your approval |
run.waiting_decision |
A failure is waiting for your decision |
run.finished |
A test run finished |
run.failed |
A test run failed |
run.stopped |
A test run was stopped |
defect.created |
A defect was confirmed |
test |
The test message from Settings |
Set up
Create a Telegram bot and find your chat id.
- In Telegram, talk to @BotFather, send
/newbotand copy the token. - Send your bot one message, then open
https://api.telegram.org/bot<TOKEN>/getUpdates. The number atchat.idis your chat id. - Group chats have negative ids.
- In Telegram, talk to @BotFather, send
Import the workflow.
- In n8n, choose Workflows β Import from file and pick
patchwise-telegram.json. - Open Send to Telegram, create a Telegram credential with the bot token and select it.
- In n8n, choose Workflows β Import from file and pick
Give the workflow the secret and the chat id. Use either option:
- Environment: set
PATCHWISE_SECRETandTELEGRAM_CHAT_IDon the n8n server. - In the workflow: paste them into
SECRET_FALLBACKandCHAT_ID_FALLBACKat the top of Check signature and write message.
Use the in-workflow option when the n8n server blocks environment access in nodes (
N8N_BLOCK_ENV_ACCESS_IN_NODE=true), as the Patchwise n8n Space does.- Environment: set
Allow the crypto module. The signature check uses Node's built-in
crypto, so setNODE_FUNCTION_ALLOW_BUILTIN=cryptoon the n8n server.Activate the workflow and copy its Production URL. It ends in
/webhook/patchwise-events.Point Patchwise at the workflow. On the Patchwise server, set these and restart:
FPT_NOTIFY_WEBHOOK_URL: the Production URL.FPT_NOTIFY_SECRET: the same secret as in step 3.
The n8n host must also be allowed by Patchwise's outbound-traffic list.
Test it. In Patchwise, open Settings β Notifications and press Send a test message.
Notes
- Invalid messages: a message with a missing or wrong signature is dropped without a reply.
- The secret: use a long random value, for example
python -c "import secrets; print(secrets.token_hex(32))", and keep it out of code and chats. - Adding more channels: add nodes after Check signature and write message, for example Slack, Teams or e-mail. Patchwise itself does not change.