githubEdit

Telegram notifications

Bitcart makes use of the Apprisearrow-up-right API to deliver notifications to Telegram.

To integrate Telegram with Bitcart, you by-and-large follow the procedure outlined in the Setup Guidearrow-up-right. However, there are few recommendations and gotchas.

Multiple recipients

You can deliver the notifications to multiple telegram users by providing multiple chat ids, separated by spaces.

Markdown templates

Due to a bugarrow-up-right, if you select markdown as the template format, you should leave the markdown version field blank, or set it to 1. Contrary to the apprise documentation, specifying 2 or v2 here will result in messages not being delivered.

Telegram only supports a subset of markdown. It pays to read the Telegram docsarrow-up-right to see what's supported.

If there are any mistakes, the message gets rendered as text (at best), or (usually) apprise rejects the notification with a "bad parse" error. This is true of user input too. If promo code is FREE_STUFF, the underscore is interpreted as the start of italics and will break all the formatting.

For this reason, you must escape all input in your templates, especially user-provided input like email addresses, notes, and shipping addresses. Bitcart provides a ready filter for markdown v1, e.g. {{ invoice.buyer_email|tg_escape }}.

But if you're doing anything but the simplest of reports, it's highly recommended to just switch HTML templates over Markdown.

HTML templates

For more complicated notifications, prefer HTML templates. Again, Telegram has limited support for HTML, but the Jinja templating engine has better support for escaping HTML entities.

See the HTML notification template example for a working example.

Last updated

Was this helpful?