Overview
The PeerSender node is designed to send data to a peer system using two distinct modes: "plugin" and "template". It allows users to configure the sending method, specify the content or template to be sent, and optionally include a request body. This node is useful in scenarios where integration with an external peer API is required to transmit messages or commands based on predefined plugins or templates.
Practical examples:
- Sending a text message or button interaction via a plugin mode to a peer service.
- Dispatching a templated message by specifying a template ID in template mode.
- Including custom JSON payloads in the request body for advanced use cases.
Properties
| Name | Meaning |
|---|---|
| Group | Identifier of the target group in the peer system. |
| Send Mode | The transmission mode to use; options are "Plugin" or "Template". |
| Plugins | The plugin to send when using Plugin mode; currently supports "Text". |
| Text Type | Type of text plugin content; can be "Text" or "Button". |
| Text Title | When Text Type is "Button", this is the button's display text. |
| Text Message | When Text Type is "Button", this is the message content sent upon button interaction. |
| Use Config | Boolean indicating whether the request includes a plugin identifier configuration. |
| Text Format | Plugin identifier string used if "Use Config" is true (applies to Plugin mode with Text plugin). |
| Template ID | Identifier of the template to use when Send Mode is "Template". |
| Send Body | Boolean indicating whether to include a JSON body in the request. |
| Body | JSON-formatted string representing the request body, shown only if Send Body is true. |
Output
The node outputs an array of JSON objects corresponding to the response data received from the peer API after sending the request. Each output item contains the raw data returned by the external service.
If the node sends binary data, it is not indicated in the code; thus, the output is purely JSON-based.
Dependencies
- Requires an external peer API endpoint configured via credentials that provide the API domain and authentication.
- Uses the Axios HTTP client library to perform requests.
- Relies on internal classes handling the specifics of building requests for each send mode ("plugin" or "template").
Troubleshooting
- Invalid send mode error: If the "Send Mode" property is set to a value other than "plugin" or "template", the node will throw an error indicating the mode is invalid. Ensure the property is correctly set.
- Request failures: Network errors or incorrect API credentials may cause the HTTP request to fail. The error message will include details such as base URL, request URL, and method to aid debugging.
- JSON parsing errors: If "Send Body" is enabled but the "Body" property contains invalid JSON, the node will fail when parsing. Validate the JSON format before execution.
- Missing required properties: The "Group" property is mandatory; omitting it may lead to unexpected behavior or API errors.
Links and References
- Axios HTTP Client
- n8n Documentation on Creating Custom Nodes