To your questions,
1. Alerts are stored automatically,
2. The right way to query alert history is on the Thing which fired the alert. In this case it is somewhat similar to querying value streams -- you do it in the entity context. In your subscription the thing name is in the "source" parameter, so you'd do something like this:
// Parameters depend on the type of alert you need, see Help for details
let allAlerts = Things[source].QueryAlertHistory({
oldestFirst: undefined /* BOOLEAN */,
maxItems: undefined /* NUMBER {"defaultValue":500} */,
endDate: undefined /* DATETIME */,
query: undefined /* QUERY */,
startDate: undefined /* DATETIME */
});
Having said that, there's usually a better solution than querying alerts history in an alert subscription, which can be very inefficient, especially if your alerts fire frequently. We might be able to suggest you something better if you describe your use case in more detail.
/ Constantine