CatalogBot is a bidirectional link integration between the CatalogIt collection management system and a Discourse forum server.
CatalogBot allows CatalogIt users to create "Discuss this item on our forum" weblinks that, when clicked, will redirect the user to a discussion topic for the item in your Discourse forum, creating the topic if it does not already exist.
Note: This integration uses the CatalogIt API which is subject to your CatalogIt subscription. CatalogIt API access pricing is available at https://www.catalogit.app/pricing
This integration was created for the Autralian Computer Museum Society and is released under the GPLv3.
Thanks to Phillip Quinn <Phillip.Quinn@acms.org.au> and Sebastian Boell <sebastian.boell@acms.org.au> from the ACMS for support with designing and testing this integration.
The integration can be run locally or via Docker.
It is recommended to run this integration from within a Python 3.10 virtualenv for development purposes. A requirements.txt is provided.
Refer to the .environ.example file to configure the integration.
Start the server by running the server.py module.
For production usage, a CatalogBot Docker image is available at https://hub.docker.com/r/linuxdojo/catalogbot
Create a Discourse API user with full global permissions and specify the below env vars to start the CatalogBot integration:
docker run -it \
-e CIT_ACCOUNT_ID=YOUR_ACCOUNT_ID \
-e DISCOURSE_API_URL="https://YOUR_DISCOURSE_SITE_DOMAIN_NAME" \
-e DISCOURSE_API_USERNAME="YOUR_DISCOURSE_API_USER" \
-e DISCOURSE_API_KEY="YOUR_DISCOURSE_API_KEY" \
-e DISCOURSE_CATEGORY="Our CatalogIt Collection" \
-e INT_BASE_URL="YOUR_INTEGRATION_URL" \
-e INT_BIND_HOST="0.0.0.0" \
-e INT_BIND_PORT=80 \
-p 80:80 \
linuxdojo/catalogbot
Where:
CIT_ACCOUNT_IDis your CatalogIt account ID.DISCOURSE_CATEGORYis the Category under which new Discourse forum topics are auto-created for CatalogIt Entries (this Category will be auto-created if it doesn't exist)INT_BASE_URLis the HTTP URL that resolves to the host and port on which this integration is running, eghttp://my.serverorhttp://my.server:8080. Note that if you use a port other that 80, then you must specify the same port in the left most integer value of the-p, option, eg-p 8080:80
In CatalogIt, create Weblinks for your Entries with name Discuss this item on our forum, and value INT_BASE_URL/UUID where UUID is a randomly generated version 4 UUID (you can generate these here, or from within in a spreadsheet app, etc).
Clicking the new Weblink in CatalogIt forwards the user to the Discourse topic discussing the item.
If no topic exists yet, the user is shown a short confirmation page for the item with a "Start the discussion" button. Pressing it creates the topic and forwards them to it. The topic will contain the title of the entry, an image if present in the entry, and a link back to the CatalogIt entry itself.
The confirmation step exists because a topic must only be created when a person asks for one. Following the weblink creates nothing, so search crawlers and other automated visitors cannot fill the forum with topics nobody requested.
Three independent measures, since none is sufficient alone:
robots.txtdisallows everything, which turns away well-behaved crawlers.- Requests whose User-Agent matches
CRAWLER_USER_AGENTSinserver.pyare refused. Note that not every crawler is honest or obvious:GoogleOthercontains no "bot" substring. - Topics are only created by POSTing the confirmation form, which carries a signed, expiring token. Anything that merely fetches the weblink creates nothing.
As a backstop, INT_MAX_NEW_TOPICS_PER_HOUR (default 20) caps how many topics can be created in a rolling hour. Reaching the cap is logged as an ERROR and further attempts are refused until it drains.