Enhancing Your Power Automate Bluesky Posts

In my previous blog Automate Posting on Bluesky, I discussed how to use Power Automate to post on Bluesky using their API. Today, we’re taking it a step further by adding links and hashtags to your Bluesky content.

bluesky links

Before we begin

If you haven’t read my previous blog, I recommend starting there. It covers the essentials of posting to Bluesky, including generating a token using an HTTP action and parsing it with the Parse JSON action. Having a valid token is a requirement for creating posts through the Bluesky API.

To add links and hashtags to your posts, first follow the guidance in Automate Posting on Bluesky to get up and running. Once done, you can enhance your content using the info in this article.

Introducing Facets

This is the Bluesky post we’ll be creating. It’s virtually the same content as I generated in Automate Posting on Bluesky, but it now contains a link and hashtag.

Image of the sample Bluesky post

To embed links and hashtags, Bluesky uses a feature called facets, a component of the Authenticated Transfer Protocol (AT Protocol). Facets let you define, link, and represent specific content types, enabling rich, interactive posts.

The Process in Action

Here’s how to employ the HTTP action to create the above post with working links and hashtags. The Method, URI and headers are the same as used in my previous post Automate Posting on Bluesky. Only the JSON payload is different.

Image of the HTTP action to post to Bluesky and add links and hashtags

Here is the JSON to copy & paste to use yourself:

{
"collection": "app.bsky.feed.post",
"repo": "youridentifier.bsky.social",
"record": {
"$type": "app.bsky.feed.post",
"text": "My first Power Automate post #powerautomate",
"createdAt": "@{utcNow()}",
"facets": [
{
"index": {
"byteStart": 9,
"byteEnd": 23
},
"features": [
{
"$type": "app.bsky.richtext.facet#link",
"uri": "https://make.powerautomate.com/"
}
]
},
{
"index": {
"byteStart": 29,
"byteEnd": 43
},
"features": [
{
"$type": "app.bsky.richtext.facet#tag",
"tag": "powerautomate"
}
]
}
]
}
}

Understanding the JSON Content

Byte Indexing

The “byteStart” and “byteEnd” keys in each object in the facet’s array, indicate the start and end positions (in bytes) of the link or hashtag in your text.

Bytes are not always the same as characters. Most keyboard characters are a single byte, but some are not. For example:

£ = 2 bytes
€ = 3 bytes.

You can check whether a character is single or multi-byte here.

Feature Types

The “type” defines whether the feature is a link or a tag. If a link, then the URI (URL) is defined. If a tag then the name of the tag is required and note that this does not include #.

Adding Multiple Features

Simply include more objects to the facets array to add additional links or hashtags.

Dynamic Content

To automate posts using dynamic content, hook the JSON payload together with your data source. When doing this, remember that you’ll need to calculate the position in bytes of the content to which you want to add a link or hashtag. Bear the following in mind:

Summary

With facets, you can enrich your Bluesky posts by embedding links and hashtags seamlessly. Once you’ve mastered the basics, automating dynamic content becomes straightforward. Dive in and start experimenting. Your Bluesky posts are about to get a lot more engaging!

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top