diff --git a/packages/backend/src/apps/invoice-ninja/assets/favicon.svg b/packages/backend/src/apps/invoice-ninja/assets/favicon.svg
new file mode 100644
index 00000000..59d3f11f
--- /dev/null
+++ b/packages/backend/src/apps/invoice-ninja/assets/favicon.svg
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/packages/backend/src/apps/invoice-ninja/auth/index.ts b/packages/backend/src/apps/invoice-ninja/auth/index.ts
new file mode 100644
index 00000000..7b86fb5e
--- /dev/null
+++ b/packages/backend/src/apps/invoice-ninja/auth/index.ts
@@ -0,0 +1,33 @@
+import verifyCredentials from './verify-credentials';
+import isStillVerified from './is-still-verified';
+
+export default {
+ fields: [
+ {
+ key: 'apiToken',
+ label: 'API Token',
+ type: 'string' as const,
+ required: true,
+ readOnly: false,
+ value: null,
+ placeholder: null,
+ description:
+ 'Tokens can be created in the v5 app on Settings > Account Management',
+ clickToCopy: false,
+ },
+ {
+ key: 'instanceUrl',
+ label: 'Invoice Ninja instance URL (optional)',
+ type: 'string' as const,
+ required: false,
+ readOnly: false,
+ value: null,
+ placeholder: null,
+ description: "Leave this field blank if you're using hosted platform.",
+ clickToCopy: true,
+ },
+ ],
+
+ verifyCredentials,
+ isStillVerified,
+};
diff --git a/packages/backend/src/apps/invoice-ninja/auth/is-still-verified.ts b/packages/backend/src/apps/invoice-ninja/auth/is-still-verified.ts
new file mode 100644
index 00000000..5a2fe2ae
--- /dev/null
+++ b/packages/backend/src/apps/invoice-ninja/auth/is-still-verified.ts
@@ -0,0 +1,10 @@
+import { IGlobalVariable } from '@automatisch/types';
+import verifyCredentials from './verify-credentials';
+
+const isStillVerified = async ($: IGlobalVariable) => {
+ await verifyCredentials($);
+
+ return true;
+};
+
+export default isStillVerified;
diff --git a/packages/backend/src/apps/invoice-ninja/auth/verify-credentials.ts b/packages/backend/src/apps/invoice-ninja/auth/verify-credentials.ts
new file mode 100644
index 00000000..cba2c60f
--- /dev/null
+++ b/packages/backend/src/apps/invoice-ninja/auth/verify-credentials.ts
@@ -0,0 +1,15 @@
+import { IGlobalVariable } from '@automatisch/types';
+
+const verifyCredentials = async ($: IGlobalVariable) => {
+ const { data } = await $.http.get('/v1/ping');
+
+ const screenName = [data.user_name, data.company_name]
+ .filter(Boolean)
+ .join(' @ ');
+
+ await $.auth.set({
+ screenName,
+ });
+};
+
+export default verifyCredentials;
diff --git a/packages/backend/src/apps/invoice-ninja/common/add-auth-header.ts b/packages/backend/src/apps/invoice-ninja/common/add-auth-header.ts
new file mode 100644
index 00000000..ca5ca292
--- /dev/null
+++ b/packages/backend/src/apps/invoice-ninja/common/add-auth-header.ts
@@ -0,0 +1,20 @@
+import { TBeforeRequest } from '@automatisch/types';
+
+const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
+ const { instanceUrl } = $.auth.data;
+
+ if (instanceUrl) {
+ requestConfig.baseURL = instanceUrl as string;
+ }
+
+ requestConfig.headers['X-API-TOKEN'] = $.auth.data.apiToken as string;
+
+ requestConfig.headers['X-Requested-With'] = 'XMLHttpRequest';
+
+ requestConfig.headers['Content-Type'] =
+ requestConfig.headers['Content-Type'] || 'application/json';
+
+ return requestConfig;
+};
+
+export default addAuthHeader;
diff --git a/packages/backend/src/apps/invoice-ninja/index.d.ts b/packages/backend/src/apps/invoice-ninja/index.d.ts
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/backend/src/apps/invoice-ninja/index.ts b/packages/backend/src/apps/invoice-ninja/index.ts
new file mode 100644
index 00000000..9c8d681b
--- /dev/null
+++ b/packages/backend/src/apps/invoice-ninja/index.ts
@@ -0,0 +1,16 @@
+import defineApp from '../../helpers/define-app';
+import addAuthHeader from './common/add-auth-header';
+import auth from './auth';
+
+export default defineApp({
+ name: 'Invoice Ninja',
+ key: 'invoice-ninja',
+ baseUrl: 'https://invoiceninja.com',
+ apiBaseUrl: 'https://invoicing.co/api',
+ iconUrl: '{BASE_URL}/apps/invoice-ninja/assets/favicon.svg',
+ authDocUrl: 'https://automatisch.io/docs/apps/invoice-ninja/connection',
+ primaryColor: '000000',
+ supportsConnections: true,
+ beforeRequest: [addAuthHeader],
+ auth,
+});
diff --git a/packages/docs/pages/.vitepress/config.js b/packages/docs/pages/.vitepress/config.js
index a1a77c5a..51b78622 100644
--- a/packages/docs/pages/.vitepress/config.js
+++ b/packages/docs/pages/.vitepress/config.js
@@ -169,6 +169,14 @@ export default defineConfig({
{ text: 'Connection', link: '/apps/hubspot/connection' },
],
},
+ {
+ text: 'Invoice Ninja',
+ collapsible: true,
+ collapsed: true,
+ items: [
+ { text: 'Connection', link: '/apps/invoice-ninja/connection' },
+ ],
+ },
{
text: 'Mattermost',
collapsible: true,
diff --git a/packages/docs/pages/apps/invoice-ninja/connection.md b/packages/docs/pages/apps/invoice-ninja/connection.md
new file mode 100644
index 00000000..e72bbe22
--- /dev/null
+++ b/packages/docs/pages/apps/invoice-ninja/connection.md
@@ -0,0 +1,16 @@
+# Invoice Ninja
+
+:::info
+This page explains the steps you need to follow to set up the Invoice Ninja connection in Automatisch. If any of the steps are outdated, please let us know!
+:::
+
+1. Go to the [Invoice Ninja](https://invoiceninja.com/).
+2. Login into your account.
+3. Click on the your company name.
+4. Click on the **Account Management** option.
+5. Click on the **Integrations** tab.
+6. Click on the **API Tokens**. (You need to have a paid account to be able to see that.)
+7. Click on the **New Token** button and create a new api token.
+8. Copy **Token** field and paste it to the **API Token** field in Automatisch connection creation page.
+9. Click the **Submit** button on Automatisch.
+10. Now, you can start using the Invoice Ninja connection with Automatisch.
diff --git a/packages/docs/pages/public/favicons/invoice-ninja.svg b/packages/docs/pages/public/favicons/invoice-ninja.svg
new file mode 100644
index 00000000..59d3f11f
--- /dev/null
+++ b/packages/docs/pages/public/favicons/invoice-ninja.svg
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file