# deep\_link

The query string parameters are <mark style="color:purple;">`ref`</mark> for Messenger and <mark style="color:purple;">`start`</mark> for Telegram.

{% hint style="info" %}
To learn more, please read the official documentation from [Messenger](https://developers.facebook.com/docs/messenger-platform/reference/webhook-events/messaging_referrals/#m-me) and [Telegram](https://core.telegram.org/bots#deep-linking).
{% endhint %}

### <mark style="color:orange;">`deep_link(&block)`</mark>

## **Platforms**

<table><thead><tr><th width="362.78343949044586">Platform</th><th data-type="checkbox">Supported</th></tr></thead><tbody><tr><td>Messenger</td><td>true</td></tr><tr><td>WhatsApp</td><td>false</td></tr><tr><td>Telegram</td><td>true</td></tr></tbody></table>

## Example Links

#### Messenger: [`https://m.me/kogno.io?ref=test`](https://m.me/kogno.io?ref=test1)

#### Telegram: [`https://t.me/KognoBot?start=test`](https://t.me/KognoBot?start=test1)

## Usage

```ruby
class MainContext < Conversation

  def blocks

    deep_link do |value|
      @reply.text("You just clicked on a link with the value #{value}!")
    end

  end
  
end
```

## &#x20;<mark style="color:orange;">`value`</mark> param

This param contains the value passed in the query string, for the example links above, the value is <mark style="color:blue;">`"test"`</mark>

{% hint style="success" %}

## Routing to Context

A deep-link can be handled by other context different than the [default context](/contexts.md#default-context-maincontext), simply by passing the name of an existing context as a part of the parameter value:

**Messenger:** <mark style="color:purple;">`?ref=context_name_some_value`</mark>

**Telegram:** <mark style="color:purple;">`?start=context_name_some_value`</mark>

Read more about this in [Context Routing chapter](/contexts/routing.md#deep-links).
{% endhint %}


---

# 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.kogno.io/contexts/blocks/deep_link.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.
