04. Embedding the Answerbar

Noojee Answer needs to be embedded into your Web Application which essentially means that it needs to be part of each page of your Web Application. 

Noojee Answer also uses an 'API Key' to authorise requests to the PBX. The api key MUST be included in a DIV in the BODY of the page with an id of "apiKey"

<div id="apiKey" apiKey="xxx-xxx-xxxx-xxx-xxx-xxx-xxx"></div> 

The apiKey is stored the UserSpace Configuration.

Most Web Applications have a common header and footer which is used by all pages in your Web Application. You need to identify the common header and insert the following between the <head> tags:

<head>
<!-- the following lines are required for noojee answerbar -->
<!-- in this example the noojee answerbar service is hosted on http://servername:8080/ -->

<script type="text/javascript" language="javascript"
	src="http://servername:8080/servicemanager/noojee-answerbar/noojeeAnswerbar/noojeeAnswerbar.nocache.js"></script>

<!-- this is the end of the required lines for noojee answerbar -->

<!-- ... other js and style sheet includes -->
</head>
<body>
...
<div id="apiKey" apiKey="xxx-xxx-xxxx-xxx-xxx-xxx-xxx"></div> 
</body>

Please note that 'servername' will need to be replaced with the hostname of your Asterisk server, and this must resolve correctly.

Noojee Answer stores the user's extension no. in a cookie named 'nj-answer-extension'.