# HOW TO TEST IN DEV MODE

## Prerequisites

To use Iadvize connector with Tock bot, you need to have:

* An external Bot with and iAdvize app created at the developper portal https://developers.iadvize.com/ using this documentation https://developers.iadvize.com/documentation/building-your-bot-on-iadvize#building-your-bot-on-iadvize
* Ngrok installed in your local machine

----

## Steps To follow :

* In your local machine, launch your apps (Tock-bot-admin, Tock-Bot-api, etc...)
* To link your Iadvize app with your local Tock-Bot-Api app you need to use <strong style="color: cyan">ngrok</strong>
  run :

  ```shell
  unset http_proxy \
     && unset https_proxy \
     && unset HTTP_PROXY \
     && unset HTTPS_PROXY \
     && cd ${path_to_ngrok_directory} \
     && ./ngrok http ${bot_api_port}
  ```

![ngrok.jpg](src/main/resources/static/ngrok.jpg)
* Copy the Forwarding url generated by ngrok 

* Enter to your [iAdvize app](https://developers.iadvize.com/)
and go to <strong style="color: green">My apps </strong>, then select the app you want to use.
* In <strong style="color: green">Health check URL</strong> section, replace the base url with the one you get from ngrok. 
* In <strong style="color: green">Plugins</strong> tab, edit your bot plugin (replace in the Base url connector, the base url by the one you get from ngrok)
* Create a html file called FakeFront.html and paste this code in it :

PS: replace siteId by your siteId 

```html

<!DOCTYPE html>
<html>
<head>
    <title>FakeFront</title>
</head>

<body>
<h1>Front fake test iAdvize</h1>

Page de test iAdvize.

<!-- START IADVIZE LIVECHAT -->
<script type='text/javascript'>
    (function () {
        var idz = document.createElement('script');
        idz.type = 'text/javascript';
        idz.async = true;
        idz.src = document.location.protocol + '//halc.iadvize.com/iadvize.js?sid=$siteID&lang=fr';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(idz, s);
    })();
</script><!-- END IADVIZE LIVECHAT -->
</body>
</html>
```
* Open the html file in your browser

You are ready to go 😃 😃!
