Observation, mostly. Also guesswork and trial-and-error, because I never realised these were all in the docs.
The comments in here are from me running lemmy in a VM, and subscribing to a fake community on a VPS (you can mimic a community with a webfinger response and a bunch of static files). The activities sent by lemmy just went to a basic server, that dumped out the JSON files it received.
I mostly made this post so I could point to something when posting about a Ruby script that can be used to interact with lemmy from the command line. This provides the opportunity to learn about ActivityPub, separate from the more complicated applications that currently implement it.
I've seen this happen occasionally, but it doesn't always look great, and relies on them having heard of Lemmy in the first place, obvs.