This project provides a n8n node for integrating with SimpleX Chat, allowing you to trigger workflows on incoming messages and send messages to contacts.
- SimpleXity Trigger Node: Listens for incoming SimpleX messages and triggers workflows
- SimpleXity Action Node: Sends messages to SimpleX contacts
- Credential Management: Secure storage of SimpleX connection settings
A SimpleX Chat CLI should be running.
This repository contains a Dockerfile and docker-compose.yml ready to run the SimpleX Chat Cli.
Check the corresponding README.md file
For more information: https://github.com/simplex-chat/simplex-chat/blob/stable/docs/CLI.md
You can follow the standard installation guide for n8n nodes.
Steps for installing locally:
- Clone this repository
- Install dependencies:
npm install
- Build the project:
npm run build
- Copy the
distfolder to your n8n custom nodes directory
Create a SimpleX configuration credential to connect to the SimpleX CLI.
You can setup the following fields:
- Host: SimpleX Client host (default: localhost)
- Port: SimpleX Client port (default: 5225)
- Bot Address: Optional SimpleX bot address (will be created if not provided)
- File Server Port: Port for the HTTP file server (default 8090). When set, fetches received files over HTTP when not on local filesystem. Set to 0 to disable.
The SimpleXity Trigger node listens for incoming SimpleX messages and can be configured to trigger on:
- Text Messages (
newChatItems): New chat items with text content. Only processes direct messages with text content. - Contact Connected (
contactConnected): When a new contact connects (currently not implemented in code) - File Received (
rcvFileComplete): When a file is received. The code handlesrcvFileAcceptedevents and automatically accepts audio files (ogg, m4a, mp3, wav, opus, aac)
The SimpleXity Action node allows you to send messages to SimpleX contacts:
- Contact ID: The numeric ID of the contact to send the message to
- Message: The text message to send
The SimpleXity Trigger node outputs data based on the message type:
{
"messageType": "newChatItems",
"timestamp": "2024-01-01T12:00:00.000Z",
"messages": [
{
"chatInfo": "<T.ChatInfo>",
"chatItem": "<T.ChatItem>",
"message": "string"
}
]
}{
"messageType": "rcvFileAccepted",
"timestamp": "2024-01-01T12:00:00.000Z",
"files": [
{
"chatInfo": "<T.ChatInfo>",
"chatItem": "<T.ChatItem>",
"file": "<T.CIFile>"
}
]
}Types used: T.ChatInfo, T.ChatItem, T.CIFile, T.CIMeta from @simplex-chat/types
The SimpleXity Action node returns:
{
"success": true,
"contactId": 123,
"result": [
{
"infoType": "string",
"itemChatDir": "string"
}
],
"timestamp": "2024-01-01T12:00:00.000Z"
}Or on error:
{
"success": false,
"error": "string"
}├── credentials/
│ └── SimplexityApi.credentials.ts # Credential definition
├── nodes/
│ └── Simplexity/
│ ├── Simplexity.node.ts # Action node implementation
│ ├── Simplexity.node.json # Action node configuration
│ ├── SimplexityTrigger.node.ts # Trigger node implementation
│ ├── SimplexityTrigger.node.json # Trigger node configuration
│ ├── simplexity.svg # Node icon
│ └── simplexity.png # Node icon (PNG)
├── utils/
│ └── simplex-chat-cli/ # Docker setup for SimpleX CLI
│ ├── Dockerfile
│ ├── docker-compose.yml
│ └── README.md
├── package.json # Project dependencies
├── package-lock.json # Dependency lock file
├── tsconfig.json # TypeScript configuration
├── tsconfig.bot-test.json # TypeScript config for bot tests
├── gulpfile.js # Build configuration
├── eslint.config.mts # ESLint configuration
├── .prettierrc # Prettier configuration
├── logger.ts # Logging utility
├── bot-test.ts # Test file
└── index.js # Entry point
npm run build- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For issues and questions, please open an issue on GitHub.