Skip to content

Instantly share code, notes, and snippets.

@Cabeda
Created March 25, 2023 15:34
Show Gist options
  • Save Cabeda/72d3182a1b727082e99c6dd0792437d4 to your computer and use it in GitHub Desktop.
Save Cabeda/72d3182a1b727082e99c6dd0792437d4 to your computer and use it in GitHub Desktop.
import { Client } from "npm:@notionhq/client@2";
const notion = new Client({ auth: Deno.env.get("NOTION_API_KEY") });
(async () => {
const databaseId = "af3db26e54964a939c1f6bf32c79364e";
const response = await notion.databases.query({
database_id: databaseId,
filter: {
and: [
{
property: "Tags",
multi_select: {
contains: "newsletter",
},
},
],
},
sorts: [
{
property: "Created time",
direction: "ascending",
},
],
});
const results = response.results;
results.map((x) => {
notion.pages.update({
page_id: x.id,
archived: true,
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment