Generic
Post any text or JSON from scripts, CI and cron jobs.
Send a message
POST to your endpoint with the secret in the X-Webhook-Signature header:
curl -X POST "https://thook.altr.dev/hooks/generic/{unique_path}" \
-H "X-Webhook-Signature: {your_secret}" \
-H "Content-Type: text/plain" \
--data-raw "Deploy finished ✅"
Accepted bodies
| Body | Content-Type | Result |
|---|---|---|
| Plain text | text/plain |
Sent as is |
| JSON string | application/json |
Sent as is |
{"text": "..."} |
application/json |
The text field is sent |
| Any other JSON | application/json |
Pretty printed in a code block |
# JSON with a text field
curl -X POST "https://thook.altr.dev/hooks/generic/{unique_path}" \
-H "X-Webhook-Signature: {your_secret}" \
-H "Content-Type: application/json" \
-d '{"text": "*Backup* completed in 42s"}'
Formatting
Messages use Telegram Markdown: *bold*, _italic_, `code` and [link](https://example.com). If Telegram cannot parse the text, for example because of a stray _, Thook sends it again as plain text instead of dropping it.
Limits
- A message can be at most 4096 characters; longer text is truncated.
- An empty body is rejected with
400. - Link previews are disabled.
Examples
GitHub Actions
- name: Notify Telegram
if: always()
run: |
curl -fsS -X POST "${{ secrets.THOOK_URL }}" \
-H "X-Webhook-Signature: ${{ secrets.THOOK_SECRET }}" \
-H "Content-Type: text/plain" \
--data-raw "${{ github.repository }}: ${{ job.status }}"
Node.js
await fetch(process.env.THOOK_URL, {
method: "POST",
headers: {
"X-Webhook-Signature": process.env.THOOK_SECRET,
"Content-Type": "application/json"
},
body: JSON.stringify({ text: "Job done" })
});
Travis CI
A ReactJS site is built and deployed on GitHub Pages, then the result is sent by a script that calls Thook: travis_to_thook.sh.
Troubleshooting
401: missing or wrongX-Webhook-Signature.400: the body is empty, check that--data-rawor-dis set.