I'm finding this far more difficult than I feel it should be.
I'm migrating over to SendGrid's new marketing features. It's a requirement of our code that when a contact is added into SendGrid, we get the SendGrid contact ID and store it with the associated user in our database. This is so that when the users account is deleted, or they change their email address (it will be unverified so we don't store it in SendGrid as a contact until verified) we can delete the SendGrid contact.
When you add a contact, the request is put into a job and is at some point in the future added to SendGrid. There is no apparent callbacks to our server available, and polling SendGrid every few minutes to try and search for the SendGrid contact ID seems like a horrible design.
What's the best way to get the SendGrid contact ID after adding them as a contact? Polling for the contact ID might lead to some race conditions where contacts have been added and not subsequently removed if the user changes their email address before the contact ID is acquired (and other cases that are hard to design for).