I've gotten a good user flow established with a custom API integration so far, but I'm running into issues where it seems when too many people submit the form at once, the token doesn't have enough time to get returned to be used by the next request and ends up being blank and causing authentication errors. Then I have to manually refresh it.
This is a terrible UX though and is causing loss of leads. I have created somewhat of a workaround by logging the user data and then using a cron job that does a bulk add/update into the list. However, I still need to check if the email is already in the list because when they're added they receive a promo code that gets inserted as a custom field. As it is now, the same person could keep submitting the form and get multiple codes because it will just update the custom field with the new code.
My concern is that I'll just run into the same issue with the token breaking when multiple people submit the form because it's having to use the token and refresh it for every form submission. I can't use the same workaround since the user needs to immediately be given a message telling them if the email exists already.
Is there some solution to this? As far as I know I have to refresh the token for every single request and that will be problematic if multiple people submit the form within milliseconds of each other.
Thank you for any insight you might have
Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.
You should only need to refresh the token when it expires, rather than every time you send a request.
You may still run into a 429 error if too many people submit the form at the exact same time, but in that case you should be able to retry the failed request using the same token.
View API documentation, code samples, get your API key.Visit Page
Join our list to be notified of new features and updates to our V3 API.Sign Up