[3.3][DEV] Telegram Bridge

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Anti-Spam Guide
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
mbld
Registered User
Posts: 21
Joined: Thu Aug 23, 2018 7:37 pm

[3.3][DEV] Telegram Bridge

Post by mbld »

Extension Name: Telegram Bridge
Author: mbld

Extension Description: Allows to browse through the forum, send topics and posts and receive notifications via telegram.
Extension Version: 1.0.0-dev

Language: EN and DE included. RU as separate language pack.

Requirements: No special requirements

Features:
  • List all forums
  • List all posts in a forum
  • Create new topics
  • Create new posts in existing topics
  • Receive notifications
Screenshots:
TelegramScreenshot.gif
AdminScreenshot.gif

Extension Download: https://github.com/D-MBLD/phpbb-telegram-bridge/ (see README.md)
You do not have the required permissions to view the files attached to this post.
Last edited by mbld on Thu Mar 02, 2023 6:12 pm, edited 2 times in total.
User avatar
ReXtor
Registered User
Posts: 28
Joined: Sat Jan 28, 2023 12:23 pm
Location: Siberia

Re: [3.3][DEV] Telegram Bridge

Post by ReXtor »

README.md wrote:Enter all settings there and press the link, which is provided for registering the webHook.
done:
2023-02-18_09-43-44.png
README.md wrote:## Testing
Send an arbitrary text to the bot. It should react with the information, that you need to enter
your telegram-ID into your profile.
I am contacting the PM bot:
2023-02-18_09-49-39.png
But there is no answer

Okay, I'm going to UCP, I specify my tg ID in the settings. An error occurs:
2023-02-18_09-52-41.png
Must be numeric?! How is that?
You do not have the required permissions to view the files attached to this post.
User avatar
ReXtor
Registered User
Posts: 28
Joined: Sat Jan 28, 2023 12:23 pm
Location: Siberia

Re: [3.3][DEV] Telegram Bridge

Post by ReXtor »

91.108.6.104 - - [18/Feb/2023:04:13:54 +0300] "POST //telegram/webhook HTTP/1.0" 404 18150 "-" "-" in access.log
Two slashes are an error

ACP:
2023-02-18_10-26-20.png
You do not have the required permissions to view the files attached to this post.
User avatar
ReXtor
Registered User
Posts: 28
Joined: Sat Jan 28, 2023 12:23 pm
Location: Siberia

Re: [3.3][DEV] Telegram Bridge

Post by ReXtor »

Found a problem with viewforum.php when creating a theme through a bot:
2023-02-18_12-05-17.png
  • The last post value is out of place
  • The color of the user name also changes
And it should look like this:
2023-02-18_12-18-43.png
At the same time, even with the extension disabled, everything does not look as it should:
2023-02-18_12-21-31.png
You do not have the required permissions to view the files attached to this post.
User avatar
ReXtor
Registered User
Posts: 28
Joined: Sat Jan 28, 2023 12:23 pm
Location: Siberia

Re: [3.3][DEV] Telegram Bridge

Post by ReXtor »

ReXtor wrote: Sat Feb 18, 2023 1:30 am Two slashes are an error
I solved it as follows
Open info_acp_telegram.php, and find

Code: Select all

	'ACP_TELEGRAM_WEBHOOK_TEMPLATE' => 'https://api.telegram.org/bot%s/setWebhook?url=%s/telegram/webhook&secret_token=%s',
replace with

Code: Select all

	'ACP_TELEGRAM_WEBHOOK_TEMPLATE' => 'https://api.telegram.org/bot%s/setWebhook?url=%stelegram/webhook&secret_token=%s',
mbld
Registered User
Posts: 21
Joined: Thu Aug 23, 2018 7:37 pm

Re: [3.3][DEV] Telegram Bridge

Post by mbld »

Hi ReXtor,

thanks for testing.
ReXtor wrote: Sat Feb 18, 2023 3:30 am Two slashes are an error

I solved it as follows
Open info_acp_telegram.php, and find

Code: Select all

	'ACP_TELEGRAM_WEBHOOK_TEMPLATE' => 'https://api.telegram.org/bot%s/setWebhook?url=%s/telegram/webhook&secret_token=%s',
replace with

Code: Select all

	'ACP_TELEGRAM_WEBHOOK_TEMPLATE' => 'https://api.telegram.org/bot%s/setWebhook?url=%stelegram/webhook&secret_token=%s',
The second %s is replaced by the server name from the configuration. I guess it is configured in my case without trailing / and in your case with a trailing /.
I just pushed a fix to GitHub, such that a trailing slash is allowed. But you have to revert your change in info_acp_telegram.php.

Regarding the telegram id for the admin:
Must be numeric?! How is that?
It is the telegram ID, not the name. And the ID is always numeric.

I will check for your other findings, regarding the display of name and date.
mbld
Registered User
Posts: 21
Joined: Thu Aug 23, 2018 7:37 pm

Re: [3.3][DEV] Telegram Bridge

Post by mbld »

Wrong column header for "LAST POST" is fixed. (Core language variable was overwritten by my extension. Have to check, how to avoid that in general.)
User avatar
ReXtor
Registered User
Posts: 28
Joined: Sat Jan 28, 2023 12:23 pm
Location: Siberia

Re: [3.3][DEV] Telegram Bridge

Post by ReXtor »

mbld wrote: Sat Feb 18, 2023 8:53 am I guess it is configured in my case without trailing / and in your case with a trailing /.
the conference is located in the root of the site, so the conference path parameter specifies /
mbld wrote: Sat Feb 18, 2023 8:53 am I just pushed a fix to GitHub, such that a trailing slash is allowed. But you have to revert your change in info_acp_telegram.php.
Okay. Anyway, this is only required to activate the webhook.
mbld wrote: Sat Feb 18, 2023 8:53 am It is the telegram ID, not the name. And the ID is always numeric.
When I realized that we were talking about ID (instead of username), I still couldn't find it in the Telegram interface. I remember that it used to be displayed, but now it is not. It's good that he was listed in the message from the bot.

But @username support is required. Otherwise, few users will be able to understand what ID is required of them.
mbld wrote: Sat Feb 18, 2023 8:53 am I will check for your other findings, regarding the display of name and date.
Okey.
mbld wrote: Sat Feb 18, 2023 9:22 am Wrong column header for "LAST POST" is fixed. (Core language variable was overwritten by my extension. Have to check, how to avoid that in general.)
It is wonderful. I will update the extension later and continue testing.

p.s. I apologize for possible mistakes - I use an online translator.
User avatar
ReXtor
Registered User
Posts: 28
Joined: Sat Jan 28, 2023 12:23 pm
Location: Siberia

Re: [3.3][DEV] Telegram Bridge

Post by ReXtor »

I remembered about another noticed problem.
common.php (lang)

Code: Select all

	//Placeholders: Sitename, Site-URL, telegram-id
	'HELP_SCREEN_NON_MEMBER' => 'This service can be used by registered members of ' .
	'<a href="%2$s">%1$s</a> only.' .
<a href="%2$s">%1$s</a> it didn't work. From the bot in the text there was only the name, but not in the form of a link, but in plain text.

Found a typo

Code: Select all

	'REQUEST_TITEL' => 'Send the title for your new post or use the cancel button.',
TITEL >> TITLE

Also, I don't understand what the variables in the section are for //Registration screens. I have not received any email notifications.
User avatar
ReXtor
Registered User
Posts: 28
Joined: Sat Jan 28, 2023 12:23 pm
Location: Siberia

Re: [3.3][DEV] Telegram Bridge

Post by ReXtor »

Again about slashes...
2023-02-18_19-22-13 (2).png
2023-02-18_19-24-40.png

\ disappeared from the title


About the color of the user name in the list of topics
2023-02-18_19-34-37.png
2023-02-18_19-35-37.png

The wrong CSS class and there is no explicit color indication.
You do not have the required permissions to view the files attached to this post.
User avatar
ReXtor
Registered User
Posts: 28
Joined: Sat Jan 28, 2023 12:23 pm
Location: Siberia

Re: [3.3][DEV] Telegram Bridge

Post by ReXtor »

mbld wrote: Sat Feb 18, 2023 8:53 am I just pushed a fix to GitHub, such that a trailing slash is allowed. But you have to revert your change in info_acp_telegram.php.
It didn't work. Still // in URL

In the administrators log, when saving the extension settings, it displays {LOG ACP TELEGRAM SETTINGS} instead of <strong>Telegram Bridge settings updated</strong>
mbld
Registered User
Posts: 21
Joined: Thu Aug 23, 2018 7:37 pm

Re: [3.3][DEV] Telegram Bridge

Post by mbld »

OK, let me try to sort it out:

1. Double slash in webHook registration link:
Fixed: Should now finally work. Was not prepared for forum paths consisting solely of a /
2. Type TITEL instead of TITLE:
Fixed, although not user facing.
3. Missing link in message HELP_SCREEN_NON_MEMBER:
Fixed: Happens, if no home-URL is configured. I am using the forum-URL (same as for the webHook) now in such cases.
4. Allow to enter telegram name instead of id:
I am not sure, if the name is (always) unique. As the user is directly informed by a telegram message, I don't really see this requirement.
(By the way, I also do not see my telegram name in the telegram UI and to be honest, I would not know it, when I would be asked to enter it)
I agree however, that it is difficult to find out the ID for an admin account, especially if a group or channel is created for this purpose. I will think about that.
5. For all other findings (and I hope I didn't forget any), I have created issues in gitHub, which I will care for soon:
https://github.com/D-MBLD/phpbb-telegram-bridge/issues

Thanks again for testing
mbld
Registered User
Posts: 21
Joined: Thu Aug 23, 2018 7:37 pm

Re: [3.3][DEV] Telegram Bridge

Post by mbld »

ReXtor wrote: Sat Feb 18, 2023 10:55 am In the administrators log, when saving the extension settings, it displays {LOG ACP TELEGRAM SETTINGS} instead of <strong>Telegram Bridge settings updated</strong>
I could not reproduce that. Maybe it has to do with the language the forum is running with. But I am running my forum in German, and still the text, which is only available in English, is correctly entered into the log.
If you have other extensions, which are writing the log entry correctly, I would be interested in seeing how they do it.
Because I am just using the log-API, and this should care itself for selecting the English text, if it is not available in the current language.
mbld
Registered User
Posts: 21
Joined: Thu Aug 23, 2018 7:37 pm

Re: [3.3][DEV] Telegram Bridge

Post by mbld »

ReXtor wrote: Sat Feb 18, 2023 9:54 am Also, I don't understand what the variables in the section are for //Registration screens. I have not received any email notifications.
The verification of the telegram id in the users profile via email should work now.

If you have used the extension already before this fix, existing users are already treated as verified.
If you want to reset the state, in order to test the verification procedure either deactivate the extension and delete its data, or delete the entries in the table phpbb_eb_telegram_chat.

The registration procedure is as follows:
When an unverified user (user has entered his/her telegram id in the profile, but we need to assure, the id belongs really to the user) sends a message to the bot, he/she receives the option to request an email:
VerifyId1.gif
After the email was requested, the code contained in the email, must be sent to the bot:
VerifyId2.gif
If the code was correct, the id is verified, and the telegram bridge is usable for this user:
VerifyId3.gif
You do not have the required permissions to view the files attached to this post.
User avatar
ReXtor
Registered User
Posts: 28
Joined: Sat Jan 28, 2023 12:23 pm
Location: Siberia

Re: [3.3][DEV] Telegram Bridge

Post by ReXtor »

mbld wrote: Sat Feb 18, 2023 12:54 pm 4. Allow to enter telegram name instead of id:
I am not sure, if the name is (always) unique. As the user is directly informed by a telegram message, I don't really see this requirement.
(By the way, I also do not see my telegram name in the telegram UI and to be honest, I would not know it, when I would be asked to enter it)
I agree however, that it is difficult to find out the ID for an admin account, especially if a group or channel is created for this purpose. I will think about that.
I hope we're talking about the same thing. Just in case, I clarify that username is not a name. Name - can be any, including non-unique. Username is unique. More about of username https://telegram.org/faq#usernames-and-t-me
And a screenshot for clarity
2023-02-19_06-31-44.png
You do not have the required permissions to view the files attached to this post.

Return to “Extensions in Development”