Telegram works very well. Try:

import requests

TOKEN = "<your token"
chat_id = <your chat_id>
text = "Testtext"

def sendtelegram(chat_id, text):
    url = "https://api.telegram.org/bot%s/%%s"; % TOKEN
    postdata = dict(chat_id = chat_id, text=text)
    method = "sendMessage"
    return requests.post(url%method, data=postdata).json()

print sendtelegram(chat_id, text)


​Result:

{u'ok': True, u'result': {u'date': 1470978219, u'text': u'Testtext',
u'from': {u'username': u'<your bot name>', u'first_name': u'<bot name>',
u'id': <bot id>}, u'message_id': 26196, u'chat': {u'username':
u'<receiver>', u'first_name': u'<receiver>', u'last_name': u'<receiver>',
u'type': u'private', u'id': <your chat_id>}}}



​

2016-08-11 23:46 GMT+02:00 黄祥 <[email protected]>:

> is there any way to send notification to telegram bot after insert the
> form in web2py?
> e.g.
> redirect('https://api.telegram.org/bot<bot:api>/sendMessage?
> chat_id=<chat_id>&text=test')
>
> result test url:
> {"ok":false,"error_code":403,"description":"Bot can't send messages to
> the bot"}
>
> thanks and best regards,
> stifan
>



​Regards, Martin

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to