Introduction

The article describes the implementation of integration between Kazoo VoIP (Voice over Internet Protocol) and Zapier platforms. The solution was implemented by JazzTeam for a commercial VoIP provider from Europe.

Zapier overview

Zapier allows to link several external services:

  • to receive data from one service and transfer it to the other one;
  • to run actions in one service based on events from the other service.

The link between the services is called Zap.
The services are called Applications (App).
The event that triggers an action is called a Trigger.
Instructions where to send the data and how to change it are called Actions.

For example, let’s create a VoIP+Gmail link (Zap). When an event occurs on a VoIP platform, for example, we get a call (an event occurred, a trigger), the call data is sent to Zapier and then redirected to Gmail. In Gmail, an email message is sent to a specific recipient with the details of the call (it is an Action).

Initial task

VoIP provider users should be able to use the following VoIP services on Zapier platform:

  • calling a subscriber at telephone number through an Action on Zapier platform;
  • creating triggers on Zapier platform that are started when there is a call, a call center event, or if calls are parked in the waiting slot. Information from events is used to create Zaps (an abstraction that links events) on the platform;
  • the VoIP platform administrator should be able to receive VoIP events for all users in their system.

All actions must be carried out inside Zapier interface, without any additional settings on Zapier side.

JazzTeam solution

Determination of project requirements

JazzTeam specialists jointly with the customer created a list of requirements for VoIP integration with Zapier:

  1. Create an event of a subscriber call at telephone number.
  2. Create own OAuth2 API for integration with Zapier.
  3. Create triggers on Zapier platform for the main events of a call.
  4. Implement additional functionality for administrators, in particular – getting events of all users.
  5. Add processing of the “parking”, “queuing when calling the call center” events to our basic integration platform, which is used to integrate VoIP in Zoho and Salesforce.

Analysis of existing commercial solutions

After determining the requirements, we conducted an in-depth technical analysis of existing solutions for integrating VoIP services in Zapier. It was also decided to study the work of popular integrations in Zapier.

The following integrations were analyzed:

  1. VoIP – Twilio.
  2. Popular applications – Gmail, Slack.

Conclusions after the analysis: In the existing integrations of services with Zapier, similar approaches are used to fill triggers, the authorization system.

Triggers use:

  • “raw data” – (raw primary data from Kazoo, for example, UserID, CallID) to build complex “Zaps” that other applications may need;
  • “human-readable data” – data in a format understandable to ordinary users, for example, user name, call direction, etc.

Zapier supports the implementation of several authorization methods (Basic Auth, Session Auth, API Key, OAuth v2, Digest Auth). Analysis of these applications (Twillio, Gmail, Slack) showed that the most qualitative and understandable for the user is authorization via OAuth 2.0. Authorization via OAuth 2.0 is also the most secure, as the whole process takes place on the side of our application, and Zapier receives only an access token. OAuth 2.0 is familiar and understandable to users, since they most likely encountered a similar system in other products. The UI of the application is similar to the VoIP web application, which inspires trust among users. In the future, our own OAuth 2.0 authorization system will be useful when developing new integrations with VoIP.

Design and development

Architectural solutions

After analyzing the existing integrations, we made the following decisions:

  1. Develop own version of OAuth 2.0 API for the VoIP provider’s platform. Zapier supports different types of authorization, however, OAuth2 is more reliable and convenient for user authorization compared to the custom options offered by Zapier Platform. Zapier stores only access tokens, which makes integration secure, unlike other authorization options. Since OAuth 2.0 authorization uses an interface similar to the provider’s application interface, it is convenient and does not cause difficulties with integration among users. Passport.js library is used for operation. Passport.js is an intermediate software for Node.js authentication.
  2. Expand the universal integration application. According to the provider’s requirements, it is necessary to work not only with the events of the call, but also with the events of the call “parking” and call “queues”.
  3. Create triggers in the app on Zapier platform. The implementation uses advanced work with triggers through REST Hook – it is one of the integration methods offered by Zapier platform. In this case, Zapier subscribes to our server using a unique URL, and we send a payload of data back to the URL to run that particular Zap. This allows Zap to start instantly.
  4. Create an event to implement quick app calling on Zapier platform.
Diagram

A simplified diagram of the architecture of our solution is shown in Fig. 1:

Architectural diagram of Kazoo and Zapier integration

Fig. 1. Architectural diagram of Kazoo and Zapier integration.
Event handling
  1. Integration App (our solution for event handling) subscribes to events with information about calls in Kazoo;
  2. Integration App converts events from Kazoo to a user-friendly data format (call initialization, user answered the call, call termination, call placed in a parking slot, call received in a queue, etc.). This is necessary because events contain information about call channels between Kazoo and subscribers;
  3. Call information is sent to the Zapier trigger to which the user is subscribed.

Zapier triggers

Applications in Zapier are linked via Zaps. To do this, create an API for app triggers. Trigger is an abstract concept in Zapier, which is an application point responsible for obtaining information from the integrated system. Only REST Hook triggers were used in the integration, as this allows Zapier to receive events almost in real time.

Simplified architectural diagram of the trigger in the application

Fig. 2. Simplified architectural diagram of the trigger in the application.

The trigger can be divided into several components:

  • Points for interacting with the application API. These can be done through Zapier Platform and Zapier CLI. These points control requests for “subscribe”/“unsubscribe” that will be passed to the Integration API.

Example of creating an API starting point for a trigger via Zapier Platform

Fig. 3. Example of creating an API starting point for a trigger via Zapier Platform.
  • REST API for processing requests from Zapier Platform.
  • API for sending events to all subscribed triggers.
  • Description of the received event in a form understandable to the user.

Setup

Integration configuration is reduced to user authorization on Zapier through the provider’s VoIP application. The user is just provided with access to Zapier REST API. This is implemented by pressing the integrate button in the provider’s VoIP application.

Conclusion

VoIP services were successfully integrated into Zapier. Prerequisites for success:

  1. Previous experience of our company in this area (in particular, the integration of VoIP with Zoho CRM and Salesforce CRM).
  2. Well-thought product architecture – we created an API to control subscription to/unsubscription from triggers in Zapier platform, and also added event handling related to call centers to the existing universal integration application that was developed earlier, when integrating with Zoho and Salesforce.

Links for detailed study

  1. https://platform.zapier.com/docs/start
  2. https://docs.2600hz.com/qubicle/doc/websockets/setup/