aboutsummaryrefslogtreecommitdiff

Communique

Communique is a self-hosted, automated content publishing platform for ActivityPub that runs as a standalone binary. It handles all the necessary (and annoying) ActivityPub stuff like inboxes, outboxes, HTTP request signing/verification, WebFinger, persistence, delivery, etc.

Imagine mastodon, but for bots instead of humans.

Demo

With communique it's easy to expose an RSS/atom feed as an ActivityPub actor, which can be followed by any other actor in the fediverse (like from a mastodon account). Let's walk through a quick example to show how it works.

Example

Given a configuration file like this:

domain = "https://example.com"

[[handlers]]
name = "sample"
exec = "sample-cgi-handler.sh"
interval = "5s"
dedupWindow = "30s"

And a sample-cgi-handler.sh like:

1
2
3
4
5
6
7
8
9
#!/bin/bash
echo "Content-type: application/atom+xml"
echo ""
echo '<feed xmlns="http://www.w3.org/2005/Atom">
    <entry>
    <content>example content</content>
    </entry>
</feed>'
exit 0

Communique will execute sample-cgi-handler.sh every 5 seconds, deduplicating the extracted <content/> for a period of 30 seconds. Any unique items that are found are persisted to our actors outbox and delivered to the inbox of all the actors that follow our actor.

Run locally

Run the following steps to see the example above in action.

  1. Clone the repository

    git clone https://git.capotej.com/capotej/communique
    
  2. Go to the directory

    cd communique
    
  3. Compile and run it (feel free to click Deny on any firewall warnings)

    go run main.go
    
  4. In another terminal, you can now see the actor page

    curl -H 'Accept: application/json' http://localhost:8080/actors/sample |  python3 -m json.tool
    
  5. And their outbox

    curl -H 'Accept: application/json' http://localhost:8080/actors/sample/outbox |  python3 -m json.tool
    

If this were running on a real domain, like "https://example.com", we would now be able to follow this actor at @sample@example.com from any ActivityPub service and see its posts on our timeline.

Installation

  1. Clone the repository

    git clone https://git.capotej.com/capotej/communique
    
  2. Go to the directory

    cd communique
    
  3. Build it

    go build
    
  4. Deploy the binary wherever you want

    ./communique -c my-config.toml
    

Build Dependencies

  • Go 1.19 (or higher).

Runtime Dependencies

  • SSL/TLS Proxy (like apache2 or nginx with letsencrypt)

systemd template

proxy configuration

apache

nginx

coming soon

helm

coming soon

API

Handler scripts

Communique uses CGI as the API between itself and your scripts. These scripts are only run internally and are never executed from a TCP request.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and
"OPTIONAL" in this document are to be interpreted as described in
RFC 2119.

Your CGI script MUST emit a valid CGI response.

Your CGI script reponse MUST be of one of these content types:

  • application/atom+xml
  • application/rss+xml

Your CGI script reponse MUST be an RSS or ATOM feed (or at least something gofeed can parse)

See sample-cgi-handler.sh for an example