npm package: @mosesgottlieb/onoffice-n8n-node
Description: n8n node for OnOffice integration
Author: Your Name
Latest version: 0.1.0

# n8n-nodes-onoffice

This is an n8n community node. It lets you use [OnOffice](https://en.onoffice.com/) in your n8n workflows.

OnOffice is a CRM system specifically designed for real estate businesses. This node allows you to interact with the OnOffice API.

[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.

## Installation

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

### Manual installation

1. Clone the repository
2. Navigate to the directory and run `npm install`
3. Build the node with `npm run build`
4. Link the node to your n8n installation with `npm link`
5. In your n8n installation directory, run `npm link onoffice-n8n-node`

### Docker installation

1. Clone the repository
2. Navigate to the directory
3. Run `./start-docker.sh` to build and start the Docker container
4. Access n8n at http://localhost:5678

## Features

This node supports the following resources and operations in OnOffice:

### Estate Resource
- **Get**: Retrieve a single estate by ID
- **Get Many**: Retrieve multiple estates with filtering options
- **Create**: Create a new estate
- **Update**: Update an existing estate

### Address Resource
- **Get**: Retrieve a single address by ID
- **Get Many**: Retrieve multiple addresses with filtering options
- **Create**: Create a new address
- **Update**: Update an existing address

### Relation Resource
- **Get**: Retrieve a single relation by ID
- **Get Many**: Retrieve multiple relations with filtering options
- **Create**: Create a new relation between an estate and an address
- **Delete**: Delete an existing relation

## Credentials

For authentication, you'll need to provide:
1. **API Token**: The API token from your OnOffice account
2. **API Secret**: The API secret from your OnOffice account

You can obtain these credentials from your OnOffice account under API settings.

## API Documentation

This node is built using the [OnOffice API v1](https://apidoc.onoffice.de/) which follows a specific format for all requests.

### Request Format

All API calls to OnOffice follow this format:
- HTTP Method: POST
- Content-Type: application/json
- Authentication: Using HMAC authentication with your API token and secret

### Examples

#### Get Estate Example

```json
{
  "actionid": "1623838783-123456",
  "resourceid": "",
  "resourcetype": "estate",
  "identifier": "",
  "actiontype": "urn:onoffice-de-ns:smart:2.5:smartml:action:read",
  "parameters": {
    "resourceid": ["123"],
    "data": ["Id", "objekttitel", "objektnr_extern"]
  }
}
```

#### List Estates Example

```json
{
  "actionid": "1623838783-123456",
  "resourceid": "",
  "resourcetype": "estate",
  "identifier": "",
  "actiontype": "urn:onoffice-de-ns:smart:2.5:smartml:action:read",
  "parameters": {
    "data": ["Id", "objekttitel", "objektnr_extern"],
    "filter": {
      "vermarktungsart": "kauf"
    },
    "listlimit": 50,
    "listoffset": 0
  }
}
```

#### Create Address Example

```json
{
  "actionid": "1623838783-123456",
  "resourceid": "",
  "resourcetype": "address",
  "identifier": "",
  "actiontype": "urn:onoffice-de-ns:smart:2.5:smartml:action:create",
  "parameters": {
    "data": {
      "name": "Doe",
      "vorname": "John",
      "email": "john.doe@example.com"
    }
  }
}
```

#### Create Relation Example

```json
{
  "actionid": "1623838783-123456",
  "resourceid": "",
  "resourcetype": "relation",
  "identifier": "",
  "actiontype": "urn:onoffice-de-ns:smart:2.5:smartml:action:create",
  "parameters": {
    "data": {
      "estateid": "12345",
      "addressid": "67890",
      "type": "owner"
    }
  }
}
```

## Resources

* [OnOffice API Documentation](https://apidoc.onoffice.de/)
* [n8n Community Nodes Documentation](https://docs.n8n.io/integrations/community-nodes/)

## Known Limitations

- The node currently only supports basic estate, address, and relation operations
- Complex queries may require additional customization
- File uploads are not yet supported

## Troubleshooting

- If you encounter HMAC authentication errors, verify your API token and secret
- Ensure your JSON input for filters and data is properly formatted
- Check OnOffice API documentation for field-specific format requirements

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request. 

npm pack