Broadcast (broadcast v0.2.0)
Broadcast to multiple social media domains simultaneously through a unified interface.
Summary
Functions
Posts a given status message to both Mastodon and Bluesky platforms.
Posts a status update to the Bluesky social network.
Posts a status update to the Mastodon social media platform.
Functions
Posts a given status message to both Mastodon and Bluesky platforms.
Parameters
The function takes a map containing the necessary parameters for posting:
:status
- a string representing the status message to be posted.:mastodon_access_token
- the access token for the Mastodon account for authentication.:bluesky_handle
- the handle (username) of the Bluesky account to post the status.:bluesky_password
- the password for the Bluesky account for authentication.:media_paths
- Optional. A list of file paths to images to be uploaded with the status.:mastodon_reply_id
- Optional. The ID of a Mastodon post to reply to.:bluesky_reply
- Optional. A map containing details of a Bluesky post to reply to::root
- A map with:uri
and:cid
of the root (original) post in the thread.:parent
- A map with:uri
and:cid
of the parent post to reply to directly.
Examples
iex> Broadcast.post_all(%{ ...> status: "Hello World!", ...> mastodon_access_token: "your_mastodon_token", ...> bluesky_handle: "your_bluesky_handle", ...> bluesky_password: "your_bluesky_password" ...> }) {:ok, [{:ok, "{"id": "123"}"}, {:ok, "{"uri": "at://did:123/post/123"}"}]}
iex> Broadcast.post_all(%{ ...> status: "Hello World with an image!", ...> mastodon_access_token: "your_mastodon_token", ...> bluesky_handle: "your_bluesky_handle", ...> bluesky_password: "your_bluesky_password", ...> media_paths: ["path/to/image.jpg"] ...> }) {:ok, [{:ok, "{"id": "123"}"}, {:ok, "{"uri": "at://did:123/post/123"}"}]}
iex> Broadcast.post_all(%{ ...> status: "This is a reply!", ...> mastodon_access_token: "your_mastodon_token", ...> bluesky_handle: "your_bluesky_handle", ...> bluesky_password: "your_bluesky_password", ...> mastodon_reply_id: "109372843234", ...> bluesky_reply: %{ ...> root: %{uri: "at://did:123/app.bsky.feed.post/1234", cid: "bafyreic..."}, ...> parent: %{uri: "at://did:123/app.bsky.feed.post/1234", cid: "bafyreic..."} ...> } ...> }) {:ok, [{:ok, "{"id": "123"}"}, {:ok, "{"uri": "at://did:123/post/456"}"}]}
Posts a status update to the Bluesky social network.
Parameters
handle
: a string representing the user identifier on the Bluesky platform.password
: a string containing the user password for authentication.status
: a string representing the status update to be posted.media_paths
: Optional list of file paths to images to be uploaded with the status. Defaults to an empty list.reply
: Optional map containing reply information with root and parent posts. Required fields for each:root
: Map with:uri
and:cid
of the root post in the thread.parent
: Map with:uri
and:cid
of the parent post to reply to directly.
Examples
iex> Broadcast.post_bluesky_status("your_user_handle", "your_password", "Hello, Bluesky!") {:ok, "{"uri": "at://did:123/post/123"}"}
iex> Broadcast.post_bluesky_status("your_user_handle", "your_password", "Hello with image!", ["path/to/image.jpg"]) {:ok, "{"uri": "at://did:123/post/123"}"}
iex> reply_info = %{ ...> root: %{uri: "at://did:123/app.bsky.feed.post/1234", cid: "bafyreic..."}, ...> parent: %{uri: "at://did:123/app.bsky.feed.post/1234", cid: "bafyreic..."} ...> } iex> Broadcast.post_bluesky_status("your_user_handle", "your_password", "This is a reply!", [], reply_info) {:ok, "{"uri": "at://did:123/post/456"}"}
Posts a status update to the Mastodon social media platform.
Parameters
access_token
- The bearer token used for authentication with the Mastodon API.status
- The string representing the status update to be posted.media_paths
- Optional list of file paths to images to be uploaded with the status.in_reply_to_id
- Optional ID of a status to reply to.
Examples
iex> Broadcast.post_mastodon_status("your_access_token", "Hello, Mastodon!") {:ok, "{"id": "123"}"}
iex> Broadcast.post_mastodon_status("your_access_token", "Hello, Mastodon!", ["path/to/image.jpg"]) {:ok, "{"id": "123"}"}
iex> Broadcast.post_mastodon_status("your_access_token", "This is a reply!", [], "109372843234") {:ok, "{"id": "123"}"}