This page will explain how to let a user of your application receive a DirectChat pin. A couple of steps are required and shown below.
Implementing our SDK is easy. Include the Javascript SDK on your page once, ideally right after the <body> openingtag.
<script>(function (d, s, id) { var js, ajs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) { return; } js = d.createElement(s); js.id = id; js.src = '//cdn.adultwork.com/platform/sdk/sdk.js#APIKey={your-api-key}&clientId={your-clientid}'; ajs.parentNode.insertBefore(js, ajs); }(document, 'script', 'adultwork-jssdk'));</script>
Once the reference is made with our sdk as described in Implement our SDK you can call the "DirectChat" function quite easy.
<script> function getPin(){ var url = 'https://platform.adultwork.com/DirectChat/GetPIN'; var userId = 123456; var clientId = 'A1B2C3D4E5F6'; AW.DirectChat.init(url, userId, 'en-GB', clientId); AW.DirectChat.directchat_window(onClose); } function onClose(){ // optional on close callback function. } </script>
Assuming the user was logged in the platform popup will show the pin as well as the price in the window.