Send tags as array in ntfy monitoring hook.

This commit is contained in:
Mashrafi Rahman
2026-02-01 15:47:13 +08:00
parent fd485e64a3
commit 6b5390f5dd
2 changed files with 9 additions and 3 deletions
+7 -1
View File
@@ -22,6 +22,12 @@ def initialize_monitor(
'''
def _convert_string_to_array(value):
value = str(value or '')
return [str(item).strip() for item in value.split(',') if str(item).strip()]
PRIORITY_NAME_TO_ID = {
'max': 5,
'urgent': 5,
@@ -66,7 +72,7 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev
'title': state_config.get('title'),
'message': state_config.get('message'),
'priority': PRIORITY_NAME_TO_ID.get(state_config.get('priority'), default_priority),
'tags': state_config.get('tags'),
'tags': _convert_string_to_array(state_config.get('tags')),
}
try:
+2 -2
View File
@@ -25,7 +25,7 @@ CUSTOM_MESSAGE_PAYLOAD = {
'title': CUSTOM_MESSAGE_CONFIG['title'],
'message': CUSTOM_MESSAGE_CONFIG['message'],
'priority': 1,
'tags': CUSTOM_MESSAGE_CONFIG['tags'],
'tags': [CUSTOM_MESSAGE_CONFIG['tags']],
}
@@ -35,7 +35,7 @@ def default_message_payload(state=Enum):
'title': f'A borgmatic {state.name} event happened',
'message': f'A borgmatic {state.name} event happened',
'priority': 3,
'tags': 'borgmatic',
'tags': ['borgmatic'],
}