Javascript 网站上的Facebook Messenger为每个页面提供不同的问候语

Javascript 网站上的Facebook Messenger为每个页面提供不同的问候语,javascript,facebook,facebook-messenger,Javascript,Facebook,Facebook Messenger,我只是想知道是否可以根据您在网站上的页面在messenger上设置不同的问候语 我知道,当我们在facebook上设置嵌入代码时,我们可以预定义欢迎消息 这就是它的设置方式。如果您知道要显示消息的消息和页面,可以使用else-If条件控件来显示消息,如: if (location.href == x.com) { // set message here } else if (location.href == y.com) { // set alternative here } 天哪!又想

我只是想知道是否可以根据您在网站上的页面在messenger上设置不同的问候语

我知道,当我们在facebook上设置嵌入代码时,我们可以预定义欢迎消息


这就是它的设置方式。

如果您知道要显示消息的消息和页面,可以使用else-If条件控件来显示消息,如:

 if (location.href == x.com) {
 // set message here
} else if (location.href == y.com) {
// set alternative here 
}

天哪!又想得太多了。。不知道会这么容易。我甚至试图建立一个聊天机器人来实现这一点。在初始化聊天时,可以将登录和退出问候语设置为属性

<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>

谢谢你的回答,但我希望是这么简单。我需要以某种方式将自定义消息推回到fb messenger中,这是我找不到的部分。将函数记录为常量并在fb messenger中分配成本?