No description
Find a file
lorentz dd4cf68def feat: add project_phases entity sync with task project_id backfill
The Autotask Tasks bulk API does not return projectID in its response,
causing all tasks.project_id to be NULL. This fixes it by:

- Adding project_phases as a synced entity (Autotask endpoint: /Phases)
- Migration 059: project_phases table with project_id, phase_number,
  estimated_hours, start/due dates, parent_phase_id, is_scheduled
- EntityType.PROJECT_PHASES added to all sync maps and dependency graph
  (depends on PROJECTS, runs before TASKS in sync order)
- buildProjectPhasesFilter: Phases endpoint requires a filter (id > 0)
- mapProjectPhase: maps Autotask field names to DB columns
- Post-sync backfill in syncEntity: after each project_phases sync,
  UPDATE tasks SET project_id = pp.project_id FROM project_phases pp
  JOIN projects p WHERE tasks.phase_id = pp.id
  Only backfills where the project exists in our DB (FK constraint on
  tasks.project_id; archived projects are skipped gracefully)

Result: 2,455 of 4,966 tasks now have project_id populated. Tasks
belonging to archived/completed projects have phase_id resolvable via
project_phases even when project_id remains NULL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 13:57:33 -04:00
.windsurf/workflows feat: IT Glue integration, workflow engine, pipelines, Zabbix WAN, notification channels, backup status UI improvements, nav alignment fixes 2026-02-27 14:52:14 -05:00
app feat: add description block to mobile ticket detail with View original toggle 2026-03-23 16:15:05 -04:00
components feat: mobile nav page + suppress desktop header on /mobile/* routes 2026-03-23 12:58:09 -04:00
dev feat: Mimecast email integration — message logs, threat events, 120d retention, admin UI 2026-03-17 16:23:47 -04:00
docs docs: add AUTOTASK_API_GUIDE.md to docs folder 2026-03-21 18:07:30 -04:00
hooks Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
lib feat: add project_phases entity sync with task project_id backfill 2026-03-24 13:57:33 -04:00
migrations feat: add project_phases entity sync with task project_id backfill 2026-03-24 13:57:33 -04:00
public feat: Autotask webhook integration, TicketNotes, Datto RMM, workflow engine, Veeam agents/alarms, AI triage, misc improvements 2026-02-20 10:28:15 -05:00
scripts feat: IT Glue integration, workflow engine, pipelines, Zabbix WAN, notification channels, backup status UI improvements, nav alignment fixes 2026-02-27 14:52:14 -05:00
tasks feat: Morning NOC Summary adaptive card for Teams 2026-03-11 09:34:51 -04:00
.dockerignore Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
.gitignore chore: remove build artifacts and update gitignore 2025-10-28 23:21:59 -04:00
_clientMiddlewareManifest.json Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
ADDIGY_API_GUIDE.md Add Addigy API integration and Docker deployment with Redis caching 2025-10-28 22:49:08 -04:00
AUTOTASK_API_GUIDE.md Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
components.json Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
docker-compose.yml fix: Mimecast correct credentials, x-mc-account header, no-ms date format, accountCode in body 2026-03-17 16:38:13 -04:00
DOCKER_README.md Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
Dockerfile Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
eslint.config.mjs Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
favicon.0b3bf435.ico Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
FIX_TICKET_SYNC.md Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
get-config-text.js Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
LCI_FEATURE_DESIGN.md feat: QuickBooks Online integration 2026-03-17 07:39:55 -04:00
mcp.json feat: add authentication, user management, and admin features 2026-01-31 12:43:14 -05:00
middleware.ts fix: mobile dashboard priority labels now join priorities table 2026-03-17 23:44:00 -04:00
next-development.log Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
next-devtools-config.json Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
next.config.ts Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
package-lock.json feat: QuickBooks Online integration 2026-03-17 07:39:55 -04:00
package.json feat: QuickBooks Online integration 2026-03-17 07:39:55 -04:00
postcss.config.mjs Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
POSTGRES_SYNC_SETUP.md Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
PULSE_DATABASE_SKILL.md docs: refresh database skill — timezone (UTC), full picklist tables, updated row counts 2026-03-17 23:05:57 -04:00
README.md Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
routes.d.ts Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
test-config.js Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
test-time-entry.js Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
tsconfig.json Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00

Autotask API Integration Dashboard

A modern Next.js application for interacting with the Autotask PSA REST API, built with React, TypeScript, shadcn/ui, and Tailwind CSS.

Features

  • Dashboard Overview - View tickets, tasks, and company information
  • Ticket Management - List, filter, and manage support tickets
  • Task Tracking - Monitor and update project tasks
  • Company Selector - Filter data by company
  • Resource Management - Filter by assigned resources
  • Modern UI - Beautiful interface built with shadcn/ui components
  • Dark Mode Support - Automatic dark/light theme
  • Real-time Updates - Fetch latest data from Autotask API
  • Secure Authentication - API credentials stored in environment variables

Tech Stack

  • Framework: Next.js 15 with App Router
  • Language: TypeScript
  • Styling: Tailwind CSS v4
  • UI Components: shadcn/ui
  • Icons: Lucide React
  • Date Handling: date-fns
  • API Integration: Native fetch with custom client

Prerequisites

Before you begin, ensure you have:

  1. Node.js 18+ installed
  2. Autotask API credentials:
    • API Username (format: apiuser@YOURDOMAIN.COM)
    • API Secret/Password
    • API Integration Code
    • API Base URL (e.g., https://webservices1.autotask.net/atservicesrest/v1.0)

Installation

  1. Clone the repository and navigate to the app directory:
cd /Users/lorentz/projects/PSA-Utils/autotask-app
  1. Install dependencies:
npm install
  1. Create a .env.local file in the root directory:
# Autotask API Configuration
AUTOTASK_API_URL=https://webservices1.autotask.net/atservicesrest/v1.0
AUTOTASK_USERNAME=your-api-username@yourdomain.com
AUTOTASK_SECRET=your-api-password
AUTOTASK_API_INTEGRATION_CODE=your-tracking-code
  1. Run the development server:
npm run dev
  1. Open http://localhost:3000 in your browser

Project Structure

autotask-app/
├── app/
│   ├── api/              # API route handlers
│   │   ├── tickets/      # Ticket endpoints
│   │   ├── tasks/        # Task endpoints
│   │   ├── companies/    # Company endpoints
│   │   ├── resources/    # Resource endpoints
│   │   └── picklists/    # Picklist endpoints
│   └── page.tsx          # Main dashboard page
├── components/
│   ├── tickets/          # Ticket-related components
│   ├── tasks/            # Task-related components
│   ├── companies/        # Company-related components
│   └── ui/               # shadcn/ui components
├── lib/
│   ├── services/         # API client and services
│   │   ├── autotask-client.ts
│   │   └── autotask-factory.ts
│   ├── types/            # TypeScript type definitions
│   │   └── autotask.ts
│   └── hooks/            # Custom React hooks
│       └── use-api.ts
└── public/               # Static assets

API Endpoints

The application provides the following API routes:

  • GET /api/tickets - Fetch tickets (with optional filters)
  • POST /api/tickets - Create a new ticket
  • GET /api/tasks - Fetch tasks (with optional filters)
  • POST /api/tasks - Create a new task
  • GET /api/companies - Fetch all active companies
  • GET /api/resources - Fetch resources/users
  • GET /api/picklists - Fetch picklist values for dropdowns

Key Features Implementation

Rate Limiting

The API client includes built-in rate limiting (10 requests/second) to comply with Autotask API limits.

Error Handling

Comprehensive error handling with user-friendly error messages and retry capabilities.

Type Safety

Full TypeScript support with detailed type definitions for all Autotask entities.

Responsive Design

Mobile-friendly interface that works on all device sizes.

Development

Adding New Features

  1. New API Endpoints: Add route handlers in app/api/
  2. New Components: Create components in components/
  3. New Entity Types: Update types in lib/types/autotask.ts
  4. New API Methods: Extend lib/services/autotask-client.ts

Testing

Run the development server and test with your Autotask sandbox environment:

npm run dev

Building for Production

npm run build
npm start

Security Considerations

  • Never commit .env.local or any file containing API credentials
  • Use environment variables for all sensitive configuration
  • Implement proper authentication for production deployment
  • Consider adding user authentication layer
  • Use HTTPS in production

Common Issues & Solutions

API Connection Issues

  • Verify your API credentials are correct
  • Check the API URL matches your Autotask zone
  • Ensure your API user has appropriate permissions

Rate Limiting

  • The client automatically handles rate limiting
  • If you encounter 429 errors, the client will retry

CORS Issues

  • API routes act as a proxy to avoid CORS issues
  • All Autotask API calls go through Next.js API routes

Future Enhancements

  • Add Redis caching for improved performance
  • Implement real-time updates with WebSockets
  • Add attachment upload functionality
  • Create ticket/task editing forms
  • Add user authentication and session management
  • Implement advanced search and filtering
  • Add data export functionality
  • Create dashboard widgets and analytics

Contributing

Feel free to submit issues and enhancement requests!

License

This project is for internal use. Please refer to your organization's policies.

Support

For issues related to:


Built with ❤️ using Next.js, React, and shadcn/ui