Support » Plugin: WP Telegram (Auto Post and Notifications) » Asgaros Forum – New Posts

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Manzoor Wani

    (@manzoorwanijk)

    Hi,

    Is it possible to send telegram notifications when there is a new topic or reply…

    If that plugin uses the to field (NOT the bcc field) of the email to send notifications, then it should work simply by enabling User Notifications in Private Notifications module and allowing users to connect their Telegram account using WP Telegram Login plugin.

    Is it possible to send custom notifications from a custom plugin? Maybe some hook?

    Yes, the plugin has a small API library included which can be used to send any type of messages to Telegram. Yo can do something like this:

    if ( class_exists( 'WPTelegram_Bot_API' ) ) {
    
    	$bot_token = 'YOUR BOT TOKEN';
    
    	$bot_api = new WPTelegram_Bot_API( $bot_token );
    
    	$res = $bot_api->sendMessage([
    		'chat_id' => 'your telegram chat id',
    		'text'    => 'Hello World',
    	]);
    
    	if ( $bot_api->is_success( $res ) ) {
    		$result = $res->get_result();
    
    		// do something
    	}
    }

    For custom messages to work, you need to follow all the instructions given in Private Notifications settings.

    Plugin Author Manzoor Wani

    (@manzoorwanijk)

    Well, I can see from the plugin code that it uses the to field, so it should ideally work 🙂

    Thanks for the quick reply!

    I rather meant that on every new post in the forum a telegram message will be send to a public telegram group. In my opinion, the user notifications are not suitable for this, because they are user specific.

    The WPTelegram_Bot_API looks great. I’ll try it out. Maybe I can create my own hook on asgaros forum to send messages using this API.

    Plugin Author Manzoor Wani

    (@manzoorwanijk)

    I rather meant that on every new post in the forum a telegram message will be send to a public telegram group.

    In that case, you just need to select the appropriate post type and enter the group ID in Post to Telegram settings, it should work. If it does not, then it may be some permissions issue which can be avoided by enabling a delay of half a minute or so, down on the same settings page.

    In my opinion, the user notifications are not suitable for this, because they are user specific.

    Yes, you are right 🙂

    In that case, you just need to select the appropriate post type and enter the group ID in Post to Telegram settings, it should work.

    Sadly these posts are not handled/stored like a regular wordpress post. 🙁

    I’ll try to add a hook on the asgarosforum_after_*_submit action and sent the messages using your API.

    Thanks again! 🙂

    Plugin Author Manzoor Wani

    (@manzoorwanijk)

    All the best 👍

    Feel free to contact again for any help.

    You may write a review for the plugin 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Asgaros Forum – New Posts’ is closed to new replies.