skip to content
wihan.dev
view as markdown
browse the dokploy docs

dokploy_telegram_notification (Resource)

A Telegram notification channel (Settings > Notifications). Dokploy sends each message through a bot to a chat.

Each event attribute selects one Dokploy event that sends a message on this channel. All events default to false, so a new channel sends nothing until you enable one.

~> Dokploy does not test the channel on create or update. A wrong URL or token applies successfully and fails on the first message. Set verify_connection = true to test the channel before the write.

~> Dokploy stores and returns bot_token in cleartext. The attribute is sensitive, so Terraform does not print it, but anyone with API access to the server can read it. The bot_token_wo companion keeps it out of the Terraform state.

Example Usage

terraform
# Send server alerts to a Telegram group topic through a bot.
resource "dokploy_telegram_notification" "alerts" {
  name              = "alerts"
  chat_id           = "-1001234567890"
  message_thread_id = "42"

  # Write-only: Terraform 1.11 or later. Change the version to rotate the token.
  bot_token_wo         = var.telegram_bot_token
  bot_token_wo_version = 1

  server_threshold = true
  dokploy_restart  = true
}

Schema

Required

  • chat_id (String) Id of the chat or group that receives the message.
  • name (String) Display name. Dokploy does not enforce a unique name.

Optional

NOTE: Write-only arguments are supported in Terraform 1.11 and later.

  • app_build_error (Boolean) Send a message when a build fails. Defaults to false.
  • app_deploy (Boolean) Send a message when an application or a compose deploys. Defaults to false.
  • bot_token (String, Sensitive) Token of the bot, from BotFather. Set this attribute or bot_token_wo.
  • bot_token_wo (String, Sensitive, Write-only) Write-only form of bot_token. Terraform keeps it out of the plan and the state. It needs Terraform 1.11 or later. Set exactly one of bot_token and bot_token_wo. A new value reaches the server only when bot_token_wo_version changes.
  • bot_token_wo_version (Number) Version of bot_token_wo. Change it to send the current bot_token_wo value to the server. It needs bot_token_wo.
  • database_backup (Boolean) Send a message when a database backup runs. Defaults to false.
  • docker_cleanup (Boolean) Send a message when the Docker cleanup runs. Defaults to false.
  • dokploy_backup (Boolean) Send a message when the Dokploy server backup runs. Defaults to false.
  • dokploy_restart (Boolean) Send a message when Dokploy restarts. Defaults to false.
  • message_thread_id (String) Topic id inside a forum group. Omit it for a plain chat. If you remove it from the configuration, the provider clears it.
  • server_threshold (Boolean) Send a message when a server crosses a resource threshold. Defaults to false.
  • verify_connection (Boolean) Test the connection with notification.testTelegramConnection before the provider creates or updates the record. If the test fails, the apply fails with the server message, and the provider writes nothing. The default is no check: null and false both skip the test. Dokploy stores no value for this attribute, so terraform import leaves it null. The test sends a real test message to the channel. Dokploy v0.30.8 reports success for a wrong bot token or chat id, so a passed test does not prove the channel works.
  • volume_backup (Boolean) Send a message when a volume backup runs. Defaults to false.

Read-Only

  • created_at (String) Creation timestamp from the server.
  • id (String) Notification id.

Import

Import is supported using the following syntax:

In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:

terraform
import {
  to = dokploy_telegram_notification.alerts
  id = "INt_PYqh9apo8mmDIoixZ"
}

The terraform import command can be used, for example:

shell
terraform import dokploy_telegram_notification.alerts INt_PYqh9apo8mmDIoixZ