> ## Documentation Index
> Fetch the complete documentation index at: https://getalchemystai.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrating Alchemyst ai with n8n

> Store and search data in Alchemyst using n8n workflows

## What You'll Build

A simple n8n workflow that captures form submissions and stores them in Alchemyst so you can search them later.

## What You Need

* An Alchemyst API key from your [dashboard](https://platform.getalchemystai.com/settings)
* Basic familiarity with n8n

## Step 1: Create a Webhook

1. In n8n, create a new workflow
2. Add a **Webhook** node
3. Copy the test URL
4. Send a test request with this JSON:

```json theme={null}
{
    "name": "John Doe",
    "email": "john@example.com",
    "message": "Hello, I need help with my account"
}
```

## Step 2: Add HTTP Request Node

1. Add an **HTTP Request** node after the webhook
2. Set these values:

* **Method**: POST
* **URL**: `https://platform-backend.getalchemystai.com/api/v1/context/add`

3. Under **Authentication**, select **Generic Credential Type** → **Bearer Token**
4. Create a new credential and paste your Alchemyst API key
5. Set **Body Content Type** to **JSON**
6. Set **Specify Body** to **JSON**
7. In the **JSON** field, paste this expression:

```javascript theme={null}
{{ JSON.stringify({
  documents: [
    {
      content: $json.body?.message ?? $json.message ?? "",
      metadata: {
        name: $json.body?.name ?? $json.name ?? "",
        email: $json.body?.email ?? $json.email ?? ""
      }
    }
  ],
  source: `contact-form-${DateTime.now().toMillis()}`,
  context_type: "resource",
  scope: "internal",
  metadata: {
    fileName: `contact_form_${DateTime.now().toMillis()}.json`,
    fileType: "contact/form",
    fileSize: (($json.body?.message ?? $json.message ?? "").length) * 8,
    lastModified: $now.toISO()
  }
}) }}
```

## Step 3: Test It

1. Click **Execute Workflow**
2. You should see a success response
3. Go to your [Alchemyst dashboard](https://platform.getalchemystai.com) to verify the data was saved

## Congratulations! 🎉

You've successfully built your first Alchemyst workflow in n8n! Your workflow is now capturing form submissions and storing them as searchable context in Alchemyst.

## Complete Workflow for Reference

Here's the complete workflow you just built. You can import this directly into n8n:

**To use:** Copy the JSON below → In n8n, go to **Workflows** → **Import from URL or File** → Paste and import → Add your Alchemyst API key to the credential.

```json theme={null}
{
    "name": "Alchemyst – Store Contact Forms",
    "nodes": [
        {
            "id": "WebhookContactForm",
            "name": "Webhook",
            "type": "n8n-nodes-base.webhook",
            "typeVersion": 1,
            "position": [
                -200,
                300
            ],
            "parameters": {
                "httpMethod": "POST",
                "path": "contact-form",
                "responseMode": "onReceived",
                "options": {}
            }
        },
        {
            "id": "SendToAlchemyst",
            "name": "Send to Alchemyst",
            "type": "n8n-nodes-base.httpRequest",
            "typeVersion": 4.3,
            "position": [
                200,
                300
            ],
            "parameters": {
                "method": "POST",
                "url": "https://platform-backend.getalchemystai.com/api/v1/context/add",
                "authentication": "genericCredentialType",
                "genericAuthType": "httpBearerAuth",
                "sendBody": true,
                "specifyBody": "json",
                "jsonBody": "={{ JSON.stringify({\n  documents: [\n    {\n      content: $json.body?.message ?? $json.message,\n     metadata: {\n        name: $json.body?.name ?? $json.name,\n        email: $json.body?.email ?? $json.email,\n      },\n    },\n  ],\n  source: `contact-form-${DateTime.now().toMillis()}`,\n  context_type: \"resource\",\n  scope: \"internal\",\n  metadata: {\n    fileName: `contact_form_${DateTime.now().toMillis()}.json`,\n    fileSize: (($json.body?.message ?? $json.message)?.length ?? 0) * 8,\n    fileType: \"contact/form\",\n    lastModified: $now.toISO(),\n  },\n}) }}"
            },
            "credentials": {
                "httpBearerAuth": {
                    "id": "",
                    "name": "Alchemyst API Key"
                }
            }
        }
    ],
    "connections": {
        "Webhook": {
            "main": [
                [
                    {
                        "node": "Send to Alchemyst",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        }
    },
    "active": false,
    "settings": {
        "executionOrder": "v1"
    }
}
```

## Learn More

* [n8n Integration Guide](/integrations/no-code-tools/n8n)
* [API Reference](/api-reference/introduction)
