WorqAI API is a modular backend service that integrates with productivity platforms (Google, Slack, GitHub, Figma, Linear, etc.), providing unified access to their APIs and enabling advanced workflow automation and AI-powered features.
- Magic link authentication (passwordless login)
- OAuth integration with Google, Slack, GitHub, Figma, Linear
- Unified user and integration management
- AI-powered chat and task automation
- Real-time event streaming (SSE)
- Modular, extensible architecture
worqai-api/
├── package.json
├── pnpm-lock.yaml
├── README.md
├── src/
│ ├── agents/ # Agent logic for each integration
│ ├── config/ # OAuth scopes and environment config
│ ├── controllers/ # Express route controllers
│ ├── lib/ # Core libraries and utilities
│ ├── middleware/ # Express middleware (e.g., auth)
│ ├── models/ # Mongoose models (MongoDB)
│ ├── routes/ # Express route definitions
│ ├── scripts/ # Utility scripts
│ └── tools/ # Integration-specific tools
└── types/ # TypeScript type definitions
-
Clone the repository:
git clone <repo-url> cd worqai-api
-
Install dependencies:
pnpm install # or npm install -
Configure environment variables:
- Copy
.env.exampleto.envand fill in required values (API keys, DB URIs, etc.).
- Copy
-
Run the development server:
pnpm dev # or npm run dev
- Agents: Encapsulate logic for interacting with third-party APIs (Figma, GitHub, Google, etc.).
- Controllers: Handle HTTP requests and responses for each route.
- Models: Define MongoDB schemas for users, integrations, chats, and memory.
- Middleware: Includes authentication and request validation.
- Tools: Utility functions for each integration, used by agents and controllers.
- POST
/auth/magic-link - Body:
{ email: string, name?: string } - Response:
{ message: string } - Description: Sends a magic login link to the user's email. If the user does not exist,
nameis required to register.
- POST
/auth/magic-link/verify - Body:
{ token: string } - Response:
{ token: string, refreshToken: string, user: { email, name, id } } - Description: Verifies the magic link token and returns JWT tokens and user info.
- POST
/auth/refresh-token - Body:
{ refreshToken: string } - Response:
{ token: string } - Description: Issues a new access token using a valid refresh token.
- GET
/auth/me - Headers:
Authorization: Bearer <token> - Response:
{ user: { ...User } }
- GET
/integrations - Headers:
Authorization: Bearer <token> - Query:
name(optional) - Response:
{ [name]: Integration }or{ integration }
- PUT
/integrations/:name - Headers:
Authorization: Bearer <token> - Body:
{ access_token, refresh_token, expires_at } - Response:
Integration
All OAuth endpoints require authentication.
- Google:
GET /oauth/google– Get Google OAuth URLGET /oauth/google/callback– Handle Google OAuth callback
- Slack:
GET /oauth/slack– Get Slack OAuth URLGET /oauth/slack/callback– Handle Slack OAuth callback
- GitHub:
GET /oauth/github– Get GitHub OAuth URLGET /oauth/github/callback– Handle GitHub OAuth callback
- Linear:
GET /oauth/linear– Get Linear OAuth URLGET /oauth/linear/callback– Handle Linear OAuth callback
- Figma:
GET /oauth/figma– Get Figma OAuth URLGET /oauth/figma/callback– Handle Figma OAuth callback
- POST
/ai/ - Headers:
Authorization: Bearer <token> - Body:
{ task: string, threadId?: string } - Response:
{ message: string, data: { threadId, messageId } } - Description: Creates a new task (chat message) in a thread. If
threadIdis not provided, a new thread is created.
- GET
/streams/messages/:threadId/:messageId - Headers:
Authorization: Bearer <token> - Response: Server-Sent Events (SSE) stream
- Description: Streams AI agent responses and events for a chat message in real time.
{
email: string,
name?: string,
googleId?: string,
refreshToken?: string,
magicLinkToken?: string,
magicLinkExpires?: Date,
timeZone?: string,
workDayStart?: Date,
workDayEnd?: Date,
createdAt: Date,
updatedAt: Date
}
{
name: string, // e.g. 'google', 'slack', ...
user_id: string,
access_token: string,
refresh_token?: string,
expires_at?: Date,
created_at: Date,
updated_at: Date,
scope?: object
}
{
lastMessageAt: Date,
userId: string,
title: string,
createdAt: Date,
updatedAt: Date
}
{
thread: string,
user: string,
role: 'user' | 'agent',
content: string,
status: 'pending' | 'completed' | 'failed',
createdAt: Date,
updatedAt: Date
}
{
type: 'episodic' | 'factual' | 'semantic',
content: string,
tags: string[],
createdAt: Date,
updatedAt: Date
}
-
Add a new integration:
- Create a new agent in
src/agents/. - Add OAuth scopes in
src/config/. - Implement controller and route in
src/controllers/oauth/andsrc/routes/oauth/. - Add tools as needed in
src/tools/.
- Create a new agent in
-
Add a new API endpoint:
- Define the route in
src/routes/. - Implement the controller in
src/controllers/. - Add model/schema if persistent data is needed.
- Define the route in
- Fork the repository and create a new branch.
- Make your changes with clear commit messages.
- Ensure code passes linting and tests.
- Submit a pull request with a detailed description.
This project is licensed under the MIT License.
For questions, issues, or feature requests, please open an issue on GitHub or contact the maintainers.
See swagger.yaml for a machine-readable OpenAPI (Swagger) specification of all endpoints.