telegram

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelReceived = "received"
	ChannelTimeout  = "timeout"

	ActionButtonClick = "buttonClick"
	ActionTimeout     = "timeout"
)

Variables

This section is empty.

Functions

func ChatDisplayName

func ChatDisplayName(chat *ChatDetail) string

Types

type Button added in v0.10.0

type Button struct {
	Name  string `json:"name" mapstructure:"name"`
	Value string `json:"value" mapstructure:"value"`
}

type CallbackQuery added in v0.10.0

type CallbackQuery struct {
	ID      string           `json:"id"`
	From    *User            `json:"from,omitempty"`
	Message *TelegramMessage `json:"message,omitempty"`
	Data    string           `json:"data"`
}

type Chat

type Chat struct {
	ID    int64  `json:"id"`
	Type  string `json:"type"`
	Title string `json:"title,omitempty"`
}

type ChatDetail

type ChatDetail struct {
	ID        int64  `json:"id"`
	Type      string `json:"type"`
	Title     string `json:"title,omitempty"`
	Username  string `json:"username,omitempty"`
	FirstName string `json:"first_name,omitempty"`
	LastName  string `json:"last_name,omitempty"`
}

type ChatInfo added in v0.10.0

type ChatInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Client

type Client struct {
	BotToken string
}

func NewClient

func NewClient(ctx core.IntegrationContext) (*Client, error)

func (*Client) AnswerCallbackQuery added in v0.10.0

func (c *Client) AnswerCallbackQuery(callbackQueryID string) error

AnswerCallbackQuery acknowledges a callback query from an inline button click

func (*Client) GetChat

func (c *Client) GetChat(chatID string) (*ChatDetail, error)

func (*Client) GetMe

func (c *Client) GetMe() (*User, error)

GetMe retrieves information about the bot

func (*Client) SendMessage

func (c *Client) SendMessage(chatID string, text string, parseMode string) (*TelegramMessage, error)

SendMessage sends a text message to a chat

func (*Client) SendMessageWithInlineKeyboard added in v0.10.0

func (c *Client) SendMessageWithInlineKeyboard(chatID string, text string, buttons [][]InlineKeyboardButton) (*TelegramMessage, error)

SendMessageWithInlineKeyboard sends a message with inline keyboard buttons

func (*Client) SetWebhook

func (c *Client) SetWebhook(url string) error

SetWebhook sets the webhook URL for receiving updates

type Configuration

type Configuration struct {
	BotToken string `json:"botToken" mapstructure:"botToken"`
}

type InlineKeyboardButton added in v0.10.0

type InlineKeyboardButton struct {
	Text         string `json:"text"`
	CallbackData string `json:"callback_data"`
}

type MessageEntity

type MessageEntity struct {
	Type   string `json:"type"`
	Offset int    `json:"offset"`
	Length int    `json:"length"`
}

type Metadata

type Metadata struct {
	BotID     int64  `json:"botId" mapstructure:"botId"`
	Username  string `json:"username" mapstructure:"username"`
	FirstName string `json:"firstName" mapstructure:"firstName"`
}

type OnMention

type OnMention struct{}

func (*OnMention) Actions

func (t *OnMention) Actions() []core.Action

func (*OnMention) Cleanup

func (t *OnMention) Cleanup(ctx core.TriggerContext) error

func (*OnMention) Color

func (t *OnMention) Color() string

func (*OnMention) Configuration

func (t *OnMention) Configuration() []configuration.Field

func (*OnMention) Description

func (t *OnMention) Description() string

func (*OnMention) Documentation

func (t *OnMention) Documentation() string

func (*OnMention) ExampleData

func (t *OnMention) ExampleData() map[string]any

func (*OnMention) HandleAction

func (t *OnMention) HandleAction(ctx core.TriggerActionContext) (map[string]any, error)

func (*OnMention) HandleWebhook

func (t *OnMention) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*OnMention) Icon

func (t *OnMention) Icon() string

func (*OnMention) Label

func (t *OnMention) Label() string

func (*OnMention) Name

func (t *OnMention) Name() string

func (*OnMention) OnIntegrationMessage

func (t *OnMention) OnIntegrationMessage(ctx core.IntegrationMessageContext) error

func (*OnMention) Setup

func (t *OnMention) Setup(ctx core.TriggerContext) error

type OnMentionConfiguration

type OnMentionConfiguration struct {
	ChatID string `json:"chatId" mapstructure:"chatId"`
}

type OnMentionMetadata

type OnMentionMetadata struct {
	AppSubscriptionID *string `json:"appSubscriptionID,omitempty" mapstructure:"appSubscriptionID,omitempty"`
	ChatID            *string `json:"chatId,omitempty" mapstructure:"chatId,omitempty"`
	ChatName          *string `json:"chatName,omitempty" mapstructure:"chatName,omitempty"`
}

type SendMessage

type SendMessage struct{}

func (*SendMessage) Actions

func (c *SendMessage) Actions() []core.Action

func (*SendMessage) Cancel

func (c *SendMessage) Cancel(ctx core.ExecutionContext) error

func (*SendMessage) Cleanup

func (c *SendMessage) Cleanup(ctx core.SetupContext) error

func (*SendMessage) Color

func (c *SendMessage) Color() string

func (*SendMessage) Configuration

func (c *SendMessage) Configuration() []configuration.Field

func (*SendMessage) Description

func (c *SendMessage) Description() string

func (*SendMessage) Documentation

func (c *SendMessage) Documentation() string

func (*SendMessage) ExampleOutput

func (c *SendMessage) ExampleOutput() map[string]any

func (*SendMessage) Execute

func (c *SendMessage) Execute(ctx core.ExecutionContext) error

func (*SendMessage) HandleAction

func (c *SendMessage) HandleAction(ctx core.ActionContext) error

func (*SendMessage) HandleWebhook

func (c *SendMessage) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*SendMessage) Icon

func (c *SendMessage) Icon() string

func (*SendMessage) Label

func (c *SendMessage) Label() string

func (*SendMessage) Name

func (c *SendMessage) Name() string

func (*SendMessage) OutputChannels

func (c *SendMessage) OutputChannels(configuration any) []core.OutputChannel

func (*SendMessage) ProcessQueueItem

func (c *SendMessage) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*SendMessage) Setup

func (c *SendMessage) Setup(ctx core.SetupContext) error

type SendMessageChatMetadata

type SendMessageChatMetadata struct {
	ID   string `json:"id" mapstructure:"id"`
	Name string `json:"name" mapstructure:"name"`
}

type SendMessageConfiguration

type SendMessageConfiguration struct {
	ChatID    string `json:"chatId" mapstructure:"chatId"`
	Text      string `json:"text" mapstructure:"text"`
	ParseMode string `json:"parseMode" mapstructure:"parseMode"`
}

type SendMessageMetadata

type SendMessageMetadata struct {
	Chat *SendMessageChatMetadata `json:"chat" mapstructure:"chat"`
}

type SubscriptionConfiguration

type SubscriptionConfiguration struct {
	EventTypes []string `json:"eventTypes" mapstructure:"eventTypes"`
}

type Telegram

type Telegram struct{}

func (*Telegram) Actions

func (t *Telegram) Actions() []core.Action

func (*Telegram) Cleanup

func (t *Telegram) Cleanup(ctx core.IntegrationCleanupContext) error

func (*Telegram) Components

func (t *Telegram) Components() []core.Component

func (*Telegram) Configuration

func (t *Telegram) Configuration() []configuration.Field

func (*Telegram) Description

func (t *Telegram) Description() string

func (*Telegram) HandleAction

func (t *Telegram) HandleAction(ctx core.IntegrationActionContext) error

func (*Telegram) HandleRequest

func (t *Telegram) HandleRequest(ctx core.HTTPRequestContext)

func (*Telegram) Icon

func (t *Telegram) Icon() string

func (*Telegram) Instructions

func (t *Telegram) Instructions() string

func (*Telegram) Label

func (t *Telegram) Label() string

func (*Telegram) ListResources

func (t *Telegram) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)

func (*Telegram) Name

func (t *Telegram) Name() string

func (*Telegram) Sync

func (t *Telegram) Sync(ctx core.SyncContext) error

func (*Telegram) Triggers

func (t *Telegram) Triggers() []core.Trigger

type TelegramMessage

type TelegramMessage struct {
	MessageID int64           `json:"message_id"`
	From      *User           `json:"from,omitempty"`
	Chat      Chat            `json:"chat"`
	Text      string          `json:"text,omitempty"`
	Entities  []MessageEntity `json:"entities,omitempty"`
	Date      int64           `json:"date"`
}

type Update

type Update struct {
	UpdateID      int64            `json:"update_id"`
	Message       *TelegramMessage `json:"message,omitempty"`
	CallbackQuery *CallbackQuery   `json:"callback_query,omitempty"`
}

type User

type User struct {
	ID        int64  `json:"id"`
	IsBot     bool   `json:"is_bot"`
	FirstName string `json:"first_name"`
	Username  string `json:"username,omitempty"`
}

type WaitForButtonClick added in v0.10.0

type WaitForButtonClick struct{}

func (*WaitForButtonClick) Actions added in v0.10.0

func (c *WaitForButtonClick) Actions() []core.Action

func (*WaitForButtonClick) Cancel added in v0.10.0

func (*WaitForButtonClick) Cleanup added in v0.10.0

func (c *WaitForButtonClick) Cleanup(ctx core.SetupContext) error

func (*WaitForButtonClick) Color added in v0.10.0

func (c *WaitForButtonClick) Color() string

func (*WaitForButtonClick) Configuration added in v0.10.0

func (c *WaitForButtonClick) Configuration() []configuration.Field

func (*WaitForButtonClick) Description added in v0.10.0

func (c *WaitForButtonClick) Description() string

func (*WaitForButtonClick) Documentation added in v0.10.0

func (c *WaitForButtonClick) Documentation() string

func (*WaitForButtonClick) ExampleOutput added in v0.10.0

func (c *WaitForButtonClick) ExampleOutput() map[string]any

func (*WaitForButtonClick) Execute added in v0.10.0

func (*WaitForButtonClick) HandleAction added in v0.10.0

func (c *WaitForButtonClick) HandleAction(ctx core.ActionContext) error

func (*WaitForButtonClick) HandleWebhook added in v0.10.0

func (c *WaitForButtonClick) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*WaitForButtonClick) Icon added in v0.10.0

func (c *WaitForButtonClick) Icon() string

func (*WaitForButtonClick) Label added in v0.10.0

func (c *WaitForButtonClick) Label() string

func (*WaitForButtonClick) Name added in v0.10.0

func (c *WaitForButtonClick) Name() string

func (*WaitForButtonClick) OutputChannels added in v0.10.0

func (c *WaitForButtonClick) OutputChannels(configuration any) []core.OutputChannel

func (*WaitForButtonClick) ProcessQueueItem added in v0.10.0

func (c *WaitForButtonClick) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*WaitForButtonClick) Setup added in v0.10.0

func (c *WaitForButtonClick) Setup(ctx core.SetupContext) error

type WaitForButtonClickConfiguration added in v0.10.0

type WaitForButtonClickConfiguration struct {
	ChatID  string   `json:"chatId" mapstructure:"chatId"`
	Message string   `json:"message" mapstructure:"message"`
	Timeout *int     `json:"timeout,omitempty" mapstructure:"timeout,omitempty"`
	Buttons []Button `json:"buttons" mapstructure:"buttons"`
}

type WaitForButtonClickMetadata added in v0.10.0

type WaitForButtonClickMetadata struct {
	Chat              *ChatInfo `json:"chat"`
	MessageID         *int64    `json:"messageID,omitempty"`
	SelectedButton    *string   `json:"selectedButton,omitempty"`
	AppSubscriptionID *string   `json:"appSubscriptionID,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL