如何在用于网站的Facebook Messenger Chat中添加get_started代码?

时间:2019-05-26 22:51:40

标签: javascript php json curl facebook-javascript-sdk

我想添加以下代码:

curl -X POST -H "Content-Type: application/json" -d '{
  "get_started": {"payload": "<postback_payload>"}
}' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=<PAGE_ACCESS_TOKEN>"

在下面的代码中的某处,以便实现facebook Messenger聊天的get_started:;

{if $pk_fbchat_init && $pk_fbchat_app_id && $pk_fbchat_locale}
<script>
  window.fbAsyncInit = function() {ldelim}
    FB.init({ldelim}
      xfbml:true,version:'v3.2'
    {rdelim});
  {rdelim};
  (function(d, s, id) {ldelim}
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "https://connect.facebook.net/{$pk_fbchat_locale}/sdk/xfbml.customerchat.js";
  fjs.parentNode.insertBefore(js, fjs);
{rdelim}(document, 'script', 'facebook-jssdk'));
</script>


    <div 
        class="fb-customerchat" 
        attribution="setup_tool" 
        page_id="{$pk_fbchat_page_id}"
        logged_in_greeting = "20% Discount Coupon, Enter Mobile no. Get Voucher Code Now"
        logged_out_greeting = "20% Discount Coupon, Enter Mobile no. Get Voucher Code Instantly"
        minimized="false">
    </div>
{/if}

以上内容位于.tpl文件中,如果需要,我不知道在哪里使用Literal。如果存在脚本标签,curl是否必须为原义?

0 个答案:

没有答案