Toky API

Connect Toky with your business tools

Integrate Toky virtual phone system features into your business apps and CRM and improve your communication with customers.
Find comprehensive guides and documentation to help you start working with Toky API and developer tools.

API Reference    Get Started

Click to call in your web app

Turn phone numbers clickable in your custom CRM or business tool and call contacts using Toky Dialer

If you have an in-house CRM software or business tool and you want to add Toky's click to call to phone numbers, you can do it easily using JavaScript and HTML.

What do you need to add click to call to your apps?

If you want to add the Toky click to call link to your own applications, you must meet the following requirements:

  • Get a Toky account. If you do not have one, you can create a free trial account
  • The application must run as a web app and you must have access its source, HTML and javascript code.
  • When running your application you must have a Toky session open in another browser tab.

Add click to call link to your web application

We will use the Toky dialer in a pop-up window to allow phone calls. We will use a function, which is called from the onClick event of an element that has the phone in its text like this:

<a href="#" onclick="return TokyPopup(this)">+1 844 332 6433</a>  

Add this function to your included javascript files or embeded in a <script> tag in the page where you will need the click to call.

function TokyPopup(obj) {  
    //this function only works for a elements, if you want to use another HTML element like button, you mus
    //change this code to get the proper atribute with the phone number.
        var number=obj.innerText;
        var title = 'Toky',w=300,h=500;
        var _options = 'scrollbars=no,resizable=no';
        url = 'https://app.toky.co/business/dialer#?call='+number;
        // Fixes dual-screen position Most browsers Firefox
        var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
        var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
        width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
        height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;

        var _left = ((width / 2) - (w / 2)) + dualScreenLeft;
        var _top = ((height / 2) - (h / 2)) + dualScreenTop;
        var newWindow = window.open(url, title, _options +', width=' + w + ', height=' + h + ', top=' + _top + ', left=' + _left);

        // Puts focus on the newWindow
        if (window.focus) newWindow.focus();
    return false;
    }

Running sample

In this sample, you will see a simple tool, where you can paste a list of phone numbers in the text field and after clicking on the Generate button, to render a list of the phone numbers with a click to call button. In this example we used Vue.js and added a custom attribute phone to the button, which is used later in TokyPopup function.

Updated 3 months ago

Click to call in your web app


Turn phone numbers clickable in your custom CRM or business tool and call contacts using Toky Dialer

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.