# Messenger Configuration

{% hint style="warning" %}
Before configuring this section, you must have an App created in Meta and a Facebook Page. See the instructions [here](https://developers.facebook.com/docs/messenger-platform/getting-started/app-setup).
{% endhint %}

The configuration file for Messenger is located at `config/platforms/messenger.rb`

```ruby
Kogno::Application.configure do |config|
  
  config.messenger.graph_url = "https://graph.facebook.com/v2.6/me"

  config.messenger.pages = {
    "YOUR_FANPAGE_ID" => {
      name: "YOUR_FANPAGE_NAME",
      token: "YOUR_ACCESS_TOKEN"
    },
    # "YOUR_2ND_FANPAGE_ID" => {
    #   name: "YOUR_2ND_FANPAGE_NAME",
    #   token: "YOUR_2ND_ACCESS_TOKEN"
    # }
  }

  config.messenger.webhook_route = "/webhook_messenger"
  config.messenger.webhook_verify_token = "<YOUR_VERIFY_TOKEN>"
  
  config.routes.post_comment = :main

  config.routes.recurring_notification = :main

  config.messenger.whitelisted_domains = [
    "kogno.io"
  ]

  config.messenger.persistent_menu =  [
    {
      locale: :default,
      composer_input_disabled: false,
      call_to_actions: [
        {
          title: "Title",
          type: :postback,
          payload: "your_context/a_payload_in_the_context"
        },
        {
          title: "Title2",
          type: :postback,
          payload: "your_payload"
        }
      ]
    }
  ]

  config.messenger.welcome_screen_payload = "GET_STARTED"

  config.messenger.greeting = [
    {
      locale: :default,
      text: "Hello word."
    }
  ]

  config.messenger.ice_breakers = [
    {
      question: "Question 1?",
      payload: "context/payload"
    },
    {
      question: "Question 2",
      payload: "payload_two"
    }
  ]  

end
```

### Field Description

<table><thead><tr><th width="292.88692506848037">Configuration</th><th>Description</th></tr></thead><tbody><tr><td><code>config.messenger.graph_url</code></td><td>Facebook Graph Url</td></tr><tr><td><code>config.messenger.pages</code></td><td>One or more Facebook Pages can be configured and run under the same project.</td></tr><tr><td><code>config.messenger.webhook_route</code></td><td>The CallBack URL path where the Messenger Platform will send notifications. <br>Read the more about this <a href="https://developers.facebook.com/docs/messenger-platform/webhooks">here</a>.</td></tr><tr><td><code>config.messenger.webhook_verify_token</code></td><td>Messenger Platform token for <a href="https://developers.facebook.com/docs/messenger-platform/webhooks#verification-requests">verification request</a>.</td></tr><tr><td><code>config.routes.post_comment</code></td><td>Configure the default context which will handle a message from a Post Commend. <a href="https://developers.facebook.com/docs/messenger-platform/discovery/private-replies/">Read more</a></td></tr><tr><td> <code>config.messenger.persistent_menu</code></td><td><p><a href="https://developers.facebook.com/docs/messenger-platform/send-messages/persistent-menu">The persistent menu</a> allows you to have an always-on user interface element inside Messenger conversations. <br></p><p>To activate/deactivate it run:</p><p> <code>kogno messenger menu on|off</code></p></td></tr><tr><td><code>config.messenger.welcome_screen_payload</code></td><td>The default postback payload for  the <a href="https://developers.facebook.com/docs/messenger-platform/discovery/welcome-screen/">Get Started button</a>. <br><br>To activate/deactivate it run<br><code>kogno messenger get_started on|off</code></td></tr><tr><td><code>config.messenger.greeting</code></td><td><a href="https://developers.facebook.com/docs/messenger-platform/reference/messenger-profile-api/greeting/">The greeting property</a> of your bot's Messenger profile allows you to specify the greeting message people will see on the welcome screen of your bot. <br><br>To activate/deactivate it run<br><code>kogno messenger greeting on|off</code></td></tr><tr><td><code>config.messenger.whitelisted_domains</code></td><td><p>Messenger <a href="https://developers.facebook.com/docs/messenger-platform/reference/messenger-profile-api/domain-whitelisting/">whitelisted domains</a>. </p><p>After modifying this you should run this command <code>kogno messenger update_whitelisted_domains</code></p></td></tr><tr><td><code>config.messenger.ice_breakers</code></td><td><p><a href="https://developers.facebook.com/docs/messenger-platform/send-messages">Ice Breakers</a> provide a way for users to start a conversation with a business with a list of frequently asked questions.</p><p><br>To activate/deactivate it run<br><code>kogno messenger ice_breakers on|off</code></p></td></tr></tbody></table>


---

# 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/getting-started/messenger-configuration.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.
