SMSTunnel for Grafana
Alert texts from your own phone and number
Alerts that reach you by SMS
When an alert rule fires, or resolves, Grafana hands the alert to your SMSTunnel account and your own Android phone texts it to you from your own number. A text still gets through when e-mail or a push notification doesn't, and each one costs one SMS on your phone's plan.
1. Get your key
- 1. Install the SMSTunnel app from Google Play on your Android phone and sign in.
- 2. In your dashboard, open Apps → Add an app, pick Script or server, name it (for example "Grafana") and click Create the key.
- 3. Copy the key right away: it's shown only once. You can stop or delete the app there anytime, and Grafana can't send texts anymore.
Get the steps with your key in them
It opens Add an app with Script or server picked. Once the key is made, the dashboard shows every step and command with the key already filled in, ready to copy.
2. Add a webhook contact point
With a key, you need Grafana 12 or newer (on Grafana Cloud or an older Grafana, use a webhook address, which works on any version). Open Alerts & IRM → Alerting → Notification configuration → Contact points, click + Add contact point, give it a name (for example "SMS to me") and fill in:
- Integration
- Webhook
- URL
-
https://smstunnel.io/api/v1/sms/send - HTTP Method
- POST (under Optional Webhook settings)
- Extra Headers
-
X-API-Keywith your key as the value - Custom Payload
- Payload Template: the template below
{{ coll.Dict
"to" "+14155550123"
"message" (printf "%s %s" (tmpl.Exec "default.title" .) (index .Alerts 0).Annotations.summary)
| data.ToJSON }} -
Put your number after
"to", with+and the country code.coll.Dict … | data.ToJSONwrites the JSON for you, so quotes and colons in an alert can't break it. The text is Grafana's alert title and the first alert's summary. -
Leave the Authorization and Basic Authentication fields empty: SMSTunnel reads the key from
X-API-Keyonly. - Click Test: your phone texts a test alert to that number. Then click Save contact point.
3. Send alerts to it
- Pick the contact point in an alert rule (Configure notifications), or in Notification policies for a whole group of alerts.
- Several people? In the same contact point, add one more Webhook integration per number,
each with its own
"to". SMSTunnel sends one text to one number per request.
What the texts look like
[FIRING:1] DiskFull nas1 Disk 95% full: /volume1
[RESOLVED] DiskFull nas1 Disk 95% full: /volume1 The easy way, on any version: a webhook address
A webhook address is a secret URL that turns each call into a text to the numbers you save with it, sent by your own phone from your own number. The call only sets the words, never the number, so Grafana needs no key.
- 1. Install the SMSTunnel app from Google Play on your Android phone and sign in.
- 2. In your dashboard, open Apps → Webhooks, click New webhook and pick Grafana. That fills in the name. Leave Text of the message empty, so the words come from each call.
- 3. Add the numbers that should get the texts, with
+and the country code: up to 10, and each one gets its own text. Then click Create the webhook. - 4. Copy the address, which looks like
https://smstunnel.io/api/v1/webhook/<token>. Keep it secret, like a password: whoever has it can text these numbers from your phone, though never any other number.
Get the steps with your address in them
It opens New webhook with Grafana picked. Once the webhook is made, the dashboard shows its address and the Grafana steps with the address already in them, ready to copy, and Send a test, which texts the webhook's numbers.
- Calls an hour: 20 unless you set another number, up to 500. The limit counts calls, not texts: each call texts every number of the webhook, and a test from the dashboard counts too. Past the limit, calls are refused until the hour is over, so a storm of alerts can't use up your texts.
- You can copy the address again anytime, under Address and setup. If it gets out, New address in the webhook's menu replaces it, and the old one stops working at once.
- SMSTunnel reads Grafana's own alerts: their status, name and summary. Texts are cut at 480 characters.
-
Or with the API, for scripts:
POST /api/v1/webhookswith your sign-in token, as the webhooks guide shows.
Then, in Grafana
- 1. Open Alerting → Contact points (on Grafana 12 and newer: Alerts & IRM → Alerting → Notification configuration → Contact points) and click + Add contact point. Name it and pick Webhook as its Integration.
- 2. In URL, paste the webhook's address:
https://smstunnel.io/api/v1/webhook/<token> - 3. Leave the other fields as they are: no Extra Headers, no Custom Payload. SMSTunnel reads Grafana's own alerts. Click Test to get a text, then Save contact point and choose it in your alert rules or notification policies.
[FIRING] DiskFull - Disk 95% full: /volume1
[RESOLVED] DiskFull - Disk 95% full: /volume1 One text per alert group, to each number saved in the webhook, with "(+2 more)" when a group holds several alerts. Grafana's own settings decide when it calls: see the repeat interval below.
Worth knowing
- A firing alert texts again at every repeat interval (4 hours by default, in Notification policies), and once more when it resolves, unless you tick Disable resolved message. Group wait and group interval keep a burst of alerts to one text.
- Grafana doesn't mask Extra Headers. Anyone who can edit the contact point can read the key. Give Grafana its own app in SMSTunnel, so you can stop it without touching your other apps.
- 30 sends a minute and up to 1600 characters per text.
- Phone offline? The text waits and goes out as soon as the phone is back.
If it doesn't work
-
400"property version should not exist" (or receiver, alerts…): Grafana sent its default JSON to the API URL. Check that Custom Payload is filled in, on Grafana 12 or newer. -
401"Invalid or expired API key": the key is wrong or was deleted. "API key is required. Use X-API-Key header.": the key isn't in anX-API-Keyheader. SMSTunnel reads the key only from that header: Bearer or Basic authentication won't work. -
403withPERMISSION_REQUIRED: the key may not send texts. Make a new one under Apps → Add an app. -
400"property … should not exist": the body has a field SMSTunnel doesn't know. Send onlytoandmessage(and, if you need them,deviceIdanddefaultCountryCode). "message must be shorter than or equal to 1600 characters": shorten the text. "Phone number must contain…": put the number in international format, like+14155550123. -
400with "to must be a string" and "message must be a string": the body didn't arrive as JSON. Add the headerContent-Type: application/json. -
404"Cannot GET /api/v1/sms/send": the tool sent a GET. Choose POST. -
404"Webhook not found or disabled": the address is wrong, was replaced with New address, or the webhook is stopped or deleted. Copy it again from Apps → Webhooks → Address and setup. -
400"Could not build a message from the payload": the call had no words in it. Add?message=…to a GET, or amessagefield to the JSON. With a text of the message, check that the names between braces are the call's. -
429: too many texts at once. SMSTunnel takes 30 send requests a minute. Wait a minute and try again. -
429"Rate limit reached for this webhook (20/hour)": the webhook took all its calls for this hour. Wait, or raise Calls an hour (up to 500) with Edit in Apps → Webhooks. It counts calls, not texts: each call texts every number of the webhook. - In Apps → Webhooks, the webhook's row shows when it was last used and, if its last call sent no text, why.
- No text, but no error? If your phone is offline, the text waits and goes out as soon as the phone is back online. Open the SMSTunnel app on the phone to check it's linked.
Build it with an AI assistant
Copy this prompt into Claude, ChatGPT, Cursor or Copilot and replace the part in [brackets]. Don't paste your API key into the chat: the prompt doesn't need it.
Help me get Grafana alerts as text messages from my own phone, with SMSTunnel.
About SMSTunnel (https://smstunnel.io): my own apps and tools hand text messages (SMS) to my SMSTunnel account, and my own Android phone sends them from my own number, on my own SIM and plan. The phone runs the SMSTunnel app from Google Play (https://play.google.com/store/apps/details?id=io.smstunnel.app), signed in to my account.
What I want: [describe what should send a text, to whom, and when]
How it works:
- No plugin. The easy way, on any Grafana version and on Grafana Cloud: an SMSTunnel webhook address (made in my dashboard with Grafana picked) in a webhook contact point's URL, with no Extra Headers and the default payload. SMSTunnel reads Grafana's alert JSON and texts "[FIRING] <alertname> - <summary>" (and "(+N more)" for a group) to the numbers saved in the webhook.
- Without a key: an SMSTunnel webhook address, https://smstunnel.io/api/v1/webhook/<token>. I make it in my dashboard (https://dashboard.smstunnel.io): Apps → Webhooks → New webhook, pick the tool that will call it (Grafana, Uptime Kuma, Healthchecks, Gatus, Alertmanager, Odoo Online, or Something else), add 1 to 10 numbers (each gets its own text), optionally a text of the message that pulls fields out of the JSON with {{path}}, like {{alarm.name}}, then Create the webhook and copy the address. A GET with ?message=… or a POST with JSON (its message, text, title or body field) texts those numbers; the call never sets the number. Texts are cut at 480 characters. "Calls an hour" (20 unless I set another number, up to 500) counts calls, not texts: each call texts every number, and calls past it are refused until the hour is over. The address can be copied again under Address and setup; New address replaces it if it leaks. Scripts can make one with POST https://smstunnel.io/api/v1/webhooks and my sign-in token instead.
- Contact point: Alerting → Contact points (Grafana 12 and newer: Alerts & IRM → Alerting → Notification configuration → Contact points) → + Add contact point, Integration "Webhook". Test sends a test alert; then Save contact point and choose it in alert rules or notification policies.
- With an API key instead, on Grafana 12 or newer: URL https://smstunnel.io/api/v1/sms/send. Optional Webhook settings: HTTP Method POST; Extra Headers: X-API-Key = <my SMSTunnel key>.
- Custom Payload → Payload Template:
{{ coll.Dict
"to" "+14155550123"
"message" (printf "%s %s" (tmpl.Exec "default.title" .) (index .Alerts 0).Annotations.summary)
| data.ToJSON }}
coll.Dict | data.ToJSON builds valid JSON, so quotes and colons in the alert are safe. The number goes in "to", in international format. Grafana keeps the default Content-Type: application/json. Custom Payload is not generally available on Grafana Cloud yet.
- One recipient per request: SMSTunnel sends one text to one number. For several people, one request (or one notification) per number. With a key, a contact point can hold several Webhook integrations: one per number. A webhook address texts up to 10 numbers itself.
- Notification policies decide when texts go out: group wait, group interval and repeat interval (a firing alert texts again at every repeat interval, 4 hours by default). Resolved alerts text too unless "Disable resolved message" is on.
- Grafana shows Extra Headers in clear to anyone who can edit the contact point.
- Answers: 200 {"success": true, "messageId": "…"}; 401 wrong or deleted key; 403 the key lacks a permission ("code": "PERMISSION_REQUIRED"); 400 a missing, unknown or too long field; 429 too many requests (30 sends a minute, with Retry-After): wait and retry; without Retry-After, the plan's limit for the day or month is reached. If my phone is offline the text waits and goes out when it is back, within 3 days.
- The API key comes from my SMSTunnel dashboard (https://dashboard.smstunnel.io): Apps → Add an app → Create the key. It is shown only once and can send texts and check whether they went out.
Rules for your answer:
- Do not ask for my SMSTunnel password or API key and do not put a real key in your answer; I will not paste it in this chat.
- Phone numbers must be in international format (+ and the country code).
- Help me test it with my own number first.
- Only send texts people expect from me. No unsolicited texts.
- Help me keep texts short and avoid floods of texts (grouping, repeat interval, mute timings). Responsible use
Built for alerts to yourself and your team, and texts people expect from you. One text goes to one number. Sending unsolicited messages from a consumer SIM generally breaches mobile carrier terms of service.
Grafana is a trademark of Grafana Labs. SMSTunnel is a third-party integration and is not affiliated with, endorsed by, or sponsored by Grafana Labs.