A Mastodon bot for the UGent/SURF Claims Network project.
yarn install
cp .env-example .env
See the "Configuration options" section below.
yarn run server
yarn run fetch
yarn run real-clean
yarn real-clean
Add a demo incoming toot:
yarn demo-accepted
Run the handler for incoming toots:
yarn handle-accepted
yarn real-clean
We assume now that an outgoing Offer has been sent to a Zotero service node and it will send some metadata back for the toot:
yarn demo-metadata
Process the incoming metadata and update the Wiki
yarn handle-inbox
yarn real-clean
We assume now that an outgoing Offer has been sent to a Zotero service node and it will send some metadata back for the toot:
yarn demo-metadata-reject
Process the incoming metadata and update the Wiki
yarn handle-inbox
Show the summary of what just happened:
$ yarn -s cache-admin summary
urn:uuid:6d21a2ae-df59-40d9-999c-18e19277d21a Announce
from: https://mastodon.social/@patrickhochstenbach
object: https://mastodon.social/@patrickhochstenbach/112891078566219289
updated: Mon Sep 30 2024 08:47:17 GMT+0200 (Central European Summer Time)
Show the complete trace of the urn:uuid:6d21a2ae-df59-40d9-999c-18e19277d21a Announce:
$ yarn -s cache-admin summary urn:uuid:6d21a2ae-df59-40d9-999c-18e19277d21a
urn:uuid:6d21a2ae-df59-40d9-999c-18e19277d21a Announce
from: https://mastodon.social/@patrickhochstenbach
object: https://mastodon.social/@patrickhochstenbach/112891078566219289
updated: Mon Sep 30 2024 08:47:17 GMT+0200 (Central European Summer Time)
urn:uuid:87c82bf0-c632-4091-bd7c-9e76636eb028 View
from: https://mycontributions.info/service/m/profile/card#me
object: https://mastodon.social/@patrickhochstenbach
updated: Mon Sep 30 2024 08:47:17 GMT+0200 (Central European Summer Time)
original: urn:uuid:6d21a2ae-df59-40d9-999c-18e19277d21a
urn:uuid:cad1dd05-6e73-4290-afd1-cdbc8aca3f1c View
from: https://mycontributions.info/service/m/profile/card#me
object: https://wiki.mycontributions.info/en/researcher/orcid/0000-0001-8390-6171
updated: Mon Sep 30 2024 08:47:17 GMT+0200 (Central European Summer Time)
original: urn:uuid:6d21a2ae-df59-40d9-999c-18e19277d21a
urn:uuid:24a5bd9d-663b-44bb-b13f-85a91f767d5f Offer
from: https://mycontributions.info/service/m/profile/card#me
object: https://www.faz.net/aktuell/feuilleton/debatten/the-digital-debate/shoshan-zuboff-on-big-data-as-surveillance-capitalism-13152525.html
updated: Mon Sep 30 2024 08:47:17 GMT+0200 (Central European Summer Time)
original: urn:uuid:6d21a2ae-df59-40d9-999c-18e19277d21a
urn:uuid:75806b42-41f5-46fb-8519-6e964c93c19e Offer
from: https://mycontributions.info/service/m/profile/card#me
object: https://journal.code4lib.org/articles/17823
updated: Mon Sep 30 2024 08:48:28 GMT+0200 (Central European Summer Time)
original: urn:uuid:6d21a2ae-df59-40d9-999c-18e19277d21a
urn:uuid:ef99b36a-5896-46ee-b164-2da1467f6a35 Announce
from: https://mycontributions.info/service/x/profile/card#me
object: https://mycontributions.info/service/x/result/2024/08/14/9a3b6978a49f9aaf055181e5993c5d89.json
updated: Mon Sep 30 2024 08:49:00 GMT+0200 (Central European Summer Time)
original: urn:uuid:6d21a2ae-df59-40d9-999c-18e19277d21a
urn:uuid:c6fa001c-8a5e-4c89-8c46-b8a37824cdfe Offer
from: https://mycontributions.info/service/m/profile/card#me
object: urn:uuid:c3e05e81-3bb0-45fd-bcfc-7e8cf1ad3e43
updated: Mon Sep 30 2024 08:49:01 GMT+0200 (Central European Summer Time)
original: urn:uuid:6d21a2ae-df59-40d9-999c-18e19277d21a
urn:uuid:4c1e963f-fc68-45db-95c6-e6e2e4c15c7f Announce
from: https://wiki.mycontributions.info/profile/card#me
object: https://wiki.mycontributions.info/en/researcher/orcid/0000-0001-8390-6171
updated: Mon Sep 30 2024 08:49:01 GMT+0200 (Central European Summer Time)
original: urn:uuid:6d21a2ae-df59-40d9-999c-18e19277d21a
urn:uuid:169cd8ce-e6a5-4bab-a94e-dcb61299e6ee Announce
from: https://mycontributions.info/service/m/profile/card#me
object: urn:uuid:ab20087b-7b35-49f4-a42e-f73b7916c0ce
updated: Mon Sep 30 2024 08:49:01 GMT+0200 (Central European Summer Time)
original: urn:uuid:6d21a2ae-df59-40d9-999c-18e19277d21a
LOG4JS
Log4js logging output. One of:
errorinfodebugtrace
DEMO_MODE
Used to switch off some of the claimbot services:
NO_TOOTS: the generated toots will not be sent to MastodonNO_WIKI: the generated updated wiki page will not be submitted
Combine multiple values with a pipe symbol |.
DEMO_PROFILE
Provide a fixed location for a researcher’s Wiki.js profile page, instead of looking up the location via the researcher’s Mastodon profile.
For example:
https://wiki.mycontributions.info/en/researcher/orcid/0000-0000-0000-0010
LDN_SERVER_BASEURL
The base url for the claim bot server which will host an LDN Inbox at:
${LDN_SERVER_BASEURL}/accepted: the claimbot will send Mastodon toots to this inbox${LDN_SERVER_BASEURL}/inbox: the claimbot will wait for metadata service responses in this inbox
LDN_SERVER_OTHER_CONFIG
Configuration which of the LDN inboxes is publicly available, and which validation settings are active. For prodution systems only a inboxWritable for the inbox/ is required. All the other options are optional (for demonstration/debug purposes).
LDN_SERVER_INBOX_CONFIG
Configuration of the sequence of handlers that should be executed to process the inbox.
Important local settings:
- For
@handler/notification_handler/jsonpath_filter.jscheck the value of the$.origin.idif it matched the WebID of the metadata summarizer service
LDN_SERVER_OUTBOX_CONFIG
Configuration of the sequence of handlers that should be executed to process the outbox.
MASTODON CONFIGURATION
MASTODON_URL: mastodon server that hosts the claimbot accountMASTODON_ACCESS_TOKEN: API token for the claimbot accountMASTODON_INBOX_PATH: path to which the toots addressed to the claimbot should be storedMASTODON_LIMIT_NUM: maximum number of toots to collect per claimbot runMASTODON_EXCLUDE_TYPES: list of mastodon toot types to ignoreMASTODON_HANDLER: handler to transform a mastodon toot into an event notificationMASTODON_HANDLER_FEATURE: fixedsplit_links(mastodon toots with multiple URLs will be split into multiple event notifications)MASTODON_SERIALIZE_TYPE: fixednative(which API handler to use to read mastodon toots)
OUTGING MESSAGES
The following settings are for outgoing event notification messages originating from the claim bot.
MASTODON_ORIGIN_ID: the WebID profile of the claim botMASTODON_ORIGIN_NAME: the name of the claim botMASTODON_ORIGIN_INBOX: the URL of the LDN Inbox to contact the claim bot (!important)MASTODON_ORIGIN_TYPE: fixedService
POSTGRES CONFIGURATION
The claim bot relies on a local PostgreSQL database as a cache for incoming and outgoing event notification messages. This cache is required to match incoming toots with the corresponding service result responses from the service hubs in the network.
POSTGRES_HOST: location of the PostgreSQL database (empty: local)POSTGRES_PORTPOSTGRES_DATABASEPOSTGRES_USERPOSTGRES_PASSWORDCACHE_NAME: name of the cache table
WIKIJS CONFIGURATION
WIKIJS_URL: the base url of the WikiJS serviceWIKIJS_ACCESS_TOKEN: API token for the WikiJS serviceWIKIJS_MAX_SIMILIARITY_SCORE: a number between 0 and 1, defined when a WikiJS update needs to be ignore because it looks too much as an existing contributionCONTENT_TAG: this tag will be used in WikiJS as {tag}..{/tag} sections that contain the processed research contributions
VERIFICATION CONFIGURATION
Configuration of the verification service. When activated, the Mastodon profile of the researcher must contain a bidirectional rel="me" link to a verification profile.
VERIFICATION_URL: the base URL for verification profiles (used to recognize this service)VERIFICATION: if set tostrict, then verification is mandatory, otherwise it will be ignored
CLAIM SERVICE CONFIGURATION
EVENTLOG_TRACE_URL: if set, every successful service result of a metadata summary for a toot is sent as an event notification message to this service