Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Latest commit

 

History

History
76 lines (51 loc) · 2.56 KB

README.md

File metadata and controls

76 lines (51 loc) · 2.56 KB

Important

This repo has been moved to Pocket's Monorepo

Braze Content Proxy API

Provides Pocket Hits stories to be consumed by Connected Content blocks in Braze.

Application Overview

Caching

API-side caching

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-side caching

Braze caches Connected Content for a minimum of five minutes (and recommends setting the value to 15 minutes): Connected Content: Configurable Caching.

Local Development

  • 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!

Testing the proxy on Dev

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.