RSS feed to BlueSky Cards Post

I just figured out the recipe to post Cards to Bluesky, thanks to some of the threads here (now closed so I can’t comment) But it was based on this thread:

Essentially, I watch our own RSS feed for new items, grab the image URL, then run the Create session to get the token required. Then upload the image, create the JSON then post to Bluesky.
It was just down to the syntax in the JSON module, add the $type and $link parameters as described, no need to escape.

The additional step is to extract the image url from the RSS using an HTTP Get a file request which will give you the blob and the size parameters.

Here’s my format for the image in the RSS feed (need to set the property in the opening RSS tag)

 <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" >
.....
..... Inside <item>
 <media:content medium="image" url="myurl" /> - must be under 1mb

Then you create the JSON structure using the generate option, (paste the code below) module [4]

{
  "repo": "your_did_here", the did returned in the headers of your create session Http call [3]
  "collection": "app.bsky.feed.post", 
	"record": {
		"text": "Just a test post via API",
		"createdAt": "2024-05-13T14:52:21.422Z" 
  "$type": "app.bsky.feed.post",
  "text": "post which embeds an external URL as a card",  headline or whatever from [7]
  "createdAt": "now",
  "embed": {
    "$type": "app.bsky.embed.external",
    "external": {
      "uri": "https://bsky.app", URL of item from RSS feed [7]
      "title": "Bluesky Social", from item in  RSS Feed [7]
      "description": "See what's next.", from item in RSS Feed [7]
      "thumb": {
        "$type": "blob",
        "ref": {
          "$link": "slink from sending the image to BSky HTTP post"  in HTTP module [9]
        },
        "mimeType": "image/png", - you can set this from the data:blob:mimeType [8]
        "size":  map to data: blob : size  from image to BS [8]
      }
    }
  }
}
}

Hope this helps somebody

1 Like

I followed your recipe but keep getting this error :sweat_smile:

Error: 400 Bad Request

  • {“error”:“InvalidRequest”,“message”:“Invalid app.bsky.feed.post record: Record/embed/external/thumb should be a blob ref”}

Here is what I got as Record/embed/external/thumb
“thumb”: {
“$type”: “{{27.data.blob.$type}}”,
“ref”: {
“$link”: “{{27.data.blob.ref.$link}}”
},
“mimeType”: “{{27.data.blob.mimeType}}”,
“size”: “{{27.data.blob.size}}”
}

Any chance you had it also?

No I dont think I saw that one - here’s how I mapped them:

Same here
Is there a way you share the complete scenario?

Running into the same issue with “Error: 400 Bad Request
{“error”:“InvalidRequest”,“message”:“Invalid app.bsky.feed.post record: Record/embed/external/thumb should be a blob ref”}” at the final step.

Has anyone had any luck creating link cards via the API?

Okay, I was able to get it to work. My issue was I had quote marks around the file size value.