How do you learn to build Discourse plugins?

Is there any indication of what action is performed? When I try it, it POSTs JSON to a URL. The JSON contains information about the entity, but I don’t see how to determine information like whether the user has logged in or out. Maybe it could be done with an extra key in the JSON?

    {
        "user": { // the type of event
            // the main payload
        },
        "action": "login" // or logout, create, update, delete
    }

(Feel free to move this post if it would fit better somewhere else in the forum.)