import json


def send(connection, request):
    """ Encodes request and sends it to the GAB action listener.

    :param connection: connection: a connection to the GAB action listener
    :param request: a dictionary containing the action request payload
    :return: GAB action listener's (SUCCESS or ERROR) reply
    """
    encoded_request = json.dumps(request)
    connection.send_string(encoded_request)
    return connection.recv_json()