def extract_relevant (msg):
    """ Extracts relevant (to the app) headers & info from a GMail message """
    headers_to_extract = set (["subject", "from", "message-id"])
    headers = msg["payload"]["headers"]
    
    data = dict ()
    data ["id"] = msg ["id"]
    data ["thread_id"] = msg ["threadId"]
    for header in headers:
        name = header["name"].lower()
        if name in headers_to_extract:
            data [name] = header ["value"]
    return data