VoicePulse Blog

Get notified of important calls in HipChat using VoicePulse FIVE

In our last post we showed how to use CallCode to notify your team of important callers. First we looked up the caller ID in Zendesk, then if they had the right tag, we sent an alert to a Slack channel.

Of course not everyone uses Slack - what if you use HipChat instead? No problem!

Take a look at NotifyHipChat.js in our CallCodeSamples repository. The comments up top have basic instructions for setting up a HipChat integration. Once you've done that, just copy the script into your CallCode editor, paste your HipChat integration URL into the script, and click save. The next call that comes in will give you a notification in HipChat!

Of course, this is a very simple script - it notifies you on every single call no matter who's calling, and can only display the Caller ID number. Let's get some more mileage out of it by integrating it with Zendesk, just like we did with Slack.

First stop is the ZendeskContactToSlack.js script - we'll use that as a starting point. Copy the notifyHipChat() function from NotifyHipChat.js, and paste it into this script. Also copy the HIPCHAT_URL variable. Then delete the SLACK_WEBHOOK_PATH variable and the notifySlack() function as we won't be needing them. You'll also need to bring in the "url" module since notifyHipChat() uses that.

Now you need to customize the message - notifySlack() takes a string, but notifyHipChat() wants an object. So remove the notifySlack() call and replace it with this:

var message = {
'notify': 'true',
'message_format': 'text',
'message': msg,
};
notifyHipChat(message, HIPCHAT_URL, callback);

By the time you're done, the diff between ZendeskContactToSlack.js and your code should look something like this.

That's all there is to it! Fill in your Zendesk and HipChat API info, and you'll have a working Zendesk to HipChat CallCode app.

Topics: Blog CallCode new features