The emergence of machine-to-machine (M2M) technologies as a business opportunity is based on the observation that there are many more machines and objects in the world than people and that an everyday object has more value when it is networked. In this paper, we describe an M2M middleware that we have developed for a facility management application. Facility management is a time and labour-intensive service industry, which can greatly benefit from the use of M2M technologies for automating business processes. The need to manage diverse facilities motivates several requirements, such as predictive maintenance, inventory management, access control, location tracking, and remote monitoring, for which an M2M solution would be useful. Our middleware includes software modules for interfacing with intelligent devices that are deployed in customer facilities to sense real-world conditions and control physical devices; communication modules for relaying data from the devices in the customer premises to a centralized data center; and service modules that analyze the data and trigger business events. We also present performance results of our middleware using our testbed and show that our middleware is capable of scalably and reliably handling concurrent events generated by different types of M2M devices, such as RFID tags, Zigbee sensors, and location tracking tags.