Skip to content

About

W3C Linked Data Notifications (LDN) implementation of Sender and Consumer roles, and implements Activity Vocabulary and Activity Streams 2.0 (AS2) compacted JSON-LD, with support for HTML+RDFa serialization.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

2 watching

Forks

@dokieli/notifications

W3C Linked Data Notifications (LDN) implementation of Sender and Consumer roles, and implements Activity Vocabulary and Activity Streams 2.0 (AS2) compacted JSON-LD, with support for HTML+RDFa serialization. The library allows clients to use their own parsers and own notification payloads.

License

Installation

npm install @dokieli/notifications

or

yarn install @dokieli/notifications
import { createNotification, serializeNotificationToJSONLD, serializeNotificationToHTML, sendNotification } from '@dokieli/notifications';

const notification = createNotification({
  type: 'Announce',
  actor: { id: 'https://example.org/profile#me', name: 'Virginia' },
  object: 'https://example.org/annotations/1',
  target: 'https://example.org/article'
});

const jsonld = serializeNotificationToJSONLD(notification);
const html = serializeNotificationToHTML(notification);

/* Discovers the target's inbox, negotiates via Accept-Post, serializes, POSTs */
const result = await sendNotification('https://example.org/article', notification);
import { getNotifications } from '@dokieli/notifications';

for await (const { iri, notification } of getNotifications('https://example.org/inbox/')) {
  console.log(iri, notification?.type);
}

Documentation

See API Reference and Examples.

Features

  • Built-in inbox discovery for ldp:inbox (LDN) and as:inbox (ActivityPub), or client-preferred inbox property.
  • Sending server-supported media types for notifications by checking Accept-Post.
  • Support for reading inbox items via ldp:contains and as:items, and AS2 pagination.
  • Activity Streams 2.0 notification model, serialized to JSON-LD and HTML+RDFa.
  • Embedding caller-supplied object payloads verbatim (JSON-LD or HTML+RDFa).
  • Authentication left to the caller via an injected fetch.
  • Built-in JSON-LD processing.
  • Support for reading additional serializations via a caller-supplied parser.

Specifications

Supported By

Support the project

Help the project grow by sponsoring it on Open Collective or reach out to us.

About

W3C Linked Data Notifications (LDN) implementation of Sender and Consumer roles, and implements Activity Vocabulary and Activity Streams 2.0 (AS2) compacted JSON-LD, with support for HTML+RDFa serialization.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages