-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pull the latest version of a letter template #593
Comments
Hi @paramsiddharth may I work on this? |
@nancy-luu realized that we will be updating CampaignID within letterversion.js and that will be called in lob.js in createLetter - updated instructions to reflect this |
Hi @manishapriya94 and @Alex-is-Gonzalez , please see my notes below for this issue. When trying to implement the suggested solution above, there are a few points that I feel needs clarity.
|
For reference from Devs + QA Data StructuresCampaigns id is the key identifier as there can be multiple orgs to one campaign
letter_versions keyID: use to create join or belong relationships for Users, Campaigns, and Letters sent |
User story: letters are updating by campaigns depending on which stage an action is in the middle of. Today we call in the letter template but if there is a new version
Directions
To update the Letterversion.js (amplify/server/routes/api/letter_versions.js) component to include the latest version of a letter, you can modify the campaignID function to retrieve the latest version of the letter from the Lob API. Here are the steps you can follow:
This code retrieves the latest version of the letter from the Lob API using the getLatestVersion action, and merges it with the existing letter data using the spread operator.
This code sends a GET request to the /api/letters/${letterId}/versions/latest endpoint to retrieve the latest version of the letter from the Lob API.
This code sends a GET request to the Lob API to retrieve the list of versions for the specified letter ID, and returns the latest version in the response.
That's it! With these changes, the LetterLoad component should now retrieve the latest version of the letter from the Lob API. Note that you will need to modify the getLatestVersion action and server-side route handler to match your specific implementation.
The text was updated successfully, but these errors were encountered: