Communicating with Metamask extension from another extension

Ok, so in a nutshell, I’m building a chromium extension that, under certain conditions, must prompt user to confirm an eth transaction.
I’d like my extension to be able to work with Metamask for this purpose as well. But, unfortunately, I’m not sure how this can be achieved. In Metamask sources I see that it accepts incoming connections similar to chrome.runtime.connect("nkbihfbeogaeaoehlefnkodbefgpgknn") (for chrome) from external extensions, but from there I’m not sure how I am supposed to communicate with MM and what my possible API is…

It would be exceptionally helpful if one could advise where to read about this, or maybe point to some code samples