INTEGRATIONS / RUNTIME RECIPE

pageflock, meet Deno.

Run a standalone Deno script that can read only your pageflock key and connect only to pageflock's HTTPS endpoint.

← All integrations

Your first connection.

  1. 01

    Set WAGGLE_API_KEY in your shell and save the example below as waggle.ts.

  2. 02

    Run deno run --allow-env=WAGGLE_API_KEY --allow-net=pageflock.hyvelabs.tech waggle.ts.

  3. 03

    Read the response and credits header. If you change the pageflock hostname, update the scoped network permission too.

Tool reference: Deno documentation ↗

Build the request.

Set the environment variables in your terminal for these code examples. In automation tools, enter the URL and credentials in the tool’s own fields.

waggle.tsTypeScript · Deno
const apiKey = Deno.env.get("WAGGLE_API_KEY");
if (!apiKey) throw new Error("Set WAGGLE_API_KEY");
const response = await fetch("https://pageflock.hyvelabs.tech/api/pageflock/v1/scrape", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ url: "https://example.com" }),
  signal: AbortSignal.timeout(45000),
});
const result: unknown = await response.json();
if (!response.ok) {
  throw new Error(`pageflock HTTP ${response.status}: ${JSON.stringify(result)}`);
}
console.log("Credits used:", response.headers.get("X-PageFlock-Credits-Used") ?? response.headers.get("X-Waggle-Credits-Used"));
console.log(result);
export {};

Reading or copying this example does not send a request or use credits.

YOUR PRIVACY

Choose what works for you. You can reopen these settings from the footer at any time.