AD
Boost Your Brand on BlueSky—Exclusive banner space to amplify your reach within the BlueSky community.
BSkyInfo LogoBskyInfo
All ToolsCategoriesCollectionsFeed DirectoryLabeler DirectoryArticlesGuidesGlossaryBluesky SDKsSponsor
Submit
All ToolsCategoriesCollectionsFeed DirectoryLabeler DirectoryGuidesGlossaryArticlesBluesky SDKsSponsorSubmit
  1. SDKs
  2. /C#
  3. /bluesky-net
dariogriffo

bluesky-net

A C# SDK for Bluesky and AT Protocol by dariogriffo

bluesky-net is a C# SDK for building applications with Bluesky and AT Protocol.

GitHub Stats

46stars
14forks
1contributors
1open issues

Dates

Created:April 24, 2023
Last updated:April 27, 2025

README

The following content is from bluesky-net's GitHub repository. All rights reserved by the original author.

NuGet GitHub license

N|Solid

Bluesky.Net

Unofficial .NET implementation of atproto.com

About the target framework

To simplify the development, first versions will target only NET7.0+

Eventually the library will support NET standard 2.0

About the results

The api implements a basic discriminated union pattern for all the results.

The first option of the result is what you expect, the second an error if the HTTP status code is > 2xx

How to use it

1- Install the nuget package

Install-Package Bluesky.Net

2- Add the SDK to your services collection

services.AddBluesky();

3- The SDK can be configured

services
    .AddBluesky(options => {
        options.TrackSession = false;
    });

4- Inject the IBlueskyApi in your code

public class MyClass
{
    private readonly IBlueskyApi _bluesky;
    public MyClass(IBlueskyApi bluesky)
    {
        _bluesky = bluesky;
    } 
}

5 - Call the api

Login command = new("YOUR_HANDLE", "YOUR_PASSWORD");
Multiple<Session, Error> result = await _bluesky.Login(command, CancellationToken.None);

result
    .Switch(
        session => Console.WriteLine(session.Email),
        error => Console.WriteLine(JsonSerializer.Serialize(error)
    );    

6 - Create a post


Multiple<Did, Error> resolvedHandle = await api.ResolveHandle(session.Handle, CancellationToken.None);
        
string text =
        @"Link to Google This post is created with Bluesky.Net. A library to interact with Bluesky. A mention to myself and an emoji '🌅'";
    int mentionStart = text.IndexOf("myself", StringComparison.InvariantCulture);
    int mentionEnd = mentionStart + Encoding.Default.GetBytes("myself").Length;
    CreatePost post = new(
        text,
        new Link("www.google.com", 0, "Link to Google".Length),
        new Mention(resolvedHandle.AsT0, mentionStart, mentionEnd));

    //Create a post
    Multiple<CreatePostResponse, Error> created = await api.CreatePost(post, CancellationToken.None);    

Retries

You can easily plug retries with Polly when registering the api. Install the nuget package

Install-Package Microsoft.Extensions.Http.Polly

Configure your retries:

services
  .AddBluesky()
  .AddPolicyHandler(
      HttpPolicyExtensions
        .HandleTransientHttpError()
        .OrResult(msg => msg.StatusCode == System.Net.HttpStatusCode.ServiceUnavailable)
        .WaitAndRetryAsync(6, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2,retryAttempt))));

Related SDKs

drasticactionsFishyFlip

Fishyflip - a .NET ATProtocol/Bluesky Library

101•C#
a-gubskiyX.Bluesky

Client for Bluesky

46•C#
electricduckbooski

Bluesky cross-poster for inferior services (and a .NET library for ATProto and Bluesky)

4•C#
blowdartidunno.Bluesky

A .NET class library for the Bluesky social network.

70•C#
PassiveModdingatompds

An atproto PDS implementation in .NET (C#)

25•C#
alnkesqAppViewLite

A Bluesky appview focused on low resource consumption

131•C#

Resources

GitHub Repository

License

MIT

Author

dariogriffo
dariogriffo

Activity

Last commit: April 27, 2025
Commit frequency: Unknown

Our Sponsors

Your Brand Here!

50K+ engaged viewers every month

Limited spots available!

📧 Contact us via email🦋 Contact us on Bluesky
BSkyInfo LogoBskyInfo

The Most Comprehensive Bluesky Tools Directory

Stay updated with the latest Bluesky tools and ecosystem news 🦋

Bluesky butterfly logo
Quick LinksSubmit a ToolSponsorAboutLegal Information
ToolsFeed DirectoryLabeler DirectorySchedulingAnalyticsAll ToolsCategoriesCollectionsTags
ResourcesArticlesBluesky GuidesBluesky GlossaryBluesky SDKsBluesky ResourcesSkyRaffleMeida Coverage
Our ProductsRaffleBlueAiTeach ToolsLaiewAI affiliate listFirsto

This website may contain affiliate links

© 2025 BskyInfo. All rights reserved.