# Django

**Step-by-Step Guide: Integrating Interworky AI Agent into Django**

1\. Log into the Interworky Dashboard

> Create an account or Login at [https://interworky.com](https://interworky.com/login)

* After creating your Interworky account, log into the Interworky dashboard.
* Navigate to the Integration Page.

2. Locate the Embed Code

On the Integration Page, locate the Embed Code section and capture your API key.

<figure><img src="/files/io7SEpTXSpDgGiBS64B7" alt=""><figcaption><p>Integration Page on Interworky Dashboard</p></figcaption></figure>

3\. Adding Interworky to Your Django Project

Django supports embedding JavaScript in templates. Follow these steps:

**Method 1: Directly Adding the Script to Your Django Template**

1. Open your Django template file where you want to add the chatbot (e.g., base.html or index.html).
2. Paste the Interworky script inside the \<body> tag.

📌 Example (base.html in Django Templates Folder):

```
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Django Website</title>
</head>
<body>
    
    <!-- Your Website Content -->

    <!-- Interworky AI Chatbot Integration -->
    <script 
        src="https://storage.googleapis.com/multisync/interworky/production/interworky.js"
        data-api-key="your-api-key-here">
    </script>

</body>
</html>
```

> 📌 ^^ Replace "your-api-key-here" with your Interworky API key from the dashboard.

**Method 2: Using Django’s Static Files Approach**

If you prefer to load the script dynamically, follow these steps:

1. **Create a new JavaScript file in your Django static folder:**

<pre><code>mkdir -p static/js
<strong>touch static/js/interworky.js
</strong></code></pre>

2. **Add the script to interworky.js:**

```
document.addEventListener("DOMContentLoaded", function() {
    const script = document.createElement("script");
    script.src = "https://storage.googleapis.com/multisync/interworky/production/interworky.js";
    script.setAttribute("data-api-key", "your-api-key-here"); // Replace with your API key
    document.body.appendChild(script);
});
```

3. **Include this script in your Django template (base.html):**

```
{% load static %}
<script src="{% static 'js/interworky.js' %}"></script>
```

4. **Verify the Integration**

* Open your Django website in the browser.
* Check if the Interworky chatbot widget appears.

> If you don’t see it, check the browser console (F12 → Console) for errors.

{% hint style="warning" %}
If you have any questions about the Interworky Django Integration, reach out to our support team at <hello@interworky.com>.&#x20;
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://interworky.gitbook.io/interworky-docs/integration-to-django-websites.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
