blob: d3f50bd5ff8e058fc385a1f8c925a848e0f7cfa8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
---
title: "n8n Integration"
description: "Automate knowledge management with Supermemory in n8n workflows"
sidebarTitle: "n8n"
---
Connect Supermemory to your n8n workflows to build intelligent automation workflows and agents that leverage your full knowledge base.
## Quick Start
### Prerequisites
- n8n instance (self-hosted or cloud)
- Supermemory API key ([get one here](https://console.supermemory.com/settings))
- Basic understanding of n8n workflows
### Setting Up the HTTP Request Node
The Supermemory integration in n8n uses the HTTP Request node to interact with the Supermemory API. Here's how to configure it:
1. Add an **HTTP Request** node to your workflow (Core > HTTP Request)

2. Set the **Method** to `POST`
3. Set the **URL** to the appropriate Supermemory API endpoint:
- Add memory: `https://api.supermemory.ai/v3/documents`
- Search memories: `https://api.supermemory.ai/v4/search`
4. For authentication, select **Generic Credential Type** and then **Bearer Auth**
5. Click on **Create New Credential** and paste the Supermemory API Key in the Bearer Token field.

6. Check **Send Body** and select **JSON** as the Body Content Type. The fields depend on what API endpoint you're sending the request to. You can find detailed step-by-step examples below.
## Step-by-Step Tutorial
In this tutorial, we'll create a workflow that automatically adds every email from Gmail to your Supermemory knowledge base. We'll use the HTTP Request node to send email data to Supermemory's API, creating a searchable archive of all your communications.
### Adding Gmail Emails to Supermemory
Follow these steps to build a workflow that captures and stores your Gmail messages:
#### Step 1: Set Up Gmail Trigger

1. **Add a Gmail Trigger node** to your workflow
2. Configure your Gmail credentials (OAuth2 recommended)
3. Set the trigger to **Message Received**
4. Optional: Add labels or filters to process specific emails only
#### Step 2: Configure HTTP Request Node
1. **Add an HTTP Request node** after the Gmail Trigger
2. **Method**: `POST`
3. **URL**: [`https://api.supermemory.ai/v3/documents`](/api-reference/manage-documents/add-document)
4. Select your auth credentials you created with the Supermemory API Key.
#### Step 3: Format Email Data for Supermemory
In the HTTP Request node's **Body**, select **JSON** and **Using Fields Below**
And create 2 fields:
1. name: `content`, value: `{{ $json.snippet }}`
2. name: `containerTag`, value: gmail

#### Step 4: Handle Attachments (Optional)
If you want to process attachments:
1. **Add a Loop node** after the Gmail Trigger
2. Loop through `{{$json.attachments}}`
3. **Add a Gmail node** to download each attachment
4. **Add another HTTP Request node** to store attachment metadata
#### Step 5: Add Error Handling
1. **Add an Error Trigger node** connected to your workflow
2. Configure it to catch errors from the HTTP Request node
3. **Add a notification node** (Email, Slack, etc.) to alert you of failures
4. Optional: Add a **Wait node** with retry logic
#### Step 6: Test Your Workflow
1. **Activate the workflow** in test mode
2. Send a test email to your Gmail account
3. Check the execution to ensure the email was captured
4. Verify in Supermemory that the email appears in search results
Refer to the [API reference](/api-reference/manage-documents/add-document) to learn more about other supermemory API endpoints.
|