Skip to content

feat: n8n Integration #578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/svg/n8n.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 16 additions & 4 deletions src/components/integration/IntegrationSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface IntegrationSettings {
airtableTableName?: string,
airtableTableId?: string,
data: string;
integrationType: "googleSheets" | "airtable";
integrationType: "googleSheets" | "airtable"| "n8n";
}

const getCookie = (name: string): string | null => {
Expand Down Expand Up @@ -84,7 +84,7 @@ export const IntegrationSettingsModal = ({
const navigate = useNavigate();

const [selectedIntegrationType, setSelectedIntegrationType] = useState<
"googleSheets" | "airtable" | null
"googleSheets" | "airtable" | "n8n" | null
>(preSelectedIntegrationType);

const authenticateWithGoogle = () => {
Expand Down Expand Up @@ -394,7 +394,7 @@ export const IntegrationSettingsModal = ({
}}
style={{ display: "flex", flexDirection: "column", alignItems: "center", background: 'white', color: '#ff00c3' }}
>
<img src="/public/svg/gsheet.svg" alt="Google Sheets" style={{ margin: "6px" }} />
<img src="/svg/gsheet.svg" alt="Google Sheets" style={{ margin: "6px" }} />
Google Sheets
</Button>

Expand All @@ -407,9 +407,21 @@ export const IntegrationSettingsModal = ({
}}
style={{ display: "flex", flexDirection: "column", alignItems: "center", background: 'white', color: '#ff00c3' }}
>
<img src="/public/svg/airtable.svg" alt="Airtable" style={{ margin: "6px" }} />
<img src="/svg/airtable.svg" alt="Airtable" style={{ margin: "6px" }} />
Airtable
</Button>
<Button
variant="outlined"
onClick={() => {
setSelectedIntegrationType("airtable");
setSettings({ ...settings, integrationType: "n8n" });
navigate(`/robots/${recordingId}/integrate/n8n`);
}}
style={{ display: "flex", flexDirection: "column", alignItems: "center", background: 'white', color: '#ff00c3' }}
>
<img src="/svg/n8n.svg" alt="n8n" height={100} width={100} style={{ margin: "30px" }} />
n8n
</Button>
Comment on lines +413 to +424
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Missing UI implementation for n8n integration settings.

While the n8n integration type has been added to the interface and a button has been added to select it, there's no corresponding UI implementation for n8n integration settings in the modal. The modal only has conditions for handling "googleSheets" and "airtable" types, but nothing for "n8n".

Add a condition for handling the n8n integration type in the modal, similar to how the other integration types are implemented. This can be done by adding a new conditional block in the return statement around line 654:

{settings.integrationType === "n8n" && (
  <>
    <Typography variant="h6">
      {t("integration_settings.n8n.title") || "n8n Integration"}
    </Typography>
    
    {/* Add n8n specific UI elements here */}
    <p>{t("integration_settings.n8n.descriptions.sync_info") || "Connect your Robot to n8n workflows."}</p>
    
    {/* Additional implementation as needed */}
  </>
)}

⚠️ Potential issue

Added n8n integration button but with incorrect integration type.

The button for the n8n integration was added, but there's an inconsistency in the implementation. When the button is clicked, setSelectedIntegrationType("airtable") is called instead of setSelectedIntegrationType("n8n").

Fix the integration type being set when the n8n button is clicked:

-                setSelectedIntegrationType("airtable");
+                setSelectedIntegrationType("n8n");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Button
variant="outlined"
onClick={() => {
setSelectedIntegrationType("airtable");
setSettings({ ...settings, integrationType: "n8n" });
navigate(`/robots/${recordingId}/integrate/n8n`);
}}
style={{ display: "flex", flexDirection: "column", alignItems: "center", background: 'white', color: '#ff00c3' }}
>
<img src="/svg/n8n.svg" alt="n8n" height={100} width={100} style={{ margin: "30px" }} />
n8n
</Button>
<Button
variant="outlined"
onClick={() => {
- setSelectedIntegrationType("airtable");
+ setSelectedIntegrationType("n8n");
setSettings({ ...settings, integrationType: "n8n" });
navigate(`/robots/${recordingId}/integrate/n8n`);
}}
style={{ display: "flex", flexDirection: "column", alignItems: "center", background: 'white', color: '#ff00c3' }}
>
<img src="/svg/n8n.svg" alt="n8n" height={100} width={100} style={{ margin: "30px" }} />
n8n
</Button>

</div>
</div>
</GenericModal>
Expand Down
6 changes: 4 additions & 2 deletions src/components/recorder/SaveRecording.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useSocketStore } from "../../context/socket";
import { TextField, Typography } from "@mui/material";
import { WarningText } from "../ui/texts";
import NotificationImportantIcon from "@mui/icons-material/NotificationImportant";
import { useNavigate } from 'react-router-dom';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';

interface SaveRecordingProps {
Expand Down Expand Up @@ -55,6 +55,8 @@ export const SaveRecording = ({ fileName }: SaveRecordingProps) => {
const handleFinishClick = () => {
if (recordingName && !recordings.includes(recordingName)) {
saveRecording();


} else {
setOpenModal(true);
}
Expand Down Expand Up @@ -191,4 +193,4 @@ const modalStyle = {
height: 'fit-content',
display: 'block',
padding: '20px',
};
};