The rise of robotics and the Internet of Things (IoT) could potentially represent a significant shift towards a more integrated and automated future, where the physical and digital domains may merge. However, the integration of these technologies presents certain challenges, including compatibility issues with existing systems and the need for greater interoperability between different devices. It would seem that the rigidity of traditional robotic designs may inadvertently make these difficulties worse, which in turn highlights the potential benefits of modular solutions. Furthermore, the mastery of new technologies may introduce additional complexity due to the varying approaches taken by robot manufacturers. In order to address these issues, this research proposes a Robot Operating System (ROS2)-based middleware, called the “ROS2-based gateway”, which aims to simplify the integration of robots in different environments. By focusing on the payload layer and enabling external communication, this middleware has the potential to enhance modularity and interoperability, thus accelerating the integration process. It offers users the option of selecting payloads and communication methods via a shell interface, which the middleware then configures, ensuring adaptability. The solution proposed in this article, based on the gateway concept, offers users and programmers the flexibility to specify which payloads they want to activate depending on the task at hand and the high-level protocols they wish to use to interact with the activated payloads. This approach allows for the optimisation of hardware resources (only the necessary payloads are activated), as well as enabling the programmer/user to utilise high-level communication protocols (such as RESTful, Kafka, etc.) to interact with the activated payloads, rather than low-level programming.