Disclosed is a messaging system that can be used with either a locked or unlocked container to indicate an elapsed time, such as an elapsed time for taking medication, unauthorized movement, or opening of the container. A capsule placed in the container communicates to an application that may generate alerts for vial openings, failure to open vial when medication due, pilfering or unauthorized movement. A battery in the capsule can be recharged through contacts or induction charging. Various types of sensors can be used in the capsule, including pressure sensors, light sensors, an accelerometer, a capacitive sensor, and a conductive sensor.