# Pin & unpin messages

{% tabs %}
{% tab title="TypeScript" %}

```typescript
import { IContext, IMessage } from 'degreet-telegram/src/types'

bot.command('start', async (ctx: IContext): Promise<any> => {
  try {
    const msg: IMessage = await ctx.answer.send('Hello!')
    await ctx.answer.pin(msg.message_id)
    await ctx.answer.unpin(msg.message_id)
  } catch (e: any) {
    console.error(e)
  }
})
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
bot.command('start', async (ctx) => {
  try {
    const msg = await ctx.answer.send('Hello!')
    await ctx.answer.pin(msg.message_id)
    await ctx.answer.unpin(msg.message_id)
  } catch (e) {
    console.error(e)
  }
})
```

{% endtab %}
{% endtabs %}
