![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)

# n8n-nodes-agentic-hub

This is an n8n community node that provides complete integration with the Agentic Hub API. The node includes all resources (projects, workflows, agents, content, conversations, messages, and files) in a single unified interface, similar to HubSpot's node structure.

## Features

- **Unified Node**: Single "Agentic Hub" node with all resources organized by resource type
- **Projects**: Full CRUD operations for managing projects
- **Workflows**: Complete workflow management (create, read, update, delete)
- **Agents**: Full agent lifecycle management with prompt configuration
- **Content**: Support for text and FAQ content types
- **Conversations**: Conversation management and tracking
- **Messages**: Message operations with unified conversation auto-creation
- **Files**: File retrieval and deletion operations
- **Credential Management**: Secure API authentication with API Key and Company ID

## Installation

Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.

```bash
npm install n8n-nodes-agentic-hub
```

## Node Structure

The **Agentic Hub** node provides access to all resources through a resource dropdown:

### Resources Available:

1. **Project** - Manage projects
2. **Workflow** - Manage workflows within projects
3. **Agent** - Manage AI agents within workflows
4. **Content** - Manage content (text and FAQ) for workflows
5. **Conversation** - Manage conversations and sessions
6. **Message** - Manage messages within conversations
7. **File** - Manage files associated with workflows

### Operations per Resource:

Each resource supports different operations:

- **Projects**: Get Many, Create, Get by ID, Update, Delete
- **Workflows**: Get Many, Create, Get by ID, Update, Delete
- **Agents**: Get Many, Create, Get by ID, Update, Delete
- **Content**: Get Many, Create, Get by ID, Update, Delete
- **Conversations**: Get Many, Create or Update, Get by ID, Update
- **Messages**: Get Many, Create, Get by ID
- **Files**: Get Many, Get by ID, Delete

## Credentials

The node requires the following credentials:

- **API Key**: Your Agentic Hub API authentication key (obtained from the API Keys button in the company projects page)
- **Company ID**: Your company identifier for the Agentic Hub service

## Configuration

### Setting up Credentials

1. In n8n, go to **Settings** → **Credentials**
2. Click **Add Credential** and search for "Agentic Hub API"
3. Enter your API Key and Company ID
4. Save the credentials

### Using the Node

1. Add the **Agentic Hub** node to your workflow
2. Select the **Resource** you want to work with (Project, Workflow, Agent, Content, Conversation, Message, or File)
3. Select the **Operation** you want to perform
4. Configure the required parameters
5. Set up your credentials
6. Execute the workflow

## API Base URL

All operations use the base URL: `https://app.agentic-hub.ai/api/v1`

## Examples

### Create a Project

```json
{
  "resource": "project",
  "operation": "create",
  "name": "My New Project",
  "description": "Project description",
  "status": "active"
}
```

### Create a Workflow

```json
{
  "resource": "workflow",
  "operation": "create",
  "workflowName": "Customer Support Workflow",
  "workflowProjectId": "project_123",
  "description": "Handles customer inquiries",
  "workflowStatus": "active"
}
```

### Create an Agent

```json
{
  "resource": "agent",
  "operation": "create",
  "agentName": "Support Agent",
  "agentWorkflowId": "workflow_123",
  "mainPrompt": "You are a helpful customer support assistant",
  "isActive": true
}
```

### Create a Message (Unified Mode)

```json
{
  "resource": "message",
  "operation": "create",
  "mode": "unified",
  "messageSessionId": "session_123",
  "messageWorkflowId": "workflow_123",
  "messageContent": "Hello, I need help",
  "direction": 0,
  "messagePhoneNumber": "+1234567890"
}
```

### Create FAQ Content

```json
{
  "resource": "content",
  "operation": "create",
  "contentWorkflowId": "workflow_123",
  "contentTitle": "Customer FAQ",
  "contentType": "faq",
  "faqItems": "[{\"ID\": \"faq1\", \"question\": \"What is your return policy?\", \"answer\": \"We offer 30-day returns on all products.\"}]"
}
```

## Version History

- **4.0.0**: Unified node structure - Single "Agentic Hub" node with all resources (Projects, Workflows, Agents, Content, Conversations, Messages, Files) organized by resource type, similar to HubSpot's node structure
- **3.5.0**: Complete API integration with 7 separate nodes for all resources
- **3.0.0**: Complete API integration with 7 separate nodes for all resources (Projects, Workflows, Agents, Content, Conversations, Messages, Files). Updated authentication to use x-api-key and x-company-id headers.
- **2.3.3**: Previous version with Message and Agent resources
- **2.0.0**: Added Resource/Operation structure with Message and Agent resources
- **1.4.1**: Simplified credentials and required fields
- **1.3.1**: Added WorkflowPublicId support
- **1.2.1**: Updated direction options
- **1.1.2**: Removed credential test functionality
- **1.0.4**: Added subtitle with direction display
- **1.0.0**: Initial stable release

## Resources

- [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
- [Agentic Hub API Documentation](https://app.agentic-hub.ai)

## License

[MIT](LICENSE.md)

## Author

**Elad Amrani AI**

- Email: elad@builddiz.com
- GitHub: [@Elad-builddiz](https://github.com/Elad-builddiz)
- Repository: [n8n-nodes-agentic-hub](https://github.com/Elad-builddiz/n8n-nodes-agentic-hub)

## Development

### Prerequisites

- Node.js 20.15 or later
- npm 9.x or later

### Setup

```bash
# Clone the repository
git clone https://github.com/Elad-builddiz/n8n-nodes-agentic-hub.git
cd n8n-nodes-agentic-hub

# Install dependencies
npm install

# Build the project
npm run build

# Run linting
npm run lint

# Publish to npm
npm publish
```

## Support

For issues, questions, or contributions:

1. **GitHub Issues**: [Open an issue](https://github.com/Elad-builddiz/n8n-nodes-agentic-hub/issues)
2. **Email**: elad@builddiz.com
3. **n8n Community**: [n8n Community Forum](https://community.n8n.io/)

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request

Please follow the existing code style and include appropriate documentation for new features.
