Last active
July 11, 2018 14:45
-
-
Save GeorgiyDemo/1d64cf68e8ab47194680ed77b2ab0986 to your computer and use it in GitHub Desktop.
Python VK(vkontakte) keyboard example for bots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import vk, json | |
session = vk.Session(access_token='token') | |
api = vk.API(session) | |
APIVersion = 5.73 | |
KEYBOARD = { | |
"one_time":True, | |
"buttons":[ | |
[ | |
{ | |
"action":{ | |
"type":"text", | |
"payload":"{\"button\": \"1\"}", | |
"label":"ЖМИ МЕНЯ" | |
}, | |
"color":"negative" | |
}, | |
{ | |
"action":{ | |
"type":"text", | |
"payload":"{\"button\": \"2\"}", | |
"label":"НЕ ЖМИ НА МЕНЯ" | |
}, | |
"color":"negative" | |
}, | |
] | |
] | |
} | |
api.messages.send(user_id=EXAMPLE,message=EXAMPLE,keyboard=json.dumps(KEYBOARD,ensure_ascii=False),v=APIVersion) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment