Search code examples
javascriptfacebookfacebook-messenger

Facebook Messenger on website with different greeting message for each page


I am just wondering if it is possible to set a different greeting message on messenger depending on the page you are on the website?

I know that we can have welcome message predefined when we set up for embed code on facebook.

https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin/ This was how it was set up.


Solution

  • Gosh! Overthinking again.. Didn't know it would be that easy. I was even trying to build a chat bot to achieve this. Logged in and out greeting message can be set as attributes when the chat is initialised!

    <div class="fb-customerchat"
      attribution=setup_tool
      page_id="YOUR_FB_PAGE_ID"
      theme_color="#2e3291"
      logged_in_greeting="Hello! We are here to answer any questions you may have."
      logged_out_greeting="Hello! We are here to answer any questions you may have.">
    </div>