How to implement Slack’s cursor based pagination spec with DynamoDB

Here’s how I implemented Slack’s cursor based pagination specs with DynamoDB, but also included traveling backwards.