Package org.bgerp.plugin.telegram

# Class ExpressionObject

java.lang.Object
org.bgerp.plugin.telegram.ExpressionObject

All Implemented Interfaces:
  `ExpressionObject`

public class ExpressionObject extends Object implements ExpressionObject
Telegram JEXL API for sending messages to chats. Generic method `sendMessage(Collection, String, String)` sends message in different formats to chat ID. There are three formats available, more about those: https://core.telegram.org/bots/api#formatting-options Chat IDs for sending can be a also stored in user or process `text` parameter with ID configured as `telegram:userParamId` or `telegram:processParamId` respectively.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ExpressionObject()`
  Public constructor, can be used in Custom

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `escapeMarkdown(String text)`
  Escape a Markdown text from `SPECIAL_CHARACTERS_MD`
  `void`
  `sendMessage(String chatId, String text)`
  Send a plain text message to a chat
  `void`
  `sendMessage(String chatId, String text, String parseMode)`
  Send a message to a chat with a specific format
  `void`
  `sendMessage(Collection<Integer> userIds, String text)`
  Send a plain text message to users
  `void`
  `sendMessage(Collection<Integer> userIds, String text, String parseMode)`
  Send a message with a specific format to users
  `void`
  `sendMessage(Process process, String text)`
  Send a plain text message to a process executors
  `void`
  `sendMessage(Process process, String text, String parseMode)`
  Send a message with a specific format to a process executors
  `void`
  `sendMessageForProcess(Process process, String text)`
  Send a plain text message to a process
  `void`
  `toContext(Map<String,Object> context)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ExpressionObject

    public ExpressionObject()
    Public constructor, can be used in Custom

- ## Method Details

  - ### escapeMarkdown

    public static String escapeMarkdown(String text)
    Escape a Markdown text from `SPECIAL_CHARACTERS_MD`
    Parameters:
      `text` - the Markdown text
    Returns:
      the `text` with escaped special characters

  - ### toContext

    public void toContext(Map<String,Object> context)
    Specified by:
      `toContext` in interface `ExpressionObject`

  - ### sendMessage

    public void sendMessage(String chatId, String text)
    Send a plain text message to a chat
    Parameters:
      `chatId` - the chat ID
      `text` - the message

  - ### sendMessage

    public void sendMessage(String chatId, String text, String parseMode)
    Send a message to a chat with a specific format
    Parameters:
      `chatId` - the chat ID
      `text` - the message
      `parseMode` - the format: `null` - plain text, `MarkdownV2`, `HTML`

  - ### sendMessage

    public void sendMessage(Collection<Integer> userIds, String text)
    Send a plain text message to users
    Parameters:
      `userIds` - the user IDs
      `text` - the message

  - ### sendMessage

    public void sendMessage(Collection<Integer> userIds, String text, String parseMode)
    Send a message with a specific format to users
    Parameters:
      `userIds` - the user IDs
      `text` - the message
      `parseMode` - the format: `null` - plain text, `MarkdownV2`, `HTML`

  - ### sendMessage

    public void sendMessage(Process process, String text)
    Send a plain text message to a process executors
    Parameters:
      `process` - the process with the executor user IDs
      `text` - the message

  - ### sendMessage

    public void sendMessage(Process process, String text, String parseMode)
    Send a message with a specific format to a process executors
    Parameters:
      `process` - the process with the executor user IDs
      `text` - the message
      `parseMode` - the format: `null` - plain text, `MarkdownV2`, `HTML`

  - ### sendMessageForProcess

    public void sendMessageForProcess(Process process, String text)
    Send a plain text message to a process
    Parameters:
      `process` - the process
      `text` - the message