The boot latch microswitch is "probably" OK, I have a few spares if you really do need one.....
My experience is that plastic/nylon interior parts of the boot latch wear or break. The "usual" problem (based on my multiple experiences and taking the latches apart) is that the boot will then not latch shut at all or jams.
The microswitch not being triggered is probably secondary - if you take one apart you'll see why.
To be honest, it's best to get a good latch from our sponsors, and check it works properly before fitting as well. (I have been sent a faulty one, which was speedily replaced with absolutely quibble at no cost to me.)
You can check it opens and closes properly by using a chunky screwdriver shaft to emulate the latching post, and test the wiring/microswitch with a multimeter.
Replacing the latch isn't at all difficulty, though you do have to take the boot lid interior trim off to get at it. Due to excess practice I can do that in about 5 minutes!
If you can risk having the car without a boot latch for a few days take it off and investigate. If, like me, it's parked outside and accessible get a spare first.
But if it's failing there's a good chance that when you remove it the damaged parts may just fall out making it inoperable.