Start a conversation

Restricting when Messenger displays on your Help Center

PLAN AVAILABILITY
Free
Inbox
Growth
Scale
Enterprise
NOTE: If you're not sure what plan you're on, sign into the admin area and check the 'Plan' page.

Real-time support can eat up a lot of your resources, so sometimes you want to be able to offer it only at particular times or to specific customers. With a little bit of light editing to your Help Center templates, you can achieve either of these goals.

In this article, we'll go over the changes you need to make to your Help Center templates to only display Kayako Messenger either only at certain times of day or only to users who are logged in.

Restrict when or to whom Messenger is displayed

Whether you want to restrict Messenger by time of day, or by whether or not a user is logged in, the process is virtually the same. First, you'll turn off the switch that automatically displays Messenger. Then you'll generate a Messenger embed code manually. And finally you'll add that code block to your Help Center templates surrounded by a pair of tags that will check either the time of day or whether the user is logged in or not. 

NOTE: To restrict Messenger to, you will need an administrator account with the 'Manage channels' permission.

To restrict Messenger:

  1. Sign into the Help Center. 
  2. Click the Customize button on the top toolbar.
  3. Click Settings and set the Show Messenger toggle to 'No'.
  4. Switch to the admin area, and click Configure under the 'Messenger' heading.
  5. Go through the steps to generate a new Messenger embed code. You can find detailed instructions for that process in our user guide article on the subject.
  6. When you're done customizing Messenger, copy the embed code you generate and drop it in a text file.
  7. Switch back to the Help Center.  
  8. Click Customize again, and then Customize templates.
    IMPORTANT NOTE:  Anytime you're editing Help Center templates, we recommend you save a copy of the existing code before making changes, in case you need to roll back.
  9. From the template dropdown, select 'Footer'.
  10. At the bottom of the template locate the final </div> tag. 
  11. Immediately above that tag, you're going to add one of the following pairs of tags:
    To use a date filter to only display Messenger between 9 am and 7 pm:
    {% if ("now"|date("H") >= 9) and ("now"|date("H") <= 19) %}
    
    {% endif %}
    To use a date filter to only display Messenger only on weekdays:
    {% if ("now"|date("N") >= 1) and ("now"|date("N") <= 5) %}
    
    {% endif %}
    You can change the beginning and ending hours by changing the numerals in the
    {% if %} tag.
    NOTE: Read more about the kinds of parameters you can use with date here in the PHP documentation. 
    To restrict Messenger only to users who are logged into the Help Center:
    {% if current_user is defined %}
    
    {% endif %}
  12. Whichever restriction you're using, your last step is to paste your Messenger embed code block between the {% if %} and {% endif %} tags.
  13. Click the Save button at the top of the customize pane.

And that's it! Your Messenger icon will now only display either during the hours you specified or only to visitors who are logged into your Help Center. 

Choose files or drag and drop files
  1. Amaninder Singh

  2. Posted
  3. Updated
Was this article helpful?
Yes
No