https://github.com/manglaneso/blueskyapi
BlueSky API integration for Google Apps Script
https://github.com/manglaneso/blueskyapi
atproto bluesky bluesky-api google-apps-script javascript
Last synced: 4 months ago
JSON representation
BlueSky API integration for Google Apps Script
- Host: GitHub
- URL: https://github.com/manglaneso/blueskyapi
- Owner: manglaneso
- License: mit
- Created: 2024-11-23T12:22:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-23T16:26:03.000Z (over 1 year ago)
- Last Synced: 2025-04-03T10:44:04.066Z (about 1 year ago)
- Topics: atproto, bluesky, bluesky-api, google-apps-script, javascript
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BlueSkyAPI
BlueSky API integration for Google Apps Script
### DISCLAIMER
This is a very early version of the library with a little number of the methods listed in the [AT Protocol XRPC API](https://docs.bsky.app/docs/api/at-protocol-xrpc-api) implemented. Contributions are appreciated!
### Inspiration
Inspiration for this comes from Bradley Momberger's [Twitterlib](https://github.com/airhadoken/twitter-lib) which unfortunately stopped working since Twitter (or X I guess) decided to shut down the v1 Twitter API for non-Enterprise developers, and since I wanter to give Mastodon a try, I wanted some Twitter bots I implemented to live on somewhere else.
### Use
Click the + after Libraries, paste in 1CZLW7OUPIgrr0oblfsNQ5ir-k1sF8jVryUeRj4fb1WoOom-OTSciVq96 (the project key for this script), and add in BlueSkyAPI and select its latest version.
Create a BlueSky app password in your BlueSky PDS and create a BlueSkyAPI object passing the URL and video service URL of your PDS, your BlueSky handle and your app password.
```javascript
let bluesky = BlueSkyAPI.init(serviceUrl, accessToken, identifier, password);
```
After that, with the created BlueSkyAPI object you can start using the different methods:
```javascript
// Upload a video
let uploadMediaInit = bluesky.uploadVideo(videoBlob);
// Get the status of the media upload
let getMedia = bluesky.getJobStatus(jobId, exp);
// Publish a record with the uploaded video attached
let record = bluesky.createVideoRecord("", blobLink, mimeType, altMessage, length, width, height, ["en"]);
// Publish a record with an uploaded image attached
let record = bluesky.createImageRecord(text, imageLink, mimeType, alt, size);
// Publish a text record
let record = bluesky.createRecord(text, langs);
// Upload a blob
let upload = bluesky.uploadBlob(blob);
// List all your records
let upload = bluesky.listRecords();
// Delete a record
let deletedRecord = bluesky.deleteRecord(collection, rkey);
```
### Example of use
You can find an example of use in the [following repo](https://github.com/manglaneso/oraleputosbot/blob/main/src/BlueSkyTriggerService.js).