Deployment Options

You can deploy your SpinAI Zendesk agent in several ways:

  1. Serverless Function
  2. Docker Container
  3. Traditional Server

Serverless Deployment

Vercel

npm install -g vercel
vercel deploy

Create api/support.ts:

import { supportAgent } from "../src";

export default async function handler(req, res) {
  const { input } = req.body;

  const { response } = await supportAgent({
    input,
    state: {},
  });

  res.json({ response });
}

AWS Lambda

import { supportAgent } from "./src";

export async function handler(event) {
  const { input } = JSON.parse(event.body);

  const { response } = await supportAgent({
    input,
    state: {},
  });

  return {
    statusCode: 200,
    body: JSON.stringify({ response }),
  };
}

Docker Deployment

Create a Dockerfile:

FROM node:18-slim

WORKDIR /app

COPY package*.json ./
RUN npm install

COPY . .
RUN npm run build

CMD ["npm", "start"]

Deploy:

docker build -t zendesk-agent .
docker run -p 3000:3000 \
  -e OPENAI_API_KEY=your_key \
  -e ZENDESK_API_TOKEN=your_token \
  zendesk-agent

Environment Variables

Ensure these are set in your deployment environment:

OPENAI_API_KEY=your_openai_key
ZENDESK_SUBDOMAIN=your_subdomain
ZENDESK_API_TOKEN=your_api_token

Next Steps