- Source
Classes
Type Definitions
LaunchConfig
- object
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
dropPendingUpdates | boolean | <optional> | false | If sets to true, dropping all pending updates which were sent when bots bot not was started |
polling | PollingConfig | <optional> | Polling configuration | |
webhook | WebhookConfig | <optional> | Webhook configuration | |
allowedUpdates | Array.<UpdateType> | <optional> | Array of allowed updates for webhook. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time. |
- Source
LaunchWebhookOptions
- object
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
path | string | <optional> | '/opengram' | Path the server should listen to. By default - |
secret | string | A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you. If not specified, generates an automatic |
- Source
OpengramOptions
- object
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
telegram | TelegramOptions | Telegram options | ||
username | string | <optional> | Bot username, used if you don't call | |
channelMode | boolean | <optional> | false | If |
retryAfter | number | <optional> | 1 | Interval for retrying long-polling requests in seconds |
handlerTimeout | Infinity | | <optional> | 2000 | Maximum interval waiting update processing with long-polling, before getting new updates. Pass |
contextType | OpengramContext | <optional> | Custom context class |
- Source
PollingConfig
- object
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
stopCallback | function | <optional> | Function called when bot fully stopped. If you call | |
allowedUpdates | UpdateType | | <optional> | Array of allowed updates or update name For example, specify | |
limit | number | <optional> | 100 | Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100. |
timeout | number | <optional> | 30 | Timeout in seconds for long polling. Defaults to 30 |
- Source
StartWebhookOptions
- object
Name | Type | Attributes | Description |
---|---|---|---|
path | string | Path the server should listen to. | |
secret | string | <optional> | A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you. |
- Source
WebhookCallbackOptions
- object
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
path | string | <optional> | '/' | Path the server should listen to. |
secret | string | <optional> | A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you. |
- Source
WebhookConfig
- object
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
useSecretPath | boolean | <optional> | true | Enable legacy mode by using the secret in the URL instead of the secret header. |
domain | string | Your external server domain For example - | ||
options | LaunchWebhookOptions | Webhook options object. See Opengram#startWebhook for more information | ||
tlsOptions | object | Options for TLS. See Opengram#startWebhook for more information | ||
cb | function | Next handler function, called when webhook handler not match path string or request method. See Opengram#startWebhook for more information | ||
port | number | Port number. See Opengram#startWebhook for more information | ||
host | string | Hostname. See Opengram#startWebhook for more information | ||
ipAddress | string | <optional> | The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS | |
maxConnections | number | <optional> | 40 | The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput. |
- Source