# Telegram Bot

<figure><img src="/files/jP3SUF7sLGsq4HlTGfUs" alt=""><figcaption><p>The Telegram Bot panel in Settings — paste your BotFather token and authorized user IDs, then toggle which event types notify you.</p></figcaption></figure>

RestocksAIO includes a Telegram bot integration that allows you to receive notifications and interact with your instance through Telegram commands.

## Getting Started

### Step 1: Create a Telegram Bot

1. Open Telegram and search for **@BotFather**
2. Start a conversation with BotFather and send `/newbot`
3. Follow the prompts to choose a name and username for your bot
4. BotFather will provide you with a **bot token** (e.g., `123456789:ABCdefGHIjklMNOpqrsTUVwxyz`)
5. **Save this token** - you'll need it in the next step

### Step 2: Get Your Telegram User ID

1. Search for **@userinfobot** on Telegram
2. Start a conversation with @userinfobot
3. The bot will immediately reply with your **User ID** (a numeric value like `123456789`)
4. **Save this User ID** - you'll need it to authorize yourself

{% hint style="warning" %}
You must add your User ID to the authorized list, otherwise the bot will ignore your messages for security reasons.
{% endhint %}

### Step 3: Configure in RestocksAIO

1. Open RestocksAIO and navigate to **Settings**
2. Click on **Telegram Bot** in the settings sidebar
3. Enter your **Bot Token** in the "Bot Token" field
4. Enter your **User ID** (or multiple IDs separated by commas) in the "Authorized User ID(s)" field
5. Configure notification preferences:
   * **Send Telegram notifications for Bricker Mode sales**: Enable to receive sale notifications
   * **Send Telegram notifications for new offers**: Enable to receive offer detection notifications
   * **Send generated labels to Telegram**: Enable to receive shipping labels as PDF attachments when labels are generated
   * **Send Telegram notifications for application errors**: Enable to forward application errors to Telegram (disabled by default)
6. Click **Save** to save your settings
7. Click **Test Bot** to verify the connection

{% hint style="success" %}
If the test is successful, you'll receive a confirmation message in Telegram. The bot is now ready to use!
{% endhint %}

## Available Commands

Once configured, you can interact with your RestocksAIO instance using these commands:

### `/help`

Shows a list of all available commands.

**Example:**

```
/help
```

**Response:**

```
Available commands:

/info - Instance information
/notifications - Notification toggles
/notify_bricker_sales - Toggle Bricker Mode sales notifications
/notify_offers - Toggle offer detection notifications
/bricker_stats - Bricker stats snapshot
/bricker_start_all - Start all Bricker tasks
/bricker_stop_all - Stop all Bricker tasks
/labels - Single labels — paged, multi-select + Generate (with site & status filters)
/bulk_labels - Bulks — one bulk per page with its contents + Generate (with site & status filters)
/scan - Open a scannable view (UPS rows with tracking) and submit to USS
/label <id> - Look up a single label by OrderID with Generate / Scan actions
/help - Show this help message
```

### `/info`

Retrieves detailed information about your RestocksAIO instance, including:

* **License Key**: Your current license key
* **Subscription**: Your subscription type (Trial, Standard, Premium, or Lifetime)
* **Server Connection**: Whether the instance is connected to the RestocksAIO server
* **Database Status**: Status of the database connection
* **Last Sync**: Time since last synchronization

**Example:**

```
/info
```

**Response:**

```
📊 RestocksAIO Instance Information

🔑 License Key: ABC123XYZ789
💳 Subscription: Premium
🌐 Server Connection: ✅ Connected
💾 Database Status: ✅ Online
🔄 Last Sync: Sync: Just now
```

### `/notifications`

Shows the current notification settings for your RestocksAIO instance with interactive buttons to toggle each setting:

* **Bricker Mode Sales**: Whether notifications for Bricker Mode sales are enabled or disabled
* **Offer Detections**: Whether notifications for offer detections are enabled or disabled
* **Label Notifications**: Whether generated shipping labels are sent as PDF attachments
* **Error Forwarding**: Whether application errors are forwarded to Telegram (disabled by default)

**Example:**

```
/notifications
```

**Response:**

```
🔔 Notification Settings

Bricker Mode Sales: ✅ Enabled
Offer Detections: ✅ Enabled
Error Forwarding: ❌ Disabled

Tap a button to change the setting.
```

The response includes **On/Off buttons** for each notification type. Simply tap the button to toggle the setting - no need to type commands!

{% hint style="info" %}
Notification settings are saved immediately when you tap a button. The bot will confirm your change with a message like "✅ Bricker Mode sales notifications enabled."
{% endhint %}

### `/notify_bricker_sales`

Shows the current status of Bricker Mode sales notifications with interactive **On/Off buttons** to toggle the setting. When enabled, you'll receive notifications whenever a sale is made through Bricker Mode.

**Example:**

```
/notify_bricker_sales
```

**Response:**

```
Bricker Mode sales notifications are currently ✅ On.
```

The response includes **On/Off buttons** - tap the button to change the setting.

### `/notify_offers`

Shows the current status of offer detection notifications with interactive **On/Off buttons** to toggle the setting. When enabled, you'll receive notifications when offers are detected on your listings.

**Example:**

```
/notify_offers
```

**Response:**

```
Offer detection notifications are currently ✅ On.
```

The response includes **On/Off buttons** - tap the button to change the setting.

{% hint style="info" %}
Notification settings are saved immediately when you tap a button and will apply to all future notifications. You can check your current settings at any time using `/notifications`.
{% endhint %}

### `/bricker_stats`

Retrieves comprehensive statistics about your Bricker Mode tasks, including:

* **Controllers**: Running, stopped, and total controller counts
* **Tasks**: Running, stopped, sold, and error task counts
* **Session Sales**: Total sales during the current session
* **Session Errors**: Total errors encountered
* **Queue**: Items currently in queue
* **Lowest Ask**: Items with lowest ask vs. not lowest ask
* **Price Changes**: Price changes in the last 24 hours

The response includes **Start All** and **Stop All** buttons for quick control.

**Example:**

```
/bricker_stats
```

**Response:**

```
📈 Bricker Mode Stats

Controllers: 5 running / 2 stopped / 7 total
Tasks: 12 running / 3 stopped / 8 sold / 1 errors

Session Sales: 8
Session Errors: 1
Queue: 5
Lowest Ask: 10 | Not Lowest: 5
Price Changes (24h): 15
```

### `/bricker_start_all`

Starts all Bricker Mode tasks. This command will initiate all stopped tasks across all controllers.

**Example:**

```
/bricker_start_all
```

**Response:**

```
▶️ Started all Bricker tasks.
```

### `/bricker_stop_all`

Stops all Bricker Mode tasks. This command will halt all running tasks across all controllers.

**Example:**

```
/bricker_stop_all
```

**Response:**

```
⏹ Stopped all Bricker tasks.
```

{% hint style="info" %}
You can also use the **Start All** and **Stop All** buttons that appear when you run `/bricker_stats` for quick access to these controls.
{% endhint %}

## Label Dialog Commands

The Telegram bot mirrors the desktop **Label Dialog** so you can refresh, generate, scan, and inspect labels from your phone. All four commands operate on the same underlying label set the WPF app uses — selecting a row in Telegram also checks it in the desktop UI if you have the window open.

{% hint style="info" %}
**Label notifications must be enabled** (`Send generated labels to Telegram` toggle in Settings → Telegram Bot, or `/notifications` from the bot) for the PDF to land in the chat after `🏷️ Generate`. The chat shown by these commands is interactive regardless.
{% endhint %}

### `/labels`

Opens the **singles** view — every non-bulk label across all your configured sites, paged 5 per page. Each row shows the marketplace, SKU, product name, and size. Tap rows to multi-select, then use the action buttons at the bottom.

<figure><img src="/files/EiRAILVpmUrUG14qn4VP" alt=""><figcaption><p><code>/labels</code> — singles view with multi-select, site + status filters, and the Generate / Scan action buttons.</p></figcaption></figure>

**Filters (cycle buttons):**

* **📍 Site** — cycles `All → Alias → StockX → …` (only sites with currently-loaded singles appear).
* **📋 Status** — cycles `All → ToFullfill → Inhand → Arriving → Packed → InTransit`. Only statuses present in the data appear.

The default sort is by status priority so **ToFullfill** and **Inhand** rows surface first, even when no status filter is set.

**Actions:**

* **🔄 Refresh** — re-pulls sales/bulks from every configured marketplace (StockX, Alias, Klekt, Laced, HypeBoost, Sneakit, WeTheNew, LimitedResell, NordicSneakers, Kickscrew, Onfeet).
* **🏷️ Generate (N)** — generates label PDFs for the N selected rows. With "Send generated labels to Telegram" enabled, the PDFs arrive in this chat right after.
* **📷 Scan (N)** — submits the selected UPS rows with tracking to Scanuss (USS). Non-UPS rows are reported as ineligible. See `/scan` below.
* **Clear selection** / **❌ Close**.

### `/bulk_labels`

Opens the **bulks** view — one bulk per page with its full contents listed (SKU · product name · size for every item). Use the pager to walk through your bulks.

<figure><img src="/files/A9qdZXRLaS4KSf2eYDPU" alt=""><figcaption><p><code>/bulk_labels</code> — one bulk per page, all the contained items listed, with the same Site + Status filters as <code>/labels</code>.</p></figcaption></figure>

Same Site and Status filter cycles as `/labels`. The Generate button generates the displayed bulk's label in one tap — no selection needed because each page **is** a single bulk.

### `/scan`

Opens the same view as `/labels` but pre-filtered to **scannable rows only** — UPS carrier with valid tracking, no `untrackable` placeholders. Identical UPS + tracking gate as the desktop "Send to USS" pill.

<figure><img src="/files/rttcYQJh4EAlGoLx2949" alt=""><figcaption><p><code>/scan</code> — scannable view filtered to UPS rows with tracking. Multi-select rows, then 📷 Scan submits them to USS.</p></figcaption></figure>

Multi-select the rows you want to submit, then tap **📷 Scan (N)**. Each row consumes 1 USS credit. The status line afterwards reports submitted / failed / ineligible counts and, on failure, the rejection reason (e.g. insufficient credits, label URL missing).

{% hint style="warning" %}
USS must be linked to your Discord account first — the bot will reply with the OAuth link if it isn't.
{% endhint %}

### `/label <id>`

Look up a **single label** by its OrderID and act on it directly — no need to scroll through pages.

```
/label 58887372
```

The bot replies with a card showing site, status, SKU, product name, size, tracking, and carrier. For bulks, the contents list is included. The action row at the bottom has **🏷️ Generate label**, **📷 Scan** (only when the row is UPS + tracking eligible), **🔄 Refresh**, and **❌ Close**.

### Site & Status filters in detail

<figure><img src="/files/kljRlLppSekML9LAcNkX" alt=""><figcaption><p>Both filters are cycle buttons — one tap moves to the next value, wrapping back to <code>All</code>. The total row above updates to reflect the filtered count.</p></figcaption></figure>

The filter buttons only include values **actually present** in the current data, so you never click into an empty bucket. Cycling on `/labels` resets pagination back to page 1; cycling on `/bulk_labels` resets to bulk 1.

## Notification Features

### Bricker Mode Sales Notifications

When enabled, you'll receive rich notifications whenever a sale is made through Bricker Mode, including:

* Product name and image
* Site where the sale occurred
* Style code (SKU)
* Size
* **Category** (`Resale`, `Direct`, or `Consign`) — tells you which bricker bucket the sale came from
* Store price and payout information
* Order ID
* Sale timestamp

### Offer Detection Notifications

When enabled, you'll receive notifications when offers are detected on your listings, including:

* Product name and image
* Site where the offer was made
* Style code (SKU)
* Size
* Offer amount and payout
* Profit if accepted
* **Accept Offer button** - Tap to accept the offer directly from Telegram

### Label Notifications

When enabled, you'll receive generated shipping labels as PDF attachments directly in Telegram whenever a label is created, including:

* Site where the label was generated
* File name
* The label file as a PDF attachment

This is useful for quickly accessing your labels from your phone without needing to open the application or navigate to the labels folder.

### Error Forwarding

When enabled (disabled by default), application errors will be automatically forwarded to Telegram, including:

* Error type and function
* Alert level (Warning or Important)
* Error description
* Solution description (if available)
* Stack trace (truncated if too long)

{% hint style="warning" %}
Error forwarding is disabled by default to prevent notification spam. Enable it only if you want to monitor application errors remotely.
{% endhint %}

## Multiple User IDs

You can authorize multiple Telegram users to interact with your bot by entering multiple User IDs separated by commas:

**Example:**

```
123456789,987654321,555666777
```

Each authorized user will be able to use all bot commands and receive notifications.

## Troubleshooting

### Bot Not Responding

* **Check your Bot Token**: Make sure you copied the complete token from BotFather
* **Verify User ID**: Ensure your User ID is correctly entered in the authorized list
* **Test Connection**: Use the "Test Bot" button in settings to verify connectivity
* **Check Bot Status**: Make sure the bot is running (it should start automatically when you save valid settings)

### "Unauthorized" Messages

If you receive no response from the bot, it means your User ID is not in the authorized list:

1. Double-check your User ID using @userinfobot
2. Ensure the User ID is correctly entered in settings (no extra spaces)
3. Save settings and test again

### Connection Errors

If you see connection errors:

* Verify your internet connection
* Check that Telegram is accessible from your network
* Ensure the bot token is valid and hasn't been revoked
* Try stopping and restarting the bot using the Test button

## Security Notes

* **Keep your Bot Token secret**: Never share your bot token publicly
* **Authorized Users Only**: Only users whose IDs are in the authorized list can interact with your bot
* **Regular Updates**: Keep RestocksAIO updated to receive the latest security improvements

## Next Steps

Once your Telegram bot is configured, you can:

* Monitor your instance status remotely using `/info`
* Receive real-time notifications for sales, offers, and errors
* Control Bricker Mode tasks remotely using `/bricker_stats`, `/bricker_start_all`, and `/bricker_stop_all`
* Drive the Label Dialog from your phone with `/labels`, `/bulk_labels`, `/scan`, and `/label <id>` — refresh sales, generate label PDFs, create bulks, and submit UPS labels to USS, all without opening the desktop app
* Toggle notification settings easily using interactive buttons
* Accept offers directly from Telegram notifications
* Interact with your RestocksAIO instance from anywhere


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.restock.gg/features/settings/telegram-bot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
