Websocket API
The VRChat Websocket API is used receiving updates regarding the API, such as a friend has been added an invite received. The WebSocket is receive-only, meaning that you can only listen for messages. Sending messages is undefined behavior.
Connecting
Connecting to the VRChat webhook server is done via the URL:
wss://pipeline.vrchat.cloud/?authToken=authcookie_...
The auth-token query parameter is the authorization cookie you receive when logging into VRChat.
Message structure
Messages through VRChat’s Websocket API are delivered as strings. For example, the friend-offline event would be formated as:
"{content:\"{\"userId\": \"usr_...\"}\"}"
After parsing the message:
{
"content": "{\"userId\": \"usr_...\"}",
"type": "friend-offline"
}
The value of content is also delivered as a string.
To get the full payload it is required to again parse the contents of content
:
{
"content": {
"userId": "usr_..."
},
"type": "friend-offline"
}
Events
Friend Online Event
{
"content": {
"userId": "<userId>",
"user": <userObject>
},
"type": "friend-online"
}
Friend Offline Event
{
"content": {
"userId": "<userId>"
},
"type": "friend-offline"
}
Friend Active Event
{
"content": {
"userId": "<userId>",
"user": <userObject>
},
"type": "friend-active"
}
Friend Add Event
{
"content": {
"userId": "<userId>",
"user": <userObject>
},
"type": "friend-add"
}
Friend Delete Event
{
"content": {
"userId": "<userId>"
},
"type": "friend-delete"
}
Friend Update Event
{
"content": {
"userId": "<userId>",
"user": <userObject>
},
"type": "friend-update"
}
Friend Location Event
{
"content": {
"userId": "<userId>",
"user": <userObject>,
"world": <worldObject>,
"location": "<worldId:locationId>",
"instance": "<locationId>",
"canRequestInvite": <boolean>
},
"type": "friend-location"
}
Notification Received Event
Notifications are used for e.g. Invites, Friend Requests, Invite Requests and Invite Responeses.
{
"content": <notificationObject>,
"type": "notification"
}
Notification Seen Event
Lets the listener know a notification has been marked as seen.
{
"content": <notificationId>,
"type": "see-notification"
}
Notification Response
Similar to Notification Received Event
, except this carries an ID (responseId
) of the notificaiton (which is required to fetch seperately) that was sent in response to an earlier notification (notificationId
). This is used e.g., when responding to an Invite.
{
"content": {
"notificationId": <notificationId>,
"receiverId": <userId>,
"responseId": <notification>
},
"type": "response-notification"
}