How to get alarm in my html custom widget

Actually the Web Developer Series is exactly what you are looking for:

It is starting with basic setup of web development tooling (Part 1) and ends with building a widget and deploying it to cumulocity.

In part 3 it was explained how to use the c8yclient to retrieve data and visualize it.
So everything is there.