Post a reply comment as a user on the episode’s comment server
A client-to-server (or c2s) ActivityPub interaction
In this scenario, the podcast client app facilitates logging in as an authenticated user of the ActivityPub server specified in the RSS feed.
In general, this involves the following steps:
- Fetch the root comment url specified in the RSS item
<podcast:socialInteract>
tag - Identify the server implementation (Mastodon/Pleroma etc)
- Have the user log into the server using an OAuth flow
- If server supports c2s posting, post a reply comment using the logged-in user's ActivityPub outbox url and ActivityPub standard c2s Create Activity (if supported)
- Else post the reply comment using the server-specific API (e.g. Publish new status in the Mastodon REST API )
Mastodon example
- Fetch the root comment url specific in the item's
podcast:socialInteract
tag (or a subcomment url) using the ActivityPub Accept header- The Mastodon status id encoded as the last path token in the
"id"
url of the response will be needed later
- The Mastodon status id encoded as the last path token in the
- Determine if this is Mastodon instance using
Fetch instance
- It's Mastodon if the response succeeds, returns an
instance
payload as json, and the
"version"
does not containPleroma
- It's Mastodon if the response succeeds, returns an
instance
payload as json, and the
- Register your client app with the Mastodon server using
Create an application
- Use a minimal OAuth scope such as:
read:accounts write:statuses
- Only needs to be done once per server
- Use a minimal OAuth scope such as:
- Compute the OAuth login url using
Authorize a user
- After logging in, the user will be redirected to the callback you specified
- Use the
code
returned to Obtain an Access Token - Verify the Access Token using
Verify account credentials
- If valid, you'll receive an Account payload
- You can now publish statuses on behalf of the logged-in user
- Post the reply comment with
Publish new status
- Set
content
to the reply comment content from your UI - Set
in_reply_to_id
to the Mastodon root comment (or subcomment) status id obtained earlier
- Set