Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

Telert is a lightweight utility for multi-channel notifications for alerting when terminal commands or Python code completes. It also extends this notification capability to easily monitor processes, log files, and HTTP endpoints uptime. The tool supports multiple notification channels:

- **Messaging Apps**: Telegram, Microsoft Teams, Slack, Discord
- **Messaging Apps**: Telegram, Microsoft Teams, Slack, Discord, XMPP
- **Email**: SMTP email notifications
- **Mobile Devices**: Pushover (Android & iOS)
- **Local Notifications**: Desktop notifications, Audio alerts
Expand Down Expand Up @@ -69,6 +69,7 @@ Use it as a CLI tool, Python library, or a notification API. Telert is available
- [Slack](#slack-setup)
- [Discord](#discord-setup)
- [Email](#email-setup)
- [XMPP](#xmpp-setup)
- [Pushover](#pushover-setup)
- [Custom HTTP Endpoints](#custom-http-endpoint-setup)
- [Audio Alerts](#audio-alerts-setup)
Expand Down Expand Up @@ -265,6 +266,34 @@ telert config email \

[**Detailed Email Setup Guide**](https://github.com/navig-me/telert/blob/main/docs/EMAIL.md)

### XMPP Setup

XMPP (Extensible Messaging and Presence Protocol) provides instant messaging to any XMPP-compatible service like Jabber, Prosody, ejabberd, or corporate XMPP servers.

```bash
# Basic configuration
telert config xmpp --jid "[email protected]" --password "your-password" --recipient-jid "[email protected]" --set-default
telert status # Test your configuration

# Configuration with custom server (if auto-discovery fails)
telert config xmpp \
--jid "[email protected]" \
--password "your-password" \
--recipient-jid "[email protected]" \
--server "xmpp.example.com" \
--port 5222 \
--set-default
```

**Requirements**: XMPP support requires the `slixmpp` library: `pip install slixmpp>=1.8.0`

**Configuration Parameters**:
- `--jid`: Your XMPP Jabber ID (username@domain)
- `--password`: Your XMPP account password
- `--recipient-jid`: Target Jabber ID to send messages to
- `--server`: XMPP server address (optional, auto-discovered from JID domain)
- `--port`: XMPP server port (default: 5222)

### Pushover Setup

Pushover provides mobile notifications to Android and iOS devices.
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ dependencies = [
"requests>=2.25",
"beautifulsoup4>=4.9.0",
"psutil>=5.9.0",
"ping3>=4.0.0"
"ping3>=4.0.0",
"slixmpp>=1.8.0"
]
keywords = [
"telegram",
Expand All @@ -22,6 +23,8 @@ keywords = [
"pushover",
"slack",
"discord",
"xmpp",
"jabber",
"microsoft-teams",
"desktop-notifications",
"monitoring",
Expand Down
73 changes: 73 additions & 0 deletions telert/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,30 @@ def do_config(a):
except ValueError as e:
sys.exit(f"❌ {str(e)}")

elif provider == "xmpp":
if not hasattr(a, "jid") or not hasattr(a, "password") or not hasattr(a, "recipient_jid"):
sys.exit("❌ XMPP configuration requires --jid, --password, and --recipient-jid")

config_params = {
"jid": a.jid,
"password": a.password,
"recipient_jid": a.recipient_jid,
"port": a.port,
"set_default": a.set_default,
"add_to_defaults": a.add_to_defaults,
}

if hasattr(a, "server") and a.server:
config_params["server"] = a.server

try:
configure_provider(Provider.XMPP, **config_params)
print(f"βœ” XMPP configuration saved for {a.jid} -> {a.recipient_jid}")
except ValueError as e:
sys.exit(f"❌ {str(e)}")
except ImportError as e:
sys.exit(f"❌ Failed to configure XMPP: {str(e)}")

else:
sys.exit(f"❌ Unknown provider: {provider}")
else:
Expand Down Expand Up @@ -526,6 +550,26 @@ def do_status(a):
to_str = ", ".join(to_addrs) if to_addrs else "unknown"
print(f"- Email{default_marker}: server={server}:{port} β†’ {to_str}")

# Check XMPP
xmpp_config = config.get_provider_config(Provider.XMPP)
if xmpp_config:
# Mark as default if in default providers list
if Provider.XMPP.value in default_provider_names:
# Show priority if multiple defaults
if len(default_provider_names) > 1:
priority = default_provider_names.index(Provider.XMPP.value) + 1
default_marker = f" (default #{priority})"
else:
default_marker = " (default)"
else:
default_marker = ""

jid = xmpp_config["jid"]
recipient_jid = xmpp_config["recipient_jid"]
server = xmpp_config.get("server", "auto")
port = xmpp_config.get("port", 5222)
print(f"- XMPP{default_marker}: {jid} β†’ {recipient_jid} (server: {server}:{port})")

# If none configured, show warning
if not (
telegram_config
Expand All @@ -537,6 +581,7 @@ def do_status(a):
or endpoint_config
or discord_config
or email_config
or xmpp_config
):
print("No providers configured. Use `telert config` or `telert init` to set up a provider.")
return
Expand Down Expand Up @@ -1674,6 +1719,34 @@ def main():
help="add to existing default providers",
)

# XMPP configuration subparser
xmpp_parser = config_sp.add_parser(
"xmpp", help="configure XMPP messaging"
)
xmpp_parser.add_argument(
"--jid", required=True, help="XMPP Jabber ID (username@domain)"
)
xmpp_parser.add_argument(
"--password", required=True, help="XMPP account password"
)
xmpp_parser.add_argument(
"--recipient-jid", required=True, help="recipient Jabber ID (username@domain)"
)
xmpp_parser.add_argument(
"--server", help="XMPP server address (optional, can be derived from JID)"
)
xmpp_parser.add_argument(
"--port", type=int, default=5222, help="XMPP server port (default: 5222)"
)
xmpp_parser.add_argument(
"--set-default", action="store_true", help="set as the only default provider"
)
xmpp_parser.add_argument(
"--add-to-defaults",
action="store_true",
help="add to existing default providers",
)

c.set_defaults(func=do_config)

# status
Expand Down
Loading