To send Google Antigravity alerts to Telegram, Slack or Discord, create a bot or an incoming webhook in that app, then add a Stop hook to ~/.gemini/config/hooks.json that posts a short message with curl when a turn ends. Telegram needs a bot token and your chat ID; Slack and Discord need only a webhook URL. The Stop payload doesn't include Antigravity's last message, so the script reads it from the conversation's transcript file. There's no trust step: the hook runs from your next agy session. The script below works on Mac and Linux, and a short PowerShell version covers Windows.
01Get a token or webhook
Telegram
- In Telegram, message @BotFather, send
/newbotand follow the steps. It gives you a bot token like123456:ABC.... - Send any message to your new bot.
- Open
https://api.telegram.org/bot<TOKEN>/getUpdatesin a browser and find"chat":{"id":...}. That number is your chat ID.
Slack
- Create a Slack app for your workspace, turn on Incoming Webhooks, and add a webhook to a channel. A private channel or a direct message to yourself works well.
- Copy the webhook URL (
https://hooks.slack.com/services/...).
Discord
- In a server you control, open the channel's settings, then Integrations, Webhooks, New Webhook.
- Copy the webhook URL (
https://discord.com/api/webhooks/...).
Treat all of these like passwords. Anyone with the URL or token can post to your channel.
02What the Stop hook receives
Antigravity sends each hook a JSON object on stdin, with camelCase names. A Stop looks like this (shortened):
{
"hookEventName": "Stop",
"cwd": "/Users/you/projects/demo",
"conversationId": "32fc0aec-…",
"transcriptPath": "/Users/you/.gemini/antigravity-cli/brain/32fc0aec-…/.system_generated/logs/transcript_full.jsonl",
"lastUserInput": "Run the tests and fix what fails",
"terminationReason": "NO_TOOL_CALL",
"executionNum": 0,
"fullyIdle": true
}
There's no field with the final reply. It's in the transcript: the last line whose type is PLANNER_RESPONSE and that has a content.
03One script for all three
Save as ~/.gemini/agy-chat-notify.sh, fill in the service you use, and run chmod +x on it:
#!/bin/sh
# Posts "Antigravity has finished" to Telegram, Slack or Discord.
SERVICE="slack" # telegram | slack | discord
TELEGRAM_TOKEN="" TELEGRAM_CHAT="" # for telegram
WEBHOOK_URL="" # for slack or discord
text=$(python3 -c '
import json, os, sys
try:
e = json.load(sys.stdin)
except Exception:
sys.exit(0)
if e.get("hookEventName") != "Stop":
sys.exit(0)
project = os.path.basename(e.get("cwd", "")) or "Antigravity"
msg = ""
try:
with open(e.get("transcriptPath", "")) as f:
for line in f:
try:
step = json.loads(line)
except ValueError:
continue
if step.get("type") == "PLANNER_RESPONSE" and (step.get("content") or "").strip():
msg = step["content"].strip()
except OSError:
pass
msg = (msg or "Turn complete")[:300]
print(f"Antigravity finished in {project}: {msg}")
')
if [ -n "$text" ]; then
json=$(printf '%s' "$text" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')
case "$SERVICE" in
telegram) curl -s -o /dev/null --max-time 10 \
--data-urlencode "chat_id=$TELEGRAM_CHAT" --data-urlencode "text=$text" \
"https://api.telegram.org/bot$TELEGRAM_TOKEN/sendMessage" ;;
slack) curl -s -o /dev/null --max-time 10 -H 'Content-Type: application/json' \
-d "{\"text\": $json}" "$WEBHOOK_URL" ;;
discord) curl -s -o /dev/null --max-time 10 -H 'Content-Type: application/json' \
-d "{\"content\": $json}" "$WEBHOOK_URL" ;;
esac
fi
echo '{}'
exit 0
The echo '{}' at the end tells Antigravity the hook has nothing to say, so the turn ends as normal. Don't print anything else: a Stop hook that answers {"decision":"continue","reason":...} starts a new turn.
04Add it to hooks.json
The top-level keys of ~/.gemini/config/hooks.json are named groups, and every group runs. Add one for the script, using its full path:
{
"chat-notify": {
"Stop": [
{ "type": "command", "command": "/Users/you/.gemini/agy-chat-notify.sh", "timeout": 20 }
]
}
}
If the file already has groups (for example one written by another tool), add "chat-notify" beside them rather than replacing the file, and check it's still valid JSON. Then start a new agy session. To use the hook in one project only, put the same group in that project's .agents/hooks.json instead.
05Windows
The same idea in PowerShell, with Slack shown (use @{ content = $text } for Discord). We haven't tested agy on Windows, so check the hook fires before you rely on it. Save as %USERPROFILE%\.gemini\agy-chat-notify.ps1:
$webhook = "https://hooks.slack.com/services/..."
$e = [Console]::In.ReadToEnd() | ConvertFrom-Json
if ($e.hookEventName -eq "Stop") {
$project = Split-Path -Leaf $e.cwd
$msg = "Turn complete"
if (Test-Path $e.transcriptPath) {
foreach ($line in Get-Content $e.transcriptPath) {
try { $step = $line | ConvertFrom-Json } catch { continue }
if ($step.type -eq "PLANNER_RESPONSE" -and $step.content) { $msg = $step.content.Trim() }
}
}
if ($msg.Length -gt 300) { $msg = $msg.Substring(0, 300) }
$body = @{ text = "Antigravity finished in ${project}: $msg" } | ConvertTo-Json
try { Invoke-RestMethod -Method Post -Uri $webhook -ContentType 'application/json' -Body $body -TimeoutSec 10 | Out-Null } catch {}
}
Write-Output '{}'
Use "command": "powershell -NoProfile -ExecutionPolicy Bypass -File C:\\Users\\you\\.gemini\\agy-chat-notify.ps1" in the group.
06What about "Antigravity wants to run a command"?
Antigravity has no notification or permission event. The only place a hook sees a command is PreToolUse, which fires before every tool call, including the ones Auto mode runs without asking. Two things make it a poor fit for chat alerts:
- It's fail-closed. A
PreToolUsehook that prints no decision, exits with an error or times out blocks the tool. A chat alert there must print{"decision":"allow"}every time, even when the post fails. - It can't tell whether Antigravity will ask. You'd get a message for every command, not just the ones waiting for you.
If you still want it, filter on toolCall.name being run_command, post toolCall.args.CommandLine, keep curl --max-time short, and always end with {"decision":"allow"}. The PreToolUse guide explains the decisions.
07Mind what you post
The message includes the project name and Antigravity's last reply, which can quote code, paths or errors. In a shared Slack or Discord channel everyone sees that. Use a private channel or a direct message, and shorten the message if your work is sensitive.
08One-way only
A chat message tells you Antigravity is done; it can't carry your answer back into the session. For that, Google's Remote Control works from your phone's browser, and Antigravity Notifier is a two-way option for the agy command line: a free antigravity-notifier tool for Mac, Windows and Linux plus an iPhone or Android app where you approve or deny commands, answer questions and send the next instruction. It's independent and not affiliated with Google. Approving commands from your phone explains how that works.
09FAQ
Which of the three is quickest to set up?
Slack and Discord: one webhook URL and you're done. Telegram needs a bot and a chat ID, but its mobile notifications are reliable.
Why does nothing arrive?
Start a new agy session first, because hooks load when a session starts. Then run the script by hand with a fake event: echo '{"hookEventName":"Stop","cwd":"/tmp/demo"}' | ~/.gemini/agy-chat-notify.sh. It should print {} and post "Turn complete". Remove -s -o /dev/null from the curl line while testing to see the service's reply, and check hooks.json is valid JSON.
Will I get a message after every turn?
Yes, one per Stop. If you send a follow-up and Antigravity works again, that turn gets its own message when it ends.
Can I send alerts to a team channel?
Yes, but think about what the messages reveal. File paths, code and errors from your projects will be visible to everyone in the channel.