Check out the video below to watch us:
Walk through the library code
Update the send function to support passing an idempotencyKey
Discuss how to handle changing TypeScript
Test our changes
Be sure to Like the video and Subscribe to our YouTube channel.
Idempotency allows for safely retrying requests without accidentally performing the same operation twice. Imagine you were sending a notification using Courier and due to a network connection error, no response was received. At this point, you can't be sure if the notification was sent or not. No response means no messageId returned. An idempotent send would allow you to send the request again and if the message wasn't sent, it would send it. If it were sent, you would receive the messageId from the previous send. Courier supports idempotent requests for all POST requests by providing a unique key in the Idempotency-Key header. Any requests sent with the same idempotency key will be idempotent for as long as that key exists in our system. Learn more about how we handle Idempotent Requests in our API Reference documentation.
Once the changes Riley and I made are released, you'll be able to provide an idempotencyKey value in an optional config object for each function that sends a POST request.
Send Notification as an Idempotent Request
Is there something you’d like to see us do using Courier? Let us know and it might be the subject of our next Courier Live. We stream a new Courier Live every Wednesday at noon Pacific.
Follow us on Twitch to be notified when we go live!