Wireless devices are widely used to monitor and control multiple groups within the context of machine‐to‐machine applications. The Constrained Application Protocol provides communication capabilities for applications that demand periodic monitoring of multiple groups. Because of the energy constraints of the devices used, a key challenge is to extend the network lifetime. Data aggregation solutions have been proposed to reduce the amount of network traffic and increase energy efficiency. However, for periodic monitoring of multiple groups, current data aggregation solutions do not exploit the potential of combining multiple payloads in a single message. In addition, solutions in literature are unable to take advantage of the communication interactions that occur when there is traffic originating from different groups. To fill this gap, this paper focuses on a nontraditional data aggregation approach, named two‐tier aggregation, that applies the idea of inserting many payloads in 1 message to efficiently gather data from multiple groups, introducing novelty on how the messages are assembled. An integer linear programming model is proposed to maximize the network lifetime in multiple group scenarios. The proposed formulation guarantees the energy efficiency of two‐tier aggregation and defines an upper bound for the heuristics. The evaluation shows the lifetime upper bound obtained by the proposed integer linear programming model on different network sizes and compares it to state‐of‐the‐art heuristic solutions.