Important
This repo has been moved to Pocket's Monorepo
Provides Pocket Hits stories to be consumed by Connected Content blocks in Braze.
- Express is the Node framework,
- Apollo Client is used in Express to request data from
- Client API.
- Pocket Image Cache, a Pocket service, is also used to resize image thumbnails on the fly for use in emails.
The API sets a two-minute cache on its output via a Cache-Control
header. There is no caching of results from Client API, so any updates to curated stories and scheduling on Pocket Hits surfaces should be visible with a maximum of two-minute lag.
Braze caches Connected Content for a minimum of five minutes (and recommends setting the value to 15 minutes): Connected Content: Configurable Caching.
- Clone the repository:
git clone [email protected]:Pocket/braze-content-proxy.git
cd braze-content-proxy
- Install the packages:
npm install
- Start the app:
npm run start:dev
- Load
http://localhost:4500
in your browser. Done!
Note that it's often more convenient to work with test data curated on Dev, so the local setup is mainly useful for running tests and lint checks.
- Push the branch you're working on to Dev:
git push -f origin YOUR_BRANCH_HERE:dev
and wait for the deployment to complete (~10 minutes).
- to get scheduled items for a given day:
# params required
https://braze-content-proxy.getpocket.dev/scheduled-items/[SCHEDULED_SURFACE_GUID]/?date=[DATE_IN_YYYY-MM-DD_FORMAT]&apikey=[LOOK_UP_THE_KEY_IN_AWS]
# sample URL (don't forget to supply the API key)
https://braze-content-proxy.getpocket.dev/scheduled-items/POCKET_HITS_EN_US/?date=2022-05-27&apikey=[INSERT_API_KEY]
- to get a collection by slug:
# params required
https://braze-content-proxy.getpocket.dev/collection/[COLLECTION_SLUG]/?apikey=[LOOK_UP_THE_KEY_IN_AWS]
# sample URL (don't forget to supply the API key)
https://braze-content-proxy.getpocket.dev/collection/halloween-history?apikey=[LOOK_UP_THE_KEY_IN_AWS]
- Now you can do a sanity check for the data returned by the proxy.