[APP][Pro] Telegram

Hi @spkesDE

Great work until now, really love the app.
How can I buy you a coffee? (or beer?!)

Next suggestion, Probably most users will have some kind of Logic value in their message. Better Logic now has been rebranded to Better Logic Library, where its functionality can be incorporated into any app, maybe this is something for Telegram Notifications as well.

Better Logic Library
BLL for Developers

1 Like

@Twan_Veugelers Iā€™ll take a look into the BLL :slight_smile: Still waiting on athom. My old/broken homey arrive at homey tomorrow.

Edit: Currently I donā€™t find a use case for it. Maybe if BLL is more mature maybe there will be a use case.

Indeed BLL is just beginning :wink:

Iā€™ll be adding the custom functions, like in DC, HOOP and Watchman, into BLL this week and hope to also finish the ā€˜numberā€™ function/class.

But just know, if you incorporate the decoder, which is just a few simple steps, the custom functions and number-method will be automaticly included when BLL is updated on a local Homey. There is no need to update anything on the apps that have BLL encoding included.

if I change from app.bot.telegram.sendMessage(args.user.id, args.message) to app.bot.telegram.sendMessage(args.user.id, bl.decode(args.message)) it would support all of your custom tags e.g. Send message "Hello, today is {[date("dddd")]}

(Ofc it needs to be checked if there is a bc instance etcā€¦ but thats it?)

Also do you plan to support typescript definitions?

Indeed yeah!

Dont forget the await before the bl.decode (itā€™s an async method).

And you need the setup steps:

  • Add the permission to your app.json
    "permissions": ["homey:app:net.i-dev.betterlogic"]
  • Import the BL module in the app.js:.
    const { BL } = require('../../lib/bll/bl');
  • Initialize the BLL in the app.js onInit:
    let bl = await new BL({homey:this.homey, silent:true]});
  • Create a file /lib/bll/bll-loader.js and place the next code into it:

Source

But beside those few steps, yeah itā€™s just a matter of running it through the await bl.decode.
It will be run through the AppApi on the BLL app, so you donā€™t need to include anything.

If you would ever need the DateTime to convert a lott of dates to show in a app settings or something like that, the Datetime module is a beter use, because it runs within your own app and only syncā€™s the BLL app settings.

But for the BLL decoding in text-arguments, its just a simple inlude into your app and than the simple bl.decode :slight_smile: .

TypeScript definitions.
I am not very knowegable about that, but im not sure if you really mean TypeScripts or JSDoc info?

The BL.js i post on the topic is in Javascript and i am not (yet/currently) thinking about chaning that to TypeScript (because i donā€™t have the expirience yet).

But i am already working (and have a big part ready) on the jsdoc file, so you will get ā€œintellisenseā€.
Is that what you ment?

Or is it really about the BL.js needs to be in TypeScript (definitions)?

Addition:
You can combine TS and Javascript in the same app right?
If you have a TS App, you could still include, reference and use the BL.js, right?

(I am not a native TS or Javascript expert, so no idea yet. I ofc. will be looking into TS when i have some more time and a spare Homey to start rewriting apps, but thatā€™s gonna take some time).

Oh itā€™s used to provide typescript type information about an API thatā€™s written in JavaScript.
Check it out here. Then you can include the d.ts files into your npm package.

If I donā€™t have these typescript definitions Iā€™ll have to tell the compiler to ignore the lines, what is quite annoying.

1 Like

Hmmm. Stuck.
My goal is to setup Siri on iOS Shortcuts to send a message to my Homey connected bot.
So I build a URL and finish the message through speech.
It seemed easier to send messages through URL from a bot than sending from my own username, so I made a new botā€¦
Both bots were present in the group when I sent /start.

But since messages from the ā€œhelper_botā€ show up in the group chat, but isnā€™t received by homey, even after sending /start from the helper_bot, I guess also bots has to ā€œpress the button belowā€?

Any idea how to help me? Or do you know how to send a message from my own account through URL? :sweat_smile:

So you have 1 Group with 2 bots + yourself?
And you want to read the messages from the other bot Inside the group?
Then you have to change to bot privacy mode.

'Enable' - your bot will only receive messages that either start with the '/' symbol or mention the bot by username.
'Disable' - your bot will receive all messages that people send to groups.

Send to the @botfather bot /setprivacy and put the homey bot to DISABLED
Then your Homey Telegram bot can read messages inside the group

Correct.

If we call them Bot#1 and Bot#2. Bot#1 is connected to Homey. I set /setprivacy = disabled. Still not working. Which makes sense? If I send ā€œtestā€ (no ā€œ/ā€) from my own account, Homey detects it. If I do the same from Bot#2, it doesnā€™t.

Okay, I did some research. Telegram doesnā€™t allow to read botā€™s to read other bots messages.


So you have to change your system that the messages are sent from your account.

Bah. Bummer. Since you seem to be well versed in Telegram.
Do you mind helping me build a URL to send a message from myself?
Iā€™ve tried reading TDLib and sendMessage, but got none the wiser. Maybe itā€™s not possible? :sweat_smile:
I will be able to get my APP ID and ID HASH myself, but my googling has only resulted in Python code and left me none the wiserā€¦

You want to send a message via Siri to your homey/telegram chat?

If thatā€™s the case. sadly there is only a way to send it to a contact/phone number not a group/bot.
Sadly telegram doesnā€™t support iOS Shortcuts that well. Maybe ask in the #questions-help area if someone else found a way to send a payload to homey via Siri shortcuts. Telegram will currently not work.

Yeah basically update a variable through speech is what Iā€™m aiming for.
I came THIS close. Message is sent through voice, is seen inside the correct chat, but not received by Homey :sweat_smile:
Iā€™ll ask a question on the forum you linked me to. Thanks.

Great app though! Not your fault :sweat_smile: Must make do with opening Telegram until I find a way

Just a little teaser :slight_smile: Still no homey, but I can develop some stuff without it.
I hope the shipping will start soon of the new homeys!

FYI: Telegram Notification will require v8.1.0 or higher with the next update. Also it will include some nice stuff for @JB2K. (Deletion Question/messages, Custom IDs and some little QoL improvements)
And it will support BLL from @Arie_J_Godschalk if everything goes according to plan.

5 Likes

Hi, newbie user to TN, I am wondering if questions/answers could be managed directly from the flows like BLL new handling of variables from flows? Or is it not possible?

Hey, currently only possible via the settings menu, since its a one time thing.

But there will be a new card soon where you can select a question that is pre defined and select the answers per dropdown.

1 Like

aaah nice! but defining a question in the flow directly without having to go into the settings menu will not be possible?

Would be possible to develop, but currently not planed.

1 Like

okedoke :slight_smile: thank you for the reply! have a nice week :slight_smile:

1 Like