With information from here, you need the org-plus-contrib package that is available through the org-mode elpa. So to install it by your favorite way you have to add it to package-archives via (if you don't already have it):
'("org" . "https://orgmode.org/elpa/") t)
Then the org-plus-contrib package will ...
You almost have the answer. The only problem is that the value returned by org-contacts-filter has several parts that need to be unpacked before you get to the assoc list. A bit of experimenting gave me this, which seems to work:
(cdr (assoc "ID"
(nth 2 (car
(org-contacts-filter "Example Contact")))))
The second line is ...
Finally, I did it myself, and I am posting it here to help people looking for a solution to my problem.
I decided to use tags to specify a group of emails, thus the same contact can be part of several groups simply by tagging it several times.
Here is an example of contacts file:
* John Doe :MailingListA:GroupB: