Ability to set chat as offline/Online based on Department affiliantion

Answered

9 Comments

  • Ramin Shokrizadeh
    Zendesk Product Manager

    Hi Jacob,

    This is what I would add and tested it out, seems to work correctly:

    <script>
    zE(function(){
    $zopim(function() {
    $zopim.livechat.departments.setVisitorDepartment('SWEDEN');
    $zopim.livechat.departments.filter('');
    $zopim.livechat.setOnStatus(function(e) {
    if (e === 'offline') return;
    var dep = $zopim.livechat.departments.getDepartment('SWEDEN');
    if(dep.status=="offline"){
    $zopim.livechat.setStatus('offline');
    }
    });
    });
    });
    </script>
    1
  • Ramin Shokrizadeh
    Zendesk Product Manager

    Hi there Jacob,

    Thanks for the feedback and I agree that it would be nice to sync up with the local holiday schedule similar to how Zendesk does it in schedules.

    Currently, there is no immediate plans (next 6 months) to offer this functionality but I was wondering if you are already aware of the setStatus Javascript API.

    Using the setStatus API, you can force the widget to be offline based on the department (country) status and that will show the contact form in the web widget or the offline form in the standalone Zopim widget.

    You can get the department statuses by using the getAllDepartments API.

    So the logic should look something like this:

    1. Set visitor department for each country (Optionally use the filter API to remove the department dropdown)
    2. getAllDepartments to see the status of the departments. If the set department is offline, use the setStatus API to put the widget in the offline status and show the contact form.

    Thanks,

    Ramin

    0
  • Jacob J Christensen - Cloudhuset A/S
    Community Moderator

    Hi Ramin,

    That sounds like something I would like to pursue, I am not a developer though, so my understanding is limited to pretty simple operations like setting language :-)

    The script I got through Zopim support was the following:

    zE(function(){
     $zopim(function() {
        $zopim.livechat.departments.filter('SWEDEN');
        $zopim.livechat.setOnConnected(function() {
           var dep = $zopim.livechat.departments.getDepartment('SWEDEN');
              if(dep.status=="offline"){
                 $zopim.livechat.setStatus('offline');
                 }
              else{
                $zopim.livechat.button.show();
                }  
        });
     });
    });
    </script>

    Could it be adapted to do that?

    Thanks a lot!

    0
  • Jacob J Christensen - Cloudhuset A/S
    Community Moderator

    Hi Ramin,

    EXCELLENT!

    Look forward to trying it out myself.

    Thanks a bunch!

    0
  • Jennifer Rowe
    Zendesk Documentation Team

    Hi Jacob,

    I know you didn't come up with the code....but it'd be awesome if you want to post this as a Community Tip (assuming it works for you). 

    You could be the first person to post a tip in our community!!! If you do, we'll send you swag!! :)

    (we only have Zendesk swag for now, but I think you use Zendesk too, so hopefully that's ok).

    Thanks!

    0
  • Jacob J Christensen - Cloudhuset A/S
    Community Moderator

    Challenge accepted!

    Any swag is appreciated, wearing my gray Zendesk t-shirt this very moment!

    :-D

    0
  • Jennifer Rowe
    Zendesk Documentation Team

    Awesome! Swag is heading your way. Check your inbox soon. And thanks!

    0
  • Faidhi Fudzail

    Hey, I know I'm like 4 years late but is there a way to set a department by visitor country IP and availability of that country's department?

    0
  • Devan - Community Manager
    Zendesk Community Team

    Hello Faidhi Fudzail,

    It is possible to create a trigger to fire based on the IP address and set the department that way. You can learn more about the trigger conditions and actions in the article linked below. 

    Zendesk Chat triggers conditions and actions reference.

    Best regards.

    0

Please sign in to leave a comment.

Powered by Zendesk