[APP][Pro] Telegram Bot v2.0.0

I am working on the Telegram Bot app, to make it ready for the new Homey and up2date on Homey SDK3.

There are some changes that might be ‘breaking’:

The Homey speech output functionality will be removed (thus, command ‘/say’ will no longer work)

There will be no longer a ‘shared’ bot (the @athomhomey_bot Telegram bot). The app will require you to set up your own custom bot, which was optional before.
People using the shared bot can already set up a custom bot in the current app to prevent breaking the app in your setup. Please do so, delete your connected users afterwards and re-register them.
This is a more secure way, everybody has their own Telegram Bot of which the credentials are saved on your Homey, which means nobody can abuse the bot.

The new version will be released in the coming days.

3 Likes

Hi Jordan, since the last update, the following code doen not work anymore.
What has changed for this to not work.
Great app by the way, use a lot for logging.

async function sendMessage(message) {
let appId = “org.telegram.api.bot”;
let telegram = await Homey.apps.getApp({ id: appId });
let settings = await Homey.apps.getAppSettings({ id: appId });
let chatId = settings.chat_ids[0].chat_id;
return await telegram.apiGet(“/send_message/”, { to: chatId, text: message });
}

sorry for the misspelled name Jorden.

i use this javascript code in homeyscript

Can you try with /send_message instead of /send_message/ (last slash removed)?

If that doesn’t work, I will dive into it.

tried it, does not work.

Hi @Jorden !

I’ve just got my new Pro (early 23) and testing your app with the latest version. I experience that snapshot/image sending does not work, while it works on the previous (early 19) Pro.

Hi Jordan: Is it possible to send self-destructive messages using the app? If not, consider this a feature request :wink:

I heard this twice. Sadly cannot test this yet as I have yet to order a Homey pro. I will try and see if I can setup a logging function for the images soon. However, since I’m very busy, this might take a while :frowning:

It is not possible currently. Also don’t know if Telegram supports that? Can’t seem to find anything in the documentation: Telegram Bot API

Ofcourse it would be possible to send it and delete it after a few seconds. However I don’t think thats a good idea, I don’t know if I can see if the message is read etc.

I think you should be the judge on whether secret chats featuring self-destructive messages, can be implemented in a bot (End-to-End Encryption, Secret Chats)

If it is, then the next question pops up:
Is it possible for a bot running over a secret chat to make the messages self-destructive on a per-message basis, and if not, it might be useful to create multiple (two) bots, one secret and one with messages to self-destruct, and one with “normal” messages.

Maybe this is possible by creating devices on a per-chatbot bases, although I realize this would take serious effort in refactoring code…

This might also be useful in a use case where one bot is for logging, and the other one for “real” interaction with Homey, which addresses your next remark:

Hi @Roco72 .

Have you looked at the ‘Other’ Telegram app?

It contains flow steps to remove specific messages:

Images do seem to work on my 2019, but for some reason images that I send with the “image grabber” app won’t work. This used to work in the previous version, with no changes made to the flows etc.

If i add another card to this flow with push notification the image is being sent through push notification, so the issue seems to be in the Telegram Bot app. If you need any more information, please let me know.

UPDATE:
I use the flow below, when I pick another image from the list it does work, so the problem is only with the image from “this flow”.

Hi @Chris_nl.

Have you tried the ‘other’ Telegram app, that works perfectly with images:

1 Like

Nope, but this app works fine and has always worked with this option too, so probably just a small bug somewhere. (and if i’m correct the image grabber app is from the same developer as this Telegram Bot app, so i hope for a fast solution.

@Twan_Veugelers, why is the other app better in your opinion?

Just look at the options it provides.

1 Like

not work app for me. If I reinstall how can set my private bot?

In the settings you can follow the steps to setup a private bot.

Hi Jordan,
I have an issue with the names the app presents when using the Send Message Flow Card.
I did a /register xxxx both from my personal Telegram account as from a Telegram group. In both cases I got the confirmation that Homey was successfully connected.
However when I now use the Send Message Flow Chard, it presents me 2 accounts to choose from, but both have exactly the sane name: my name. I’ve tested choosing both entries and it sends correctly to me or the group. The ONLY issue is the names that are presented: it doesn’t show me the group name, so I don’t know which entry to select.
Please advise (Homey 2019 PRO, App v1.0.1)
Greetings,
Rene

image

I am not sure if I can see from the API call, if it is a group or a one-person-chat. If there is no way, I can only give back the chat ID as stated on the settings page. This would require an update.

I am very short on free time to experiment with seeing how the group / single person chat is coming in…