How to integrate a click2call button

WARNING. This page is intended to be used by developers or users with web & javascript integration knowledge.

If you already developed your own CRM, you may want to add a click2call button next to a number to start a call via your web2contact account. Here is a code sample allowing to implement the click2call.

For more advanced features, consult the API section.

For that ajax call to work, you must be connected to web2contact via the same browser.

1/ Integrate the jquery library or a library allowing AJAX calls

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

2/ Create a function to call the web2contact server and to initiate the call.

function callNumber(number){
  $.ajax({
  type: 'GET',
  dataType: 'jsonp',
  url:       "https://www.web2contact.com/a/<domainAlias>/api/callcenter/callMeBridgeMe/?number="+number+"&isCallRecorded=<yes|no>&click2CallId=C2C5user",
  data: "",
  success: function (data) {
    alert("Success: " + data);
  },
}); 
}

3/ Integrate a button, link, or image, that can execute the function.

<input type=button value="callMe" onclick="callNumber('0102030405')"/>