> **For coding agents and LLMs:** This is one page from the Social Fetch docs (markdown export). For curated orientation and workflow guidance, start with [`/llms.txt`](https://www.socialfetch.dev/llms.txt); for agent onboarding and crawl rules, use [`/agents.txt`](https://www.socialfetch.dev/agents.txt); for the full endpoint list with links to pages like this one, use [`/llms-endpoints.txt`](https://www.socialfetch.dev/llms-endpoints.txt); for one platform's parameters and curls, use [`/llms-{platform}.txt`](https://www.socialfetch.dev/llms-tiktok.txt); use [`/llms.json`](https://www.socialfetch.dev/llms.json) when you need structured JSON for tool registration.

## This page

- **On-site (HTML):** <https://www.socialfetch.dev/docs/integrations/n8n/first-workflow>
- **Markdown (.mdx) URL:** <https://www.socialfetch.dev/docs/integrations/n8n/first-workflow.mdx>

## API base URL and authentication

- **API origin (from OpenAPI `servers`):** `https://api.socialfetch.dev`
- **Authentication:** send `x-api-key: sfk_...` on `/v1/**` and `/v2/**` routes unless the operation is explicitly anonymous (check OpenAPI `security`, the [API reference hub](https://www.socialfetch.dev/docs/api.mdx), [`/llms.txt`](https://www.socialfetch.dev/llms.txt), or [`/llms.json`](https://www.socialfetch.dev/llms.json) for each route).
- **OpenAPI JSON:** <https://www.socialfetch.dev/openapi.json>

## Recommended docs entrypoints (this site)

- [Documentation overview](https://www.socialfetch.dev/docs.mdx) — top-level orientation (markdown).
- [Quickstart](https://www.socialfetch.dev/docs/quickstart.mdx) — authenticate with `x-api-key`, validate auth with `whoami`, and understand the JSON envelope.
- [SDK](https://www.socialfetch.dev/docs/sdk.mdx) — official TypeScript SDK guide, including `SocialFetchClient`, `Result`, and `unwrap()`.
- [Capability matrix](https://www.socialfetch.dev/docs/capability-matrix.mdx) — every operation with identifiers, pagination, outcomes, media download, credits, and its SDK method. Generated from OpenAPI, so use it for route selection instead of scanning individual pages.
- [Recipes](https://www.socialfetch.dev/docs/recipes.mdx) — copyable workflows (brand monitoring, transcripts, Ad Library, creator scoring, Reddit research) with credit callouts and SDK examples.
- [Integrations](https://www.socialfetch.dev/docs/integrations.mdx) — MCP for AI clients, n8n verified node, Apify Store Actors, Make custom app, SDK, and REST API connection paths.
- [MCP product page](https://www.socialfetch.dev/mcp) — hosted MCP overview, OAuth, Skills install.
- [MCP integration](https://www.socialfetch.dev/docs/integrations/mcp.mdx) — hosted `/mcp` server, OAuth, Cursor/VS Code/Claude install snippets, 264 endpoint tools, plus docs_search/docs_read for implementation help.
- [n8n integration](https://www.socialfetch.dev/docs/integrations/n8n.mdx) — install `n8n-nodes-socialfetch`, credentials, and workflow examples.
- [Apify integration](https://www.socialfetch.dev/docs/integrations/apify.mdx) — Store Actors under @social-fetch, PPE billing, dataset export, and quick start.
- [Make integration](https://www.socialfetch.dev/docs/integrations/make.mdx) — custom app modules for Make scenarios, API key credentials, and module catalog.
- [`/llms-endpoints.txt`](https://www.socialfetch.dev/llms-endpoints.txt) — every documented operation with a direct link to that route's agent-readable markdown page (prefer this over parsing OpenAPI).
- [`/llms-{platform}.txt`](https://www.socialfetch.dev/llms-tiktok.txt) — per-platform endpoint files generated from OpenAPI (parameters, credits, curls).
- [`/agents.txt`](https://www.socialfetch.dev/agents.txt) — agent crawl/onboarding file with capabilities, auth rules, and allowlist.
- [`/llms.json`](https://www.socialfetch.dev/llms.json) — structured machine-readable operation inventory with parameter names, pagination, outcomes, credits, and SDK mapping.
- [API reference hub](https://www.socialfetch.dev/docs/api.mdx) — human-friendly index of operations with links into generated pages.
- [Errors](https://www.socialfetch.dev/docs/errors.mdx) — shared error envelope and HTTP status guidance.
- [Credits](https://www.socialfetch.dev/docs/credits.mdx) — metering, `402`, and planning batch jobs.
- Outcome semantics such as `found`, `not_found`, and `private` are documented in [Errors](https://www.socialfetch.dev/docs/errors.mdx) and on operation pages when present in the OpenAPI contract.

## Markdown docs convention

- Every docs page has a markdown twin: append **`.mdx`** to the docs pathname (for example `/docs/quickstart` → `/docs/quickstart.mdx`).
- Agents that send `Accept: text/markdown` on `/docs/**` HTML URLs may receive markdown directly (same URL, `Vary: Accept`).
- Published blog posts use the same convention: `/blog/{slug}` → `/blog/{slug}.mdx`, or `Accept: text/markdown` on the HTML URL (`Vary: Accept`).

---
# Your first n8n workflow: TikTok videos to Google Sheets (https://www.socialfetch.dev/docs/integrations/n8n/first-workflow)

In this tutorial you'll build a workflow that fetches a TikTok creator's latest videos and adds them to a Google Sheet: link, caption, views, likes and when each was posted. Then you'll set it to run every morning. You won't need any code.

You'll need:

* The Social Fetch node installed and your API key connected. If you haven't done that yet, follow [Steps 1 and 2 of the setup](/docs/integrations/n8n).
* A Google account, for Google Sheets.
* A few credits. Each run of this workflow makes one request.

  Import the [TikTok videos to Google Sheets template](/docs/integrations/n8n/templates#tiktok-videos-to-google-sheets), then open its **Add or update videos** node and pick your account and sheet (items 2 and 3 of Step 4).

## Step 1: Prepare the Google Sheet

Create a new Google Sheet and type these headers into the first row, one per column:

| Posted | Caption | Views | Likes | URL |
| ------ | ------- | ----- | ----- | --- |

n8n reads the header row to know which columns exist, so add them before you connect the sheet.

## Step 2: Start a workflow

1. In n8n, click **Create workflow** (or **+** in the top-left corner).
2. Click **Add first step** and choose **Trigger manually**. This trigger runs the workflow when you click **Execute workflow**, which is what you want while building. You'll swap it for a schedule at the end.

## Step 3: Fetch the videos

1. Click the **+** on the right of the trigger, search for **Social Fetch** and select it.
2. The panel lists every action, grouped by platform. Under **TikTok Actions**, choose **List TikTok profile videos**. (If you pick the wrong one, it doesn't matter: you can change **Resource** and **Operation** inside the node.)

3. Check that **Credential** shows your Social Fetch credential.
4. In **Handle**, type the creator's TikTok username without the @, for example `nasa`.
5. Leave **Return All** off. The first page holds the creator's most recent videos, which is all a daily check needs.
6. Click **Execute step**.

After a few seconds the output panel on the right fills with one row per video. Switch between **Table**, **JSON** and **Schema** at the top of the panel to explore the fields.

  Each **Execute step** sends a real request and uses credits. Click the **pin** icon at the top of the output panel to keep this result. While it's pinned, n8n reuses it instead of calling Social Fetch again, so you can work on the next steps for free. You'll unpin it in Step 6.

## Step 4: Add the videos to Google Sheets

1. Click the **+** on the right of the Social Fetch node, search for **Google Sheets** and choose **Append row in sheet**.
2. Under **Credential to connect with**, create a new credential and click **Sign in with Google**. On a self-hosted n8n, follow n8n's [Google credentials guide](https://docs.n8n.io/integrations/builtin/credentials/google/) first.
3. Set **Document** to your sheet (pick it **From list**) and **Sheet** to the tab with your headers.
4. Under **Mapping Column Mode**, choose **Map Each Column Manually**. A field appears for each header.
5. Fill each field by dragging from the input panel on the left, or paste these expressions:

| Column  | Value                     |
| ------- | ------------------------- |
| Posted  | `{{ $json.createdAt }}`   |
| Caption | `{{ $json.caption }}`     |
| Views   | `{{ $json.stats.views }}` |
| Likes   | `{{ $json.stats.likes }}` |
| URL     | `{{ $json.url }}`         |

6. Click **Execute step**. Your sheet now has a row for every video.

Because the Social Fetch node outputs one item per video, Google Sheets runs once per item and adds one row each. You don't need a loop or a **Split Out** node.

## Step 5: Run it every day without duplicates

Right now, every run adds the same videos again. Two changes make it a daily job:

1. **Update instead of append.** Open the Google Sheets node and change **Operation** to **Append or Update Row**. Set **Column to match on** to **URL**. Videos already in the sheet get their views and likes updated; new videos get a new row.
2. **Run on a schedule.** Delete the manual trigger. Add a **Schedule Trigger**, set **Trigger Interval** to **Days** and pick the hour, then connect it to the Social Fetch node.

## Step 6: Unpin and switch it on

1. Open the Social Fetch node and click the pin icon again to **unpin** it. Pinned data only applies while you test in the editor, but unpinning avoids confusion later.
2. Click **Execute workflow** once to check everything works end to end.
3. Click **Publish** at the top right. In older n8n versions, flip the **Inactive** toggle to **Active** instead.

From now on n8n runs the workflow every day, and you'll see each run under **Executions**. One run uses the credits for one request; see [Credits and billing](/docs/credits).

## Make it your own

* **Watch several creators.** Keep a list of handles in a second sheet, read it with **Get row(s) in sheet**, and set **Handle** to `{{ $json.handle }}`. Social Fetch runs once per row. See [Running the node for every row of a list](/docs/integrations/n8n/results#running-the-node-for-every-row-of-a-list).
* **Another platform.** The same pattern works for Instagram (**List Instagram profile media**), YouTube (**List YouTube channel videos**) and the rest. Field names differ per platform, so run the node once and check the output.
* **Get a message for each new video instead.** Use the [Social Fetch Trigger](/docs/integrations/n8n/watch-for-new-posts): it starts the workflow only when there's something new.

## Next steps

- [Working with results](/docs/integrations/n8n/results) — Items, Simplify, Return All and loops explained.

- [Watch for new posts](/docs/integrations/n8n/watch-for-new-posts) — Start a workflow whenever an account posts.

- [Workflow templates](/docs/integrations/n8n/templates) — More ready-made workflows to import.

- [Troubleshooting](/docs/integrations/n8n/troubleshooting) — Fix errors and empty results.