Skip to content

FEP-1970: Chat Links

by John Livingston git@john-livingston.fr submited on 2023-07-04

Summary

This FEP describes a way to attach a chat room to ActivityPub actors and objects. The chat room itself can be a web page, a XMPP room, a Matrix room, an IRC channel, … The chat itself does not necessarily publish messages using ActivityPub.

Chat link is an object with the following properties:

  • type (REQUIRED): the type MUST be Link.
  • name (RECOMMENDED): the name property SHOULD contain a human-readable description of the chat link.
  • href (REQUIRED): the href property MUST contain a chat URI. This can be an URL of a website, or any other kind of URI, such as a XMPP uri.
  • rel (REQUIRED): the rel property MUST contain the string discussion or an array containing that string. The discussion relation type is proposed as a HTML5 link type extensions.

Chat links MUST be added to the attachment array of an actor or an object.

Examples

Basic object attachment

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Article",
  "id": "https://example.tld/video/123",
  "attributedTo": "https://example.tld/users/alice",
  "name": "Let's go live!",
  "attachment": [
    {
      "type": "Link",
      "name": "Chat",
      "href": "https://example.tld/chat/room/123",
      "rel": "discussion"
    }
  ]
}

Basic actor attachment

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Person",
  "id": "https://example.tld/users/alice",
  "inbox": "https://example.tld/users/alice/inbox",
  "outbox": "https://example.tld/users/alice/outbox",
  "attachment": [
    {
      "type": "Link",
      "name": "Chat",
      "href": "https://example.tld/chat/room/123",
      "rel": "discussion"
    }
  ]
}

Multiple way to join the chat

In the following example, the chat room can be joined using a web browser or a xmpp client:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Video",
  "id": "https://example.tld/video/123",
  "attributedTo": "https://example.tld/users/alice",
  "name": "Let's go live!",
  "attachment": [
    {
      "type": "Link",
      "name": "Chat",
      "href": "https://example.tld/chat/room/123",
      "rel": "discussion"
    },
    {
      "type": "Link",
      "name": "Chat",
      "href": "xmpp://123@room.example.tld?join",
      "rel": "discussion"
    }
  ]
}

Live video stream

For a live stream, represented by a Video object, the chat link could link to the room where viewers can interract with the streamer.

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Video",
  "id": "https://example.tld/video/123",
  "attributedTo": "https://example.tld/users/alice",
  "name": "Let's go live!",
  "attachment": [
    {
      "type": "Link",
      "name": "Chat",
      "href": "https://example.tld/chat/room/123",
      "rel": "discussion"
    }
  ]
}

If the chat room is unique per streamer (and common to all the streamer videos), it can be attached to both the Video and the Person object.

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Person",
  "id": "https://example.tld/users/alice",
  "following": "https://example.tld/users/alice/following",
  "followers": "https://example.tld/users/alice/followers",
  "name": "Alice",
  "attachment": [
    {
      "type": "Link",
      "name": "Chat",
      "href": "https://example.tld/chat/room/123",
      "rel": "discussion"
    }
  ]
}

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Video",
  "id": "https://example.tld/video/123",
  "attributedTo": "https://example.tld/users/alice",
  "name": "Let's go live!",
  "attachment": [
    {
      "type": "Link",
      "name": "Chat",
      "href": "https://example.tld/chat/room/123",
      "rel": "discussion"
    }
  ]
}

If the chat room is unique to a streamer’s channel, it can be linked to both the Video and the Group object.

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Group",
  "id": "https://example.tld/channel/alice",
  "following": "https://example.tld/users/alice/following",
  "followers": "https://example.tld/users/alice/followers",
  "name": "Alice channel",
  "attachment": [
    {
      "type": "Link",
      "name": "Chat",
      "href": "https://example.tld/chat/room/123",
      "rel": "discussion"
    }
  ]
}

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Video",
  "id": "https://example.tld/video/123",
  "attributedTo": "https://example.tld/users/alice",
  "name": "Let's go live!",
  "attachment": [
    {
      "type": "Link",
      "name": "Chat",
      "href": "https://example.tld/chat/room/123",
      "rel": "discussion"
    }
  ]
}

Document discussion

Some file sharing sofwares allows to have a discussion room attached to files. In such case, the chat links can be added as attachment to Document objects.

Person instant messaging

If a user has instant messaging applications, chat links could be added to its Person object, so that we can join him.

If the user has multiple instant messaging accounts (XMPP, Matrix, …), each on of them can be added, and differenciated by the URI scheme.

Implementations

At the time of the writing, this FEP is been implemented in the Peertube livechat plugin, a chat plugin for Peertube.

References

CC0 1.0 Universal (CC0 1.0) Public Domain Dedication

To the extent possible under law, the authors of this Fediverse Enhancement Proposal have waived all copyright and related or neighboring rights to this work.