/textrequest-sms-chat-demo

Demonstrates JavaScript interaction with the Text Request SMS Chat widget.

Primary LanguageHTML

Text Request SMS Chat Demo

Text Request's SMS Chat widget is an excellent way to generate inbound leads from your website. Engagement is substantially higher than email and contact forms. Information on the SMS Chat widget can be found here. You can sign up for a Text Request account here.

Opening and Closing SMS Chat via JavaScript

If you prefer to toggle the SMS Chat open and closed using your own custom button, you can do that. The steps to do so are:

  1. Go to your SMS Chat settings within Text Request, and uncheck the boxes for "Show on Desktop" and "Show on Mobile". This will hide the SMS Chat button that floats in the lower right-hand corner. This step is optional.

  2. You'll need to place the following JavaScript snippet anywhere between your tags.

<script>
   var chatApi = {};
   openWindow = function () { chatApi.openChatWindow(); };
   closeWindow = function () { chatApi.closeChatWindow(); };
</script>
  1. Add your Text Request SMS Chat JavaScript snippet just before the closing tag. You can find this script on the SMS Chat settings page, located under the Integrations menu option in your Text Request account.
<txr-sms-chat api="{chatApi}" accountid="Your Text Request account ID" chatid="Your Text Request chat ID"></txr-sms-chat>
<script type="text/javascript" src="https://fs.textrequest.com/sms-chat/main.bundle.js"></script>
  1. Add onclick="openWindow()" to a button or link to open the SMS Chat widget. Add onclick="closeWindow()" to a button or link to close the SMS Chat widget if it is open.

Take a look at the openAndCloseChat.html demo page to see an example implementation.