Closed TylerMatteo closed 1 week ago
@dhochbaum-dcp it might be worth testing how long it takes SG to actually create the contact by calling the endpoints with curl or something like Postman. If it's too long to have our endpoint by synchronous, we can pivot accordingly, but testing ahead of time could save you the effort of writing the polling code if we don't actually need it.
Add new endpoint to ZAP Search API that creates a new contact in SendGrid and adds that user to the List for the current ZAP Search environment.
New endpoint should exist as a
POST
to/subscribers
and take in a POST body with shape:List names are
zap-subscribers-staging
for staging andzap-subscribers-production
for production.Validation
The endpoint should perform the following validations on the supplied
POST
body and return the given error codesAdding subscriber
200
success response code.Once data is validated, the subscriber should be created and added to the list. See SendGrid docs for adding/updating a contact here. Note that request body can take in List IDs that the contact should be added to.
Note the following from SG's docs describing how contact creation is an asynchronous process:
Our endpoint should still be synchronous, so endpoint code may require implementing polling with a max wait time. Let's start with 3 seconds and see how fast SG's APIs are.