diff --git a/packages/backend/src/apps/better-stack/assets/favicon.svg b/packages/backend/src/apps/better-stack/assets/favicon.svg
new file mode 100644
index 00000000..44941408
--- /dev/null
+++ b/packages/backend/src/apps/better-stack/assets/favicon.svg
@@ -0,0 +1,21 @@
+
+
+
diff --git a/packages/backend/src/apps/better-stack/auth/index.ts b/packages/backend/src/apps/better-stack/auth/index.ts
new file mode 100644
index 00000000..ad209ade
--- /dev/null
+++ b/packages/backend/src/apps/better-stack/auth/index.ts
@@ -0,0 +1,33 @@
+import verifyCredentials from './verify-credentials';
+import isStillVerified from './is-still-verified';
+
+export default {
+ fields: [
+ {
+ key: 'screenName',
+ label: 'Screen Name',
+ type: 'string' as const,
+ required: true,
+ readOnly: false,
+ value: null,
+ placeholder: null,
+ description:
+ 'Screen name of your connection to be used on Automatisch UI.',
+ clickToCopy: false,
+ },
+ {
+ key: 'apiKey',
+ label: 'API Key',
+ type: 'string' as const,
+ required: true,
+ readOnly: false,
+ value: null,
+ placeholder: null,
+ description: 'Better Stack API key of your account.',
+ clickToCopy: false,
+ },
+ ],
+
+ verifyCredentials,
+ isStillVerified,
+};
diff --git a/packages/backend/src/apps/better-stack/auth/is-still-verified.ts b/packages/backend/src/apps/better-stack/auth/is-still-verified.ts
new file mode 100644
index 00000000..66bb963e
--- /dev/null
+++ b/packages/backend/src/apps/better-stack/auth/is-still-verified.ts
@@ -0,0 +1,9 @@
+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/better-stack/auth/verify-credentials.ts b/packages/backend/src/apps/better-stack/auth/verify-credentials.ts
new file mode 100644
index 00000000..a009210d
--- /dev/null
+++ b/packages/backend/src/apps/better-stack/auth/verify-credentials.ts
@@ -0,0 +1,12 @@
+import { IGlobalVariable } from '@automatisch/types';
+
+const verifyCredentials = async ($: IGlobalVariable) => {
+ await $.http.get('/v2/metadata');
+
+ await $.auth.set({
+ screenName: $.auth.data.screenName,
+ apiKey: $.auth.data.apiKey,
+ });
+};
+
+export default verifyCredentials;
diff --git a/packages/backend/src/apps/better-stack/common/add-auth-header.ts b/packages/backend/src/apps/better-stack/common/add-auth-header.ts
new file mode 100644
index 00000000..2b0de0ce
--- /dev/null
+++ b/packages/backend/src/apps/better-stack/common/add-auth-header.ts
@@ -0,0 +1,11 @@
+import { TBeforeRequest } from '@automatisch/types';
+
+const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
+ if ($.auth.data?.apiKey) {
+ requestConfig.headers.Authorization = `Bearer ${$.auth.data.apiKey}`;
+ }
+
+ return requestConfig;
+};
+
+export default addAuthHeader;
diff --git a/packages/backend/src/apps/better-stack/index.d.ts b/packages/backend/src/apps/better-stack/index.d.ts
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/backend/src/apps/better-stack/index.ts b/packages/backend/src/apps/better-stack/index.ts
new file mode 100644
index 00000000..e65c87e4
--- /dev/null
+++ b/packages/backend/src/apps/better-stack/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: 'Better Stack',
+ key: 'better-stack',
+ iconUrl: '{BASE_URL}/apps/better-stack/assets/favicon.svg',
+ authDocUrl: 'https://automatisch.io/docs/apps/better-stack/connection',
+ supportsConnections: true,
+ baseUrl: 'https://betterstack.com',
+ apiBaseUrl: 'https://uptime.betterstack.com/api',
+ primaryColor: '000000',
+ beforeRequest: [addAuthHeader],
+ auth,
+});
diff --git a/packages/docs/pages/.vitepress/config.js b/packages/docs/pages/.vitepress/config.js
index 04d3fdcf..edc52186 100644
--- a/packages/docs/pages/.vitepress/config.js
+++ b/packages/docs/pages/.vitepress/config.js
@@ -32,6 +32,14 @@ export default defineConfig({
],
sidebar: {
'/apps/': [
+ {
+ text: 'Better Stack',
+ collapsible: true,
+ collapsed: true,
+ items: [
+ { text: 'Connection', link: '/apps/better-stack/connection' },
+ ],
+ },
{
text: 'Carbone',
collapsible: true,
@@ -305,7 +313,7 @@ export default defineConfig({
collapsed: true,
items: [
{ text: 'Actions', link: '/apps/removebg/actions' },
- { text: 'Connection', link: '/apps/removebg/connection' }
+ { text: 'Connection', link: '/apps/removebg/connection' },
],
},
{
diff --git a/packages/docs/pages/apps/better-stack/connection.md b/packages/docs/pages/apps/better-stack/connection.md
new file mode 100644
index 00000000..0d138ca8
--- /dev/null
+++ b/packages/docs/pages/apps/better-stack/connection.md
@@ -0,0 +1,14 @@
+# Better Stack
+
+:::info
+This page explains the steps you need to follow to set up the Better Stack
+connection in Automatisch. If any of the steps are outdated, please let us know!
+:::
+
+1. Login to your Better Stack account: [https://betterstack.com/](https://betterstack.com/).
+2. Click on the team name bottom left and select **Manage Teams** option.
+3. Click on the three dots icon of your team and select **manage** option.
+4. Click on the **API tokens** tab.
+5. Copy the token next to **Direct API tokens** to the `API Key` field on Automatisch.
+6. Fill the screen name on Automatisch.
+7. Now, you can start using the Better Stack connection with Automatisch.
diff --git a/packages/docs/pages/public/favicons/better-stack.svg b/packages/docs/pages/public/favicons/better-stack.svg
new file mode 100644
index 00000000..b1b5690a
--- /dev/null
+++ b/packages/docs/pages/public/favicons/better-stack.svg
@@ -0,0 +1,21 @@
+
+
+