Web Socket Protocol
The Mini Apps have a front-end page that communicates with the bot via websockets.
The communication is done by sending small JSON-encoded messages though the socket, this page describes their structure.
Basics
All messages have a type
attribute that determintes the kind of message.
Messages from the client must also have an app
attribute to identify which app the message is delivered to.
Mini Events
This section describes messages specific to the Mini Events app.
event
Sent by the server when there is a new event available or an existing event has been modified.
It’s also sent after welcome to give all the existing events.
This includes all the event-specific data.
Example:
{
"type": "event",
"id": 1,
"title": "Title",
"description": "Description",
"image": "https://miniapps.example.com/media/image.jpg",
"start": "12:00",
"duration": 1,
"attending": false,
"attendees": 3
}
events-loaded
This is sent during the initial connection, after all the event
messages have been sent.
attend
Sent by the client to register attendance to an event, it includes the property event
with the corresponding ID.
leave
Sent by the client to cancel attendance to an event, same format as attend
.