> For the complete documentation index, see [llms.txt](https://docs.bitcart.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bitcart.ai/examples/atomic-tip-bot.md).

# Atomic Tip Bot

Atomic Tip Bot is a bot which allows you to tip other users on telegram. It is a great example of Bitcart usage.

To get some funds to tip, user needs to deposit, which means generating an address and checking status of payment. We can use Bitcart [SDK](https://sdk.bitcart.ai) for that.

But also, users are able to withdraw their funds. It is also possible with the SDK, while this feature isn't available in many other payment processors, as Bitcart is not just a payment processor.

You can use `add_request` SDK method to create a new invoice.

```python
invoice = instances[currency].add_request(amount, description, expire=20160)
```

See the full [example](https://github.com/bitcart/bitcart-sdk/blob/804a6438b1187dff5da538feba16f65a25aae86f/examples/atomic_tipbot/bot.py#L320)

To process payments, we should register an event handler on our `APIManager` to handle the `new_payment` event, which is fired when a request was completed.

```python
async def payment_handler(instance, event, address, status, status_str):
    # bitcart: get invoice info, not necessary here
    # instance.get_request(address)
    if status_str == "Paid":
        # process
```

See the full [example](https://github.com/bitcart/bitcart-sdk/blob/804a6438b1187dff5da538feba16f65a25aae86f/examples/atomic_tipbot/bot.py#L383)

We can use `manager.start_websocket()` to start listening for new events.

If you are interested, read the full explanation at github [here](https://github.com/bitcart/bitcart-sdk/blob/master/examples/atomic_tipbot/README.md) or try the atomic tip bot yourself in [telegram](https://t.me/bitcart_atomic_tipbot)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.bitcart.ai/examples/atomic-tip-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.
