# 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="https://3900551154-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fh8KeqaWePL624uIZ0FlH%2Fuploads%2FvkrKBprYb6FScUuJNAIR%2Finterworky-integration-wordpress.png?alt=media&#x26;token=55ed3d72-420e-4e4b-94b4-a9d0a9d6ed5b" 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 %}
