Skip to content

Instantly share code, notes, and snippets.

@GeorgiyDemo
Last active July 11, 2018 14:45
Show Gist options
  • Save GeorgiyDemo/1d64cf68e8ab47194680ed77b2ab0986 to your computer and use it in GitHub Desktop.
Save GeorgiyDemo/1d64cf68e8ab47194680ed77b2ab0986 to your computer and use it in GitHub Desktop.
Python VK(vkontakte) keyboard example for bots
# -*- 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