Spooner AI x Guru Integration Automation Template

Test this app for free
23
from models import AllowedEmail

import os
from guru_api import httpx
import hashlib
import logging
from datetime import datetime, timedelta
from typing import Optional, List, Dict
import asyncio
from flask import session as flask_session
from flask import Flask, request, jsonify, render_template, abort
from flask_cors import CORS
from sqlalchemy.orm import Session
from abilities import apply_sqlite_migrations, flask_app_authenticator

from models import Base, engine, CronJob, GuruAPI, LinkedAssistant, AllowedDomain
from cron_manager import start_cron_manager
from settings import runtime_app_settings

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

app = Flask(__name__)
app.secret_key = os.environ.get('FLASK_SECRET_KEY', 'supersecretkey')
Get full code

Frequently Asked Questions

How can the Spooner X Guru Integration Automation benefit my business?

The Spooner X Guru Integration Automation can significantly enhance your business's knowledge management and customer support capabilities. By seamlessly connecting your Guru knowledge base with your Spooner AI assistant, you ensure that your AI has access to the most up-to-date information from your Guru cards. This integration allows for more accurate and consistent responses to customer inquiries, reducing the workload on your support team and improving overall customer satisfaction.

Is it possible to schedule automatic updates with this integration?

Yes, the Spooner X Guru Integration Automation includes a feature for scheduling automatic updates. You can set up cron jobs to periodically sync your Guru cards with your Spooner assistant. This ensures that your AI always has the latest information without manual intervention. To schedule an update, you can use the "Schedule Automatic Updates" button in the interface, which allows you to select specific collections and set the update interval in hours.

How does this integration handle access control and security?

The Spooner X Guru Integration Automation implements robust access control measures. It includes features for managing allowed email addresses and domains, ensuring that only authorized personnel can access and manage the integration. This is crucial for maintaining the security of your knowledge base and preventing unauthorized access to sensitive information.

How can I add custom validation to the modal dialogs in this template?

The template includes a custom modal system that allows for easy addition of validation logic. Here's an example of how you can add custom validation to a modal:

javascript showCustomModal("Enter a value greater than 10", { showInput: true, inputType: 'number', customValidation: function() { const value = parseInt(document.querySelector('#customModal input').value); if (value <= 10) { alert("Please enter a value greater than 10"); return false; } return { value: value }; } }).then(result => { if (result) { console.log("Valid input:", result.value); } });

This code creates a modal that asks for a number input and validates that it's greater than 10 before closing.

How does the Spooner X Guru Integration Automation handle the conversion of Guru cards to a format suitable for Spooner?

The integration automatically converts Guru cards to a format that Spooner can understand. Here's a snippet from the send_cards_to_spooner function that demonstrates this process:

```python for card in cards: card_id = card.get("id") if not card_id: continue

   # Convert HTML content to markdown
   markdown_content = guru_client.convert_cards_to_markdown([card])[0].get('markdown_content', '')

   url_data = {
       "url": f"guru://{card_id}",
       "assistant_id": assistant_id,
       "preferredPhrase": card.get("preferredPhrase", ""),
       "content": card.get("content", ""),
       "source_sitemap": "guru",
       "markdown_content": markdown_content,
       "pagetype": "Guru Knowledge Card"
   }
   urls_data.append(url_data)

```

This code processes each Guru card, converts its HTML content to markdown, and structures the data in a format that Spooner can ingest and use effectively.

Created: | Last Updated:

Follow the step by step setup guide here -> https://docs.google.com/document/d/15sL4ALahbtFQfC3Xen1IcMvUE4dP_Kx5kP-3UMRwsSI/edit?tab=t.0 Integrate your Guru Cards with Spooner AI's Assistants.

Here's a step-by-step guide for using the Spooner X Guru Integration Automation template:

Introduction

This template allows you to integrate your Guru Cards with your Spooner Assistant. It provides functionality to send Guru cards to Spooner, schedule automatic updates, and manage allowed emails and domains for access control.

Getting Started

  1. Click "Start with this Template" to begin using the Spooner X Guru Integration Automation template in Lazy.

Initial Setup

Before running the app, you need to set up the following environment secrets:

  1. Open the Environment Secrets tab in the Lazy Builder.
  2. Add the following secrets:
  3. GURU_EMAIL: Your Guru account email
  4. GURU_TOKEN: Your Guru API token
  5. FLASK_SECRET_KEY: A secure random string for Flask session encryption

To obtain your Guru API token: 1. Log in to your Guru account 2. Go to Settings > API & Integrations 3. Generate a new API token

Test the App

  1. Click the "Test" button to deploy and run the app.
  2. Wait for the deployment to complete and the Lazy CLI to appear.

Using the App

Once the app is running, you'll be provided with a URL to access the web interface. Open this URL in your browser to interact with the Spooner X Guru Integration Automation app.

The main features of the app include:

  1. Sending Guru Cards to Spooner
  2. Scheduling automatic updates
  3. Managing allowed emails and domains for access control

Linking Your Spooner Assistant

Before you can send cards to Spooner, you need to link your Spooner Assistant:

  1. Follow the steps in the documentation to link your Guru to Spooner.
  2. Once linked, you'll be able to use the "Send Guru Cards to Spooner" and "Schedule Automatic Updates" features.

Sending Guru Cards to Spooner

  1. Click the "Send Guru Cards to Spooner" button.
  2. In the modal that appears, select the Guru collections you want to send to Spooner.
  3. Click "Send" to initiate the transfer.

Scheduling Automatic Updates

  1. Click the "Schedule Automatic Updates" button.
  2. In the modal, set the update interval (in hours).
  3. Select the Guru collections you want to include in the automatic updates.
  4. Click "Schedule" to create the cron job.

Managing Access Control

The app allows you to manage access by adding or removing allowed emails and domains:

  1. To add an allowed email, enter the email address in the "Enter email address" field and click "Add Email".
  2. To remove an allowed email, click the trash icon next to the email in the list.
  3. To add an allowed domain, enter the domain (e.g., "getlazy.ai") in the "Enter domain" field and click "Add Email Domain".
  4. To remove an allowed domain, click the trash icon next to the domain in the list.

Integrating the App

This app runs as a standalone web application. To integrate it with your existing systems:

  1. Use the provided URL to access the web interface.
  2. Ensure that your Guru and Spooner accounts are properly configured and linked.
  3. Set up the necessary access control by adding allowed emails or domains.
  4. Use the app's features to send Guru cards to Spooner and schedule automatic updates as needed.

Remember to keep your environment secrets (GURU_EMAIL, GURU_TOKEN, and FLASK_SECRET_KEY) secure and up-to-date for the app to function correctly.



Here are 5 key business benefits for this Spooner X Guru integration template:

Template Benefits

  1. Automated Knowledge Syncing: Seamlessly synchronize Guru knowledge cards with your Spooner AI assistant, ensuring your AI always has access to the latest company information and policies.

  2. Improved Customer Support: Empower your AI assistant with up-to-date knowledge from Guru, enabling faster and more accurate responses to customer inquiries across various channels.

  3. Enhanced Employee Onboarding: Provide new employees with an AI assistant that can instantly answer questions about company processes, policies, and best practices, accelerating the onboarding process.

  4. Centralized Knowledge Management: Maintain a single source of truth in Guru while automatically propagating that knowledge to your AI assistant, reducing information silos and inconsistencies.

  5. Increased Productivity: Save time and resources by automating the process of updating your AI assistant's knowledge base, allowing your team to focus on creating and curating content rather than manual updates.

Technologies

Flask Templates from Lazy AI – Boost Web App Development with Bootstrap, HTML, and Free Python Flask Flask Templates from Lazy AI – Boost Web App Development with Bootstrap, HTML, and Free Python Flask
FastAPI Templates and Webhooks FastAPI Templates and Webhooks
Optimize SQL Workflows with Lazy AI: Automate Queries, Reports, Database Management and More Optimize SQL Workflows with Lazy AI: Automate Queries, Reports, Database Management and More

Similar templates

FastAPI endpoint for Text Classification using OpenAI GPT 4

This API will classify incoming text items into categories using the Open AI's GPT 4 model. If the model is unsure about the category of a text item, it will respond with an empty string. The categories are parameters that the API endpoint accepts. The GPT 4 model will classify the items on its own with a prompt like this: "Classify the following item {item} into one of these categories {categories}". There is no maximum number of categories a text item can belong to in the multiple categories classification. The API will use the llm_prompt ability to ask the LLM to classify the item and respond with the category. The API will take the LLM's response as is and will not handle situations where the model identifies multiple categories for a text item in the single category classification. If the model is unsure about the category of a text item in the multiple categories classification, it will respond with an empty string for that item. The API will use Python's concurrent.futures module to parallelize the classification of text items. The API will handle timeouts and exceptions by leaving the items unclassified. The API will parse the LLM's response for the multiple categories classification and match it to the list of categories provided in the API parameters. The API will convert the LLM's response and the categories to lowercase before matching them. The API will split the LLM's response on both ':' and ',' to remove the "Category" word from the response. The temperature of the GPT model is set to a minimal value to make the output more deterministic. The API will return all matching categories for a text item in the multiple categories classification. The API will strip any leading or trailing whitespace from the categories in the LLM's response before matching them to the list of categories provided in the API parameters. The API will accept lists as answers from the LLM. If the LLM responds with a string that's formatted like a list, the API will parse it and match it to the list of categories provided in the API parameters.

Icon 1 Icon 1
196

We found some blogs you might like...