Switch icon

Switch

Switch API Integration

Overview

This node integrates with the Switch API to perform various communication-related operations such as sending messages, creating groups or channels, forwarding messages, and pinning messages. Specifically, the "Pin Message" operation allows users to pin a particular message within a channel or group, making it easily accessible or highlighted for members.

Common scenarios where this node is beneficial include:

  • Automating message management in community channels or groups.
  • Highlighting important announcements by pinning messages automatically.
  • Streamlining workflows that require message forwarding or media sharing alongside pinning.

For example, a community manager could use this node to automatically pin welcome messages when new members join a group.

Properties

Name Meaning
Message ID ID of the message to forward or pin

(Note: For the "Pin Message" operation, only the "Message ID" property is relevant.)

Output

The node outputs a JSON object representing the response from the Switch API after attempting to pin the specified message. The structure depends on the API's response but generally includes confirmation details about the pinned message.

No binary data output is produced by this operation.

Example output JSON might look like:

{
  "success": true,
  "messageId": "1234567890",
  "pinned": true
}

Dependencies

  • Requires an API key credential for authenticating with the Switch API.
  • The node makes HTTP POST requests to a local server endpoint (e.g., http://localhost:8000/pin_message).
  • Ensure the Switch API service is accessible at the configured URL.
  • Proper configuration of the API token in the node credentials is necessary.

Troubleshooting

  • Common issues:

    • Invalid or missing Message ID: The operation requires a valid message identifier; ensure the correct ID is provided.
    • Authentication errors: Verify that the API key credential is correctly set up and has sufficient permissions.
    • Network connectivity: Confirm that the Switch API endpoint is reachable from the n8n instance.
  • Error messages:

    • "Operation 'pinMessage' not supported": This indicates an unsupported operation was requested; verify the operation parameter.
    • API response errors related to authorization or invalid parameters will be returned in the node output if "Continue On Fail" is enabled.

Links and References

Discussion