How to export the complete activities log of your Storyblok space
Storyblok is the first headless CMS that works for developers & marketers alike.
In this article you will learn how to use the Mangement API of Storyblok to download your Activities log as .csv
utilizing node.js.
Set-up & install dependencies
Next you can exchange the content of the package.json
with the following one:
This will add the dependencies axios
, axios-concurrency
, flat
, and json2csv
which allows us to easily access the Management API, flatten the JSON we receive from the activities endpoint and convert JSON to csv so we can than write it as a file.
Install the dependencies so we can start creating the actual script itself.
Creating the Node Script
Create a index.js
with the following content. The comments will guide you through the whole implementation. You will need your personal access token to exchange the STORYBLOK_MANAGEMENT_TOKEN
placeholder and your space id to replace STORYBLOK_SPACE_ID
.
After adding the above content you can execute it using node index.js
which will write out a log-timestamp.csv
in your current directory.
Summary
With just a few lines of code you can not only access the whole activities log and easily run custom filters on it using Excel, archive it, export it for an audit or any other case you might want to access your logs of your Storyblok space.