An ingestible capsule (10) is provided for delivery of a drug, the capsule (10) comprises a first module (11) and a second module (12). The first module (11) has at least one drug compartment (13) for comprising an amount of the drug. The drug compartment (13) is sealed by a foil (14) with an embedded conducting heating wire (15). The second (12) module comprises electronics (18) for providing an electrical pulse to the heating wire (15) in order to open the drug compartment (13) by melting the foil (14). The first module (11) and second module (12) comprise interoperable connection means (19) for securing the first module (11) to the second module (12) such that the heating wire (15) is electronically coupled to the electronics (18).