def notify_matrix()

in mozci/util/taskcluster.py [0:0]


def notify_matrix(body, room):
    """
    Send a message on the provided Matrix room
    using Taskcluster notify service
    """
    if not room:
        logger.warning("No Matrix room available in configuration")
        return

    formatted_body = markdown2.markdown(body)

    notify_service = taskcluster.Notify(get_taskcluster_options())
    try:
        notify_service.matrix(
            {
                "roomId": room,
                "body": body,
                "format": "org.matrix.custom.html",
                "formattedBody": formatted_body,
                "msgtype": "m.text",
            }
        )
    except Exception as e:
        logger.error(f"Failed to send the report on the Matrix room {room}: {e}")
        raise