miamigo-chatbot
v2.1.4
Published
Register with https://miamigo.ai and get your userid and secret key
Downloads
10
Readme
MiAmigo.AI Chatbot
Get Started
Register with https://miamigo.ai and get your userid and secret key
install component
npm i miamigo-chatbot
import component and use
import AIChat from "miamigo-chatbot"
<AIChat
userid="userid"
supportEmail="[email protected]"
supportPhone="555-555-5555"
title="Chatbot"
chatbotname="Support"
iconColor="#FF6A00"
handleQuestion={(q:string)=>handlequestion(q)}
/>
handleQuestion
const handlequestion = async (question: any) =>{
return new Promise<string>( async (resolve) =>{
let token = await axios.post(url, {question: question})
resolve(token)
})
}
tokenize question
import express from "express"
const jwt = require("jsonwebtoken");
const router = express.Router()
router.post("/", async (req, res) => {
let question = req.body.question
let body = {
question: question,
}
const secretKey = process.env.CHAT_SECRET!
const token = jwt.sign(body, secretKey);
return res.status(200).json({token:token})
})