Switch icon

Switch

Switch API Integration

Overview

This node integrates with the Switch API to manage communication communities by performing various operations such as listing channels, creating groups or channels, sending messages or media, forwarding and pinning messages, and retrieving community information. It is useful for automating interactions within a community platform, enabling workflows that require managing communication channels and content programmatically.

For example, you can use this node to:

  • Retrieve all channels in a specific community to display or process them.
  • Send messages or media files to channels or groups automatically based on triggers.
  • Create new groups or channels dynamically as part of onboarding or organizational processes.
  • Forward or pin important messages within channels to highlight key information.

Properties

Name Meaning
Community ID ID of the community (required for operations: Get Community Info, List Groups, List Channels, Send Message, Send Media)

Output

The node outputs an array of JSON objects, each representing the response from the Switch API for the executed operation. The structure of the JSON depends on the operation performed:

  • For List Channels, the output JSON contains details about all channels in the specified community.
  • For other operations like sending messages, creating groups/channels, or forwarding/pinning messages, the output JSON reflects the API's response confirming success or providing relevant data.

No binary data output is produced by this node.

Dependencies

  • Requires an API authentication token credential to authorize requests to the Switch API.
  • Communicates with a local server endpoint at http://localhost:8000 for all API calls.
  • The node uses HTTP POST requests with JSON payloads to interact with the API.

Troubleshooting

  • Common issues:

    • Missing or invalid API authentication token will cause authorization failures.
    • Incorrect or missing required parameters (e.g., Community ID for listing channels) will result in errors.
    • Network connectivity issues to http://localhost:8000 will prevent API calls from succeeding.
  • Error messages:

    • "Operation "<operation>" not supported" indicates an unsupported operation was selected; verify the operation name.
    • Errors returned from the API are passed through in the output JSON under an error field if "Continue On Fail" is enabled.
  • Resolutions:

    • Ensure the API token credential is correctly configured in n8n.
    • Verify all required input properties are provided and valid.
    • Confirm the local API server is running and accessible at the expected URL.

Links and References

  • No external links provided in the source code. For more information, consult the Switch API documentation or your local API server documentation.

Discussion