Table of Contents

Get started

Let's make your first post to Bluesky via the API in under 5 minutes.

Create a .NET project with the idunno.Bluesky nuget package

  1. At the command line run the following commands
    dotnet new console -n HelloBluesky
    cd HelloBluesky
    dotnet add package idunno.Bluesky --prerelease
    

Create a session

  1. Open the Program.cs file in your editor of choice and change its contents to the following code, replacing the "handle" and "password" parameters in the agent.Login() call with your Bluesky handle and password.
using idunno.Bluesky;

using BlueskyAgent agent = new();
await agent.Login(handle, password);
  1. Save the changed file.
Tip

You can create and use an App password instead of your login password.

App Passwords are safer as they allow sign in without granting full access to your Bluesky account.

Create a post

  1. Continue to change Program.cs by adding an additional line to create a post.
    using idunno.Bluesky;
    
    using BlueskyAgent agent = new();
    await agent.Login(handle, password);
    await agent.Post("Hello World from idunno.Bluesky");
    
  2. Save the changed file and exit your editor.
  3. Compile and run your project with the following command
    dotnet run
    

The program should run without any errors, and if you check your own profile (click the Profile link in the app, or on bsky.app) you should see a post that says "Hello World from idunno.Bluesky".

Congratulations, you've just posted from code!

You can @ someone in the post text, add hashtags, or http/https links and they will all get turned into the right type of link. Try it and check in the app.

Next Steps

Tutorials

Detailed concepts