Skip to content

Commit 8eb6e03

Browse files
committed
Update README with webhooks information.
1 parent d6552eb commit 8eb6e03

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎README.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ To start the bot, simply open up a terminal and enter `python echo_bot.py` to ru
118118

119119
All types are defined in types.py. They are all completely in line with the [Telegram API's definition of the types](https://core.telegram.org/bots/api#available-types), except for the Message's `from` field, which is renamed to `from_user` (because `from` is a Python reserved token). Thus, attributes such as `message_id` can be accessed directly with `message.message_id`. Note that `message.chat` can be either an instance of `User` or `GroupChat` (see [How can I distinguish a User and a GroupChat in message.chat?](#how-can-i-distinguish-a-user-and-a-groupchat-in-messagechat)).
120120

121-
The Message object also has a `content_type`attribute, which defines the type of the Message. `content_type` can be one of the following strings:
121+
The Message object also has a `content_type`attribute, which defines the type of the Message. `content_type` can be one of the following strings:
122122
'text', 'audio', 'document', 'photo', 'sticker', 'video', 'location', 'contact', 'new_chat_participant', 'left_chat_participant', 'new_chat_title', 'new_chat_photo', 'delete_chat_photo', 'group_chat_created'.
123123

124124
### Methods
@@ -208,7 +208,7 @@ tb.polling(none_stop=False, interval=0, block=True)
208208
user = tb.get_me()
209209

210210
# setWebhook
211-
tb.set_webhook(url="http://example.com", cert=open('mycert.pem'))
211+
tb.set_webhook(url="http://example.com", certificate=open('mycert.pem'))
212212
# unset webhook
213213
tb.remove_webhook()
214214

@@ -373,8 +373,10 @@ bot.set_update_listener(handle_messages)
373373
bot.polling()
374374
```
375375

376-
### Using web hooks
377-
If you prefer using web hooks to the getUpdates method, you can use the `process_new_messages(messages)` function in TeleBot to make it process the messages that you supply. It takes a list of Message objects. This function is still incubating.
376+
### Using webhooks
377+
When using webhooks telegram sends one Update per call, for processing it you should call process_new_messages([update.message]) when you recieve it.
378+
379+
There are some examples using webhooks in the *examples/webhook_examples* directory.
378380

379381
### Logging
380382

@@ -423,4 +425,4 @@ We now have a Telegram Channel as well! Keep yourself up to date with API change
423425

424426
## Bots using this API
425427
* [SiteAlert bot](https://telegram.me/SiteAlert_bot) ([source](https://github.com/ilteoood/SiteAlert-Python)) by *ilteoood* - Monitors websites and sends a notification on changes
426-
Want to have your bot listed here? Send a Telegram message to @eternnoir or @pevdh.
428+
Want to have your bot listed here? Send a Telegram message to @eternnoir or @pevdh.

0 commit comments

Comments
 (0)