Go to file
sergey 878373b19b add net service alert 2024-10-09 19:28:02 +03:00
auth refactoring swagger login 2024-10-08 22:32:14 +03:00
config add net service alert 2024-10-09 19:28:02 +03:00
docker add tg message send 2024-10-09 14:26:34 +03:00
redis_db add tg message send 2024-10-09 14:26:34 +03:00
routers add net service alert 2024-10-09 19:28:02 +03:00
schemas add net service alert 2024-10-09 19:28:02 +03:00
telegram add net service alert 2024-10-09 19:28:02 +03:00
web/static/swagger add swagger and refactor 2024-10-08 14:26:04 +03:00
.gitignore refactoring redis and redis manager 2024-10-09 00:14:07 +03:00
LICENSE Initial commit 2024-10-07 18:33:43 +00:00
README.md update readme 2024-10-09 18:15:32 +03:00
main.py add ping and refactor 2024-10-09 11:28:57 +03:00
osnova-api-alert.service add net service alert 2024-10-09 19:28:02 +03:00
poetry.lock add tg message send 2024-10-09 14:26:34 +03:00
pyproject.toml add tg message send 2024-10-09 14:26:34 +03:00
requirements.txt regular expression in config 2024-10-09 17:21:19 +03:00

README.md

osnova-api-alert

swagger - https://osnova-api-alert.sm8255082.ru/docs

endpoints:

  • https://osnova-api-alert.sm8255082.ru/ping (get, post) без авторизации, без параметров
  • https://osnova-api-alert.sm8255082.ru/api/v1/tg/send (post) в заголовке должен быть токен 'x-api-key: токен' должны предаваться в data problem_id:int, message:str js для заббикса:
    function sendMessage(value) {
    var params = JSON.parse(value),
    data,
    response,
    request = new HttpRequest(),
    url = 'https://osnova-api-alert.sm8255082.ru/api/v1/tg/send';
    request.addHeader('Content-Type: application/json');
    request.addHeader('x-api-key: nz7cA1NKOwxwtiTZdbBDtLwopt2tOm7W');
    data = JSON.stringify(params);
    response = request.post(url, data);
    
    if (request.getStatus() === 200) {
        return 'OK';
    }
    else {
        if (typeof response.description === 'string') {
            throw response.description;
        }
        else {
            throw 'Unknown error. Check debug log for more information.';
        }
    }
    }
    
    
    try {
        Zabbix.log(4, value)
        sendMessage(value);
        return 'OK';
    }
    catch (error) {
        throw 'Unknown error ' + error;
    }
    
    


You can try to get the message_thread_id from the message link

    - send a message to the topic you need from the application
    - right click on the sent message and choose "Copy message link"
    - paste link somewhere
    - you will see something like this: https://t.me/c/1112223334/25/33
    - the value 25(value after long number) from the link will be message_thread_id

I assume that -100 + 1112223334 - will be equal chat_id

The number after will be message_thread_id

And the last one should be message_id