2017 © Pedro Peláez
 

craft-plugin craft-telegram-notification-channel

A Telegram notification channel for the Craft Notifications plugin

image

rias/craft-telegram-notification-channel

A Telegram notification channel for the Craft Notifications plugin

  • Monday, May 21, 2018
  • by Rias500
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

icon, (*1)

Latest Version Quality Score StyleCI Total Downloads, (*2)

Telegram Notification Channel plugin for Craft Notifications

A Telegram notification channel for the Craft Notifications plugin, (*3)

Support Open Source. Buy beer.

This plugin is licensed under a MIT license, which means that it's completely free open source software, and you can use it for whatever and however you wish. If you're using it and want to support the development, buy me a beer over at Beerpay!, (*4)

Beerpay, (*5)

Requirements

Installation

To install the plugin, follow these instructions., (*6)

  1. Open your terminal and go to your Craft project:, (*7)

    cd /path/to/project
  2. Then tell Composer to load the plugin:, (*8)

    composer require rias/craft-telegram-notification-channel
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Telegram Notification Channel., (*9)

Setting up your Telegram Bot

Talk to @BotFather and generate a Bot API Token., (*10)

Then, configure your Telegram Bot API Token either through the plugin settings or by copying the config.php file to config/telegram-notification-channel.php and setting the token there., (*11)

Using the Telegram Notification Channel

You can now add telegram to your via() function. You will also have to provide a toTelegram function to create your message., (*12)

use rias\notifications\models\Notification;
use rias\telegramnotificationchannel\models\TelegramMessage;

/**
 * Get the notification's delivery channels.
 *
 * @return array
 */
public function via()
{
    return ['telegram' => '<YOUR_USER_ID/CHAT_ID>'];
}

public function toTelegram()
{
    $blogpost = $this->event->sender;

    return TelegramMessage::create()
        //->to($this->user->telegram_user_id) // You can provide a different user or chat to send to here.
        ->content("A new blogpost has been added:\n*{$blogpost->title}*") // Markdown supported.
        ->button('View blogpost', $blogpost->url); // Inline Button
}

Here's a screenshot preview of the above notification on Telegram Messenger:, (*13)

Message screenshot, (*14)

Available message methods

  • to($chatId): (integer) Recipient's chat id or user id.
  • content(''): (string) Notification message, supports markdown. For more information on supported markdown styles, check out these docs.
  • button($text, $url): (string) Adds an inline "Call to Action" button. You can add as many as you want and they'll be placed 2 in a row.
  • options([]): (array) Allows you to add additional or override sendMessage payload (A Telegram Bot API method used to send message internally). For more information on supported parameters, check out these docs.

Credits

Brought to you by Rias, (*15)

The Versions

21/05 2018

dev-master

9999999-dev

A Telegram notification channel for the Craft Notifications plugin

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft telegram notification channel

21/05 2018

1.0.1

1.0.1.0

A Telegram notification channel for the Craft Notifications plugin

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft telegram notification channel

23/01 2018

1.0.0

1.0.0.0

A Telegram notification channel for the Craft Notifications plugin

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft telegram notification channel