> For the complete documentation index, see [llms.txt](https://degreetpro.gitbook.io/nestgram/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://degreetpro.gitbook.io/nestgram/config/controller-helper-class.md).

# Controller Helper class

## Build a bot link

Sometimes you need to build a **bot link** (e.g. **referral link** to the bot). Create **ControllerHelper class instance** and pass **Api** **class** to it. Then call `.getBotLink` method

{% hint style="info" %}
You can read more about Api class [here](/nestgram/config/api-class.md)
{% endhint %}

{% hint style="info" %}
.getBotLink takes argument: run parameters for **/start command** (optional)
{% endhint %}

{% code title="app.controller.ts" %}

```typescript
import { OnCommand, Controller, GetApi, Api, ControllerHelper, UserId } from 'nestgram';
import { AppService } from './app.service';

@Controller()
export class AppController {
  @GetApi() api: Api;
  controllerHelper: ControllerHelper = new ControllerHelper(this.api);

  constructor(private readonly appService?: AppService) {}

  @OnCommand('start')
  async start(@UserId() userId: number): Promise<string | undefined> {
    const link: string | undefined = this.controllerHelper.getBotLink(userId.toString());
    return link;
  }
}
```

{% endcode %}
