Public/Telegram/Channel/Add-TelegramChannel.ps1

function Add-TelegramChannel {

    [CmdletBinding()]
    param (

         [Parameter(Mandatory = $true)]
         [String]$Name        # Give the channel a name, this is the "identifier for this channel"

        ,[Parameter(Mandatory = $true)]
         [String]$Token

    )

    process {

        # Encrypt the token
        #$encryptedToken = Convert-PlaintextToSecure -String $Token

        # This is customised for Telegram
        $definition = [PSCustomObject]@{
            "token" = Convert-PlaintextToSecure -String $Token #$encryptedToken
        }

        Add-Channel -Type "Telegram" -Name $Name -Definition $definition

    }

}