File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/google_chat.cpython-310.pyc
Back
o ;j � @ s$ d Z ddlZdZdd� Zdd� ZdS )a Module for sending messages to google chat. .. versionadded:: 2019.2.0 To use this module you need to configure a webhook in the google chat room where you would like the message to be sent, see: https://developers.google.com/hangouts/chat/how-tos/webhooks � NZgoogle_chatc C s t S )N)�__virtualname__� r r �L/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/google_chat.py�__virtual__ s r c C sF ddi}d|i}t d | dt�|�|ddd�}|�dd �d kr!dS dS )z� Send a message to the google chat room specified in the webhook url. .. code-block:: bash salt '*' google_chat.send_message "https://chat.googleapis.com/v1/spaces/example_space/messages?key=example_key" "This is a test message" zContent-Typezapplication/json�textz http.query�POSTT)�dataZheader_dict�decode�statusr r �� F)Z __utils__�json�dumps�get)�url�message�headersr �resultr r r �send_message"