This repository contains sources for a related medium.com article with more details. It explains how to create and manage alertmanager.
There are scripts, NodeJS code and yaml files in this repository. Before running this, your should read the article and inspect the sources.