簡體   English   中英

單擊按鈕打開 Salesforce 客戶聊天支持的聊天窗口

[英]On button click open the chat window for Salesforce customer chat support

我正在為我的網站使用 Salesforce 實時客戶聊天支持。 現在我想要點擊任何自定義按鈕,比如說聯系,我想打開聊天窗口。 請幫我解決這個問題。

<style type='text/css'>
  .embeddedServiceHelpButton .helpButton .uiButton {
    background-color: #005290;
    font-family: "Arial", sans-serif;
  }

  .embeddedServiceHelpButton .helpButton .uiButton:focus {
    outline: 1px solid #005290;
  }
</style>

<script type='text/javascript' src='https://service.force.com/embeddedservice/5.0/esw.min.js'></script>
<script type='text/javascript'>
  var initESW = function(gslbBaseURL) {
    embedded_svc.settings.displayHelpButton = true; //Eller
    embedded_svc.settings.enabledFeatures = ['LiveAgent'];
    embedded_svc.settings.entryFeature = 'LiveAgent';

    embedded_svc.init('https://eu26.salesforce.com', 'https:

      //elsewhere.force.com

      /
      liveAgentSetupFlow ',gslbBaseURL,'
      0x xxxxxx ','
      Chatteam ',

      {
        baseLiveAgentContentURL: 'https://c.la1-c2-fra.salesforceliveagent.com

          /
          content ',deploymentId: '
        5 xxx ',buttonId: '
        5 xxx ',baseLiveAgentURL: 

        'https://d.la1-c2-fra.salesforceliveagent.com/chat',
        eswLiveAgentDevName:

          'Chatteam',
        isOfflineSupportEnabled: true
      });
  };

  if (!window.embedded_svc) {
    var s =

      document.createElement('script');
    s.setAttribute('src',

      'https://eu26.salesforce.com/embeddedservice/5.0/esw.min.js');
    s.onload =

      function() {
        initESW(null);
      };
    document.body.appendChild(s);
  } else

  {
    initESW('https://service.force.com');
  }
</script>

我已經使用上面的代碼集成了客戶聊天。 單擊以查看圖像以便更好地理解。

我通過使用一些簡單的 jQuery 找到了解決方案,請在下面找到代碼:

$("Your_button_class").click(function(){
    $('.helpButtonEnabled').trigger("click");
});

.helpButtonEnabled它是 Salesforce 按鈕的類。 它對我來說絕對完美。

embedded_svc.settings.displayHelpButton = false; //

    <input type="button" name="button" value="OpenChat" onclick="startChat()">
    
    function startChat() {
            embedded_svc.liveAgentAPI.startChat({
                directToButtonRouting: {
                    buttonId: "xxxxxxxx",
                    // userId: “”,
                    fallback: true
                },
                extraPrechatInfo: [],
                extraPrechatFormDetails: []
            });
        }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM