Best answer

Sending tweets to Blue Sky (bsky.app)

  • 7 October 2023
  • 8 replies
  • 1516 views

Userlevel 1

Hi all,

Twitter is falling apart. So I’d like to send tweets to Bluesky (https://bsky.app). Does someone know how it works? I already saw some bots so I assume there must be a way to do it. Do they offer an API?

Thanks!

icon

Best answer by brkld 9 October 2023, 22:05

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

8 replies

Userlevel 7
Badge +14

Hi @brkld 

Good question.

There is no Bluesky Zap app: https://zapier.com/apps

 

Userlevel 1

Hi @Troy Tessalone , 

I found this API: https://atproto.com/blog/create-post

I managed to get it done by adding two “Code By Zapier” steps:

First one: add javascript code:

const url = 'https://bsky.social/xrpc/com.atproto.server.createSession';

const data = {
identifier: inputData['username'], // Input from Zapier, assuming 'username' corresponds to 'BLUESKY_HANDLE'
password: inputData['password'] // Input from Zapier, corresponding to 'BLUESKY_APP_PASSWORD'
};


const response = await fetch(url, {
method: 'POST',
body: JSON.stringify(data), // Sending the data as a JSON string
headers: {
'Content-Type': 'application/json' // Use JSON content type
},
redirect: 'manual'
});

// Check if the response status is OK
if (!response.ok) {
console.error('Failed request', await response.text());
return null;
}

const responseBody = await response.json(); // Parse the JSON response

if (!responseBody.accessJwt) {
console.error('accessJwt not found in the response');
return null;
}

output = {
accessJwt: responseBody.accessJwt
};

needs username and password (app password bluesky > settings > app) as input!

Second one:

 

const secondUrl = 'https://bsky.social/xrpc/com.atproto.repo.createRecord';
const authToken = inputData['token'];

const tweetText = inputData['tweet_text'] + " " + inputData['tweet_url'];
const tweetURL = inputData['tweet_url'];

// Finding the start and end byte positions of the tweetURL within tweetText
const byteStart = Buffer.from(tweetText.slice(0, tweetText.indexOf(tweetURL))).length;
const byteEnd = byteStart + Buffer.from(tweetURL).length;

const recordData = {
"$type": "app.bsky.feed.post",
"text": tweetText,
"createdAt": new Date().toISOString(),
"facets": [
{
"index": {
"byteStart": byteStart,
"byteEnd": byteEnd
},
"features": [
{
"$type": "app.bsky.richtext.facet#link",
"uri": tweetURL
}
]
}
]
};

const postData = {
repo: inputData['username'],
collection: 'app.bsky.feed.post',
record: recordData
};

const postResponse = await fetch(secondUrl, {
method: 'POST',
body: JSON.stringify(postData),
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${authToken}`
}
});

if (!postResponse.ok) {
console.error('Failed request', await postResponse.text());
output = {
success: false,
message: "Failed to create record"
};
return;
}

const postResponseBody = await postResponse.json();
if (!postResponseBody.success) {
console.error('Failed to create record', postResponseBody.message);
output = {
success: false,
message: postResponseBody.message
};
return;
}

output = {
success: true
};

needs token, username, tweet_text, tweet_url as input.

tweet_text is your text and tweet_url is a link I want to include in my tweets to websites. it’s optional and can be removed.

Userlevel 1

Hello,

I’ve made this Zapier integration : 

https://www.bsky-bot.com/

 

It’s not on the store for the moment as it is under review, but when you’ve subscribed to bsky-bot you can try the integration with this link : 
https://zapier.com/developer/public-invite/194875/f59d7dccd0434bc87d91fbf205dd09b6/

 

 

Hoping on your feedback,

Thibault

Userlevel 1

Hello @brkld !


I’ve made this Zapier integration : 

https://unshape.app

 

It’s not on the store for the moment as it is under review, but when you’ve subscribed to Unshape you can try the integration with this link : 
https://zapier.com/developer/public-invite/194875/f59d7dccd0434bc87d91fbf205dd09b6/

 

 

Hoping on your feedback,

Thibault


I’ve made this Zapier integration : 

https://unshape.app

 

It’s not on the store for the moment as it is under review, but when you’ve subscribed to Unshape you can try the integration with this link : 
https://zapier.com/developer/public-invite/194875/f59d7dccd0434bc87d91fbf205dd09b6/

 

I’m trying, but am stuck early. I have Bluesky by Unshape BETA as the starting trigger, but I’m required to Choose an Event… and there are no events to choose from. from.

 

Userlevel 1


I’ve made this Zapier integration : 

https://unshape.app

 

It’s not on the store for the moment as it is under review, but when you’ve subscribed to Unshape you can try the integration with this link : 
https://zapier.com/developer/public-invite/194875/f59d7dccd0434bc87d91fbf205dd09b6/

 

I’m trying, but am stuck early. I have Bluesky by Unshape BETA as the starting trigger, but I’m required to Choose an Event… and there are no events to choose from. from.

 

Hello evoterra,

 

That’s a normal behavior as Bluesky by Unshape only allows creating posts for the moment. It doesn’t have any triggers. If you have ideas of triggers/actions/searches, you can write them here, or at support@unshape.app or as a feature request for Bluesky by Unshape on Zapier!

 

Waiting on your feedback,

Thibault - from Unshape


I’ve made this Zapier integration : 

https://unshape.app

 

It’s not on the store for the moment as it is under review, but when you’ve subscribed to Unshape you can try the integration with this link : 
https://zapier.com/developer/public-invite/194875/f59d7dccd0434bc87d91fbf205dd09b6/

 

I’m trying, but am stuck early. I have Bluesky by Unshape BETA as the starting trigger, but I’m required to Choose an Event… and there are no events to choose from. from.

 

Hello evoterra,

 

That’s a normal behavior as Bluesky by Unshape only allows creating posts for the moment. It doesn’t have any triggers. If you have ideas of triggers/actions/searches, you can write them here, or at support@unshape.app or as a feature request for Bluesky by Unshape on Zapier!

 

Waiting on your feedback,

Thibault - from Unshape

I’m clearly missing something, as surely I need to tell this integration about my Bluesky and Twitter credentials, and I don’t see how to do that in Zapier.

I’m no developer, so I may just be going too early and should wait until everything is baked.

Userlevel 1


I’ve made this Zapier integration : 

https://unshape.app

 

It’s not on the store for the moment as it is under review, but when you’ve subscribed to Unshape you can try the integration with this link : 
https://zapier.com/developer/public-invite/194875/f59d7dccd0434bc87d91fbf205dd09b6/

 

I’m trying, but am stuck early. I have Bluesky by Unshape BETA as the starting trigger, but I’m required to Choose an Event… and there are no events to choose from. from.

 

Hello evoterra,

 

That’s a normal behavior as Bluesky by Unshape only allows creating posts for the moment. It doesn’t have any triggers. If you have ideas of triggers/actions/searches, you can write them here, or at support@unshape.app or as a feature request for Bluesky by Unshape on Zapier!

 

Waiting on your feedback,

Thibault - from Unshape

I’m clearly missing something, as surely I need to tell this integration about my Bluesky and Twitter credentials, and I don’t see how to do that in Zapier.

I’m no developer, so I may just be going too early and should wait until everything is baked.



Everything is written on our website (https://www.unshape.app) :
1. Subscribe to Unshape using the same e-mail you used to create your Unshape account.
2. Head to Zapier - or Make - and choose your trigger. As Bluesky by Unshape does not provide any trigger for the moment, you must choose a trigger from another app.
3. Setup your Bluesky action. There’s only one available for the moment: Create Post. Once you’re here, you’ll have to enter your Bluesky credentials (an app password you generated in Bluesky settings, your username and user email). After that you can add the data you want to map to the different fields, and test your zap.

 

If you follow this instructions, you should be able to automate your Bluesky posts!