Skip to content

v0.3.0

Latest

Choose a tag to compare

@kj4ezj kj4ezj released this 10 Oct 22:24
e897cbe

The purpose of this telegram-bot:v0.3.0 release is to deliver human-friendly notifications for "CloudWatch alarm state change" events not only to Telegram, but to all Amazon SNS subscribers such as email and SMS recipients or even other lambdas delivering IM notificaitons on other platforms. SNS subscribers are upstream of this lambda, so this necessitated splitting out the code from the previous release that parses the Message string into a separate lambda, aws-cloudwatch-alarm-handler. This release contains breaking changes and warrants a major version bump, but it is not a v1 because it is still missing test coverage.

Breaking Changes

  1. Notification formatting was outsourced to the aws-cloudwatch-alarm-handler lambda.
  2. The SNS Message string is now delivered to Telegram verbatim, no parsing is done.
  3. The lambda handler was changed from handler.entrypoint to index.handler to be consistent with AWS Lambda defaults.
    1. The main JavaScript file was renamed from handler.js to index.js.
    2. The entrypoint function was changed from entrypoint() to handler().
  4. Some environment variables have changed.
    1. TIMEZONE was removed, as this is only used for message formatting.
    2. DEV_EVENT_SOURCE_ARN was renamed to TEST_EVENT_SOURCE_ARN, and is now being fully parsed instead of the previous lazy matching.
  5. The return value schema has changed.

Other Changes

  1. User-defined string replacements can now be performed on the Telegram message contents and the log output.
  2. Very limited markdown interpolation is performed on the input string and is converted to HTML.

>> Full Diff <<

Architecture

The general idea is this:

CloudWatch => EventBridge => SNS topic 1 => CloudWatch formatting lambda (aws-cloudwatch-alarm-handler) => SNS topic 2 =>
Telegram notification lambda (telegram-bot), SMS, email

This simplifies a lot of the code, making this system both more flexible and more resilient.