Skip to main content

Overview

This page is the Laravel version of the AT Protocol official bot tutorial. It covers how to implement the same functionality in PHP/Laravel using the laravel-bluesky package instead of TypeScript. The official tutorial uses the lex command to download Lexicon files. With laravel-bluesky, all Lexicons are already bundled via atproto-lexicon-contracts, so this step is not needed. You can accomplish nearly everything through Artisan commands and the HasShortHand trait methods.

Prerequisites

  • The laravel-bluesky package is installed
  • A Bluesky account and app password are ready
See Laravel Bluesky for installation instructions.

Part 1: Basic bot (posting)

Create an Artisan command

Use php artisan make:command to create a bot command.
Edit the generated app/Console/Commands/BotPostCommand.php.

Run manually

Schedule with task scheduler

Add a schedule entry to routes/console.php.
To enable the scheduler, add this cron entry to your server.

Run with GitHub Actions

If you don’t have a server, you can run the bot automatically with GitHub Actions.
Add BLUESKY_IDENTIFIER and BLUESKY_APP_PASSWORD to your repository secrets in GitHub.

Part 2: Reply bot (mention monitoring)

Build a bot that automatically replies to mentions. This section also shows how to generate AI replies.

Fetch notifications and reply to mentions

When the thread root differs from the parent post, fetch the thread using app.bsky.feed.getPostThread and set the correct root. This simplified example uses the parent post as the root.

Schedule polling

Generate AI replies

You can combine the laravel/ai package with the laravel-amazon-bedrock driver to generate context-aware AI replies.
Create an AI agent.
Use the AI agent in the reply command.
See Amazon Bedrock driver for configuration details.

Part 3: Label bot

This corresponds to the labelAsBot function in the official tutorial. Add a self-label to the bot account’s profile to identify it as an automated account.
Run this command once during initial setup. It is independent from the Part 1 and Part 2 commands.

Create the label command

Run the command

Run this command once when you first set up your bot. The label persists on your profile.
!bot is a standard Bluesky self-label. It is recommended for all bot accounts so users and moderation tools can recognize automated accounts.

Other official tutorials

The AT Protocol official tutorials cover several other topics. Here is a summary of how laravel-bluesky covers each one.

Custom feeds

Feed Generator covers building a custom feed generator with Laravel in detail.

OAuth authentication

Socialite explains how to implement OAuth authentication using Laravel Socialite. This is simpler than the official approach.

Social app (statusphere)

A Laravel version of statusphere is available at invokable/statusphere. It is based on an earlier version of statusphere that does not use the lex or tap commands, so it differs slightly from the latest official tutorial.

References

Last modified on May 6, 2026