forked from GithubBackups/healthchecks
Configurable bot name and updated README. Fixes #115
This commit is contained in:
parent
df1af66980
commit
5cb372d18f
20
README.md
20
README.md
@ -230,3 +230,23 @@ To enable Pushover integration, you will need to:
|
||||
subscription type
|
||||
* add the application token and subscription URL to `hc/local_settings.py`, as
|
||||
`PUSHOVER_API_TOKEN` and `PUSHOVER_SUBSCRIPTION_URL`
|
||||
|
||||
### Telegram
|
||||
|
||||
* Create a Telegram bot by talking to the
|
||||
[BotFather](https://core.telegram.org/bots#6-botfather). Set the bot's name,
|
||||
description, user picture, and add a "/start" command.
|
||||
* After creating the bot you will have the bot's name and token. Add them
|
||||
to your `hc/local_settings.py` file as `TELEGRAM_BOT_NAME` and
|
||||
`TELEGRAM_TOKEN` fields.
|
||||
* Now the tricky part: when a Telegram user talks to your bot,
|
||||
Telegram will use a webhook to forward received messages to your healthchecks
|
||||
instance. For this to work, your healthchecks instance needs to be publicly
|
||||
accessible over HTTPS. Using the
|
||||
[setWebhook](https://core.telegram.org/bots/api#setwebhook) API call
|
||||
set the bot's webhook to `https://yourdomain.com/integrations/telegram/bot/`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@ class AddTelegramTestCase(BaseTestCase):
|
||||
def test_instructions_work(self):
|
||||
self.client.login(username="alice@example.org", password="password")
|
||||
r = self.client.get(self.url)
|
||||
self.assertContains(r, "start@HealthchecksBot")
|
||||
self.assertContains(r, "start@ExampleBot")
|
||||
|
||||
def test_it_shows_confirmation(self):
|
||||
payload = signing.dumps((123, "group", "My Group"))
|
||||
|
@ -804,7 +804,8 @@ def add_telegram(request):
|
||||
ctx = {
|
||||
"chat_id": chat_id,
|
||||
"chat_type": chat_type,
|
||||
"chat_name": chat_name
|
||||
"chat_name": chat_name,
|
||||
"bot_name": settings.TELEGRAM_BOT_NAME
|
||||
}
|
||||
|
||||
return render(request, "integrations/add_telegram.html", ctx)
|
||||
|
@ -154,6 +154,7 @@ PUSHBULLET_CLIENT_ID = None
|
||||
PUSHBULLET_CLIENT_SECRET = None
|
||||
|
||||
# Telegram integration -- override in local_settings.py
|
||||
TELEGRAM_BOT_NAME = "ExampleBot"
|
||||
TELEGRAM_TOKEN = None
|
||||
|
||||
if os.path.exists(os.path.join(BASE_DIR, "hc/local_settings.py")):
|
||||
|
@ -42,13 +42,13 @@
|
||||
<span class="step-no">1</span>
|
||||
<p>
|
||||
From your Telegram client, invite
|
||||
<strong>HealthchecksBot</strong> to a group. It will get added
|
||||
<strong>{{ bot_name }}</strong> to a group. It will get added
|
||||
as a member with no access to group messages.
|
||||
</p>
|
||||
<p>
|
||||
Alternatively, if you want notifications sent to yourself
|
||||
directly, start a conversation with
|
||||
<strong>HealthchecksBot</strong>.
|
||||
<strong>{{ bot_name }}</strong>.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
@ -63,7 +63,7 @@
|
||||
<span class="step-no">2</span>
|
||||
<p>Type <strong><code>/start</code></strong> command.
|
||||
If there are multiple bots in the group, type
|
||||
<strong><code>/start@HealthchecksBot</code></strong> instead.
|
||||
<strong><code>/start@{{ bot_name }}</code></strong> instead.
|
||||
</p>
|
||||
<p>The bot will respond with a confirmation link.</p>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user