Compare commits
	
		
			4 Commits
		
	
	
		
			stringify-
			...
			AUT-501
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 23c40c89ee | ||
|   | 77f84944c7 | ||
|   | 8a8be21d56 | ||
|   | e5c4e18fd5 | 
| @@ -0,0 +1,43 @@ | ||||
| import defineAction from '../../../../helpers/define-action.js'; | ||||
|  | ||||
| export default defineAction({ | ||||
|   name: 'Acknowledge incident', | ||||
|   key: 'acknowledgeIncident', | ||||
|   description: 'Acknowledges an incident.', | ||||
|   arguments: [ | ||||
|     { | ||||
|       label: 'Incident ID', | ||||
|       key: 'incidentId', | ||||
|       type: 'string', | ||||
|       required: true, | ||||
|       variables: true, | ||||
|       description: | ||||
|         'This serves as the incident ID that requires your acknowledgment.', | ||||
|     }, | ||||
|     { | ||||
|       label: 'Acknowledged by', | ||||
|       key: 'acknowledgedBy', | ||||
|       type: 'string', | ||||
|       required: false, | ||||
|       variables: true, | ||||
|       description: | ||||
|         "This refers to the individual's name, email, or another form of identification that the person who acknowledged the incident has provided.", | ||||
|     }, | ||||
|   ], | ||||
|  | ||||
|   async run($) { | ||||
|     const acknowledgedBy = $.step.parameters.acknowledgedBy; | ||||
|     const incidentId = $.step.parameters.incidentId; | ||||
|  | ||||
|     const body = { | ||||
|       acknowledged_by: acknowledgedBy, | ||||
|     }; | ||||
|  | ||||
|     const response = await $.http.post( | ||||
|       `/v2/incidents/${incidentId}/acknowledge`, | ||||
|       body | ||||
|     ); | ||||
|  | ||||
|     $.setActionItem({ raw: response.data.data }); | ||||
|   }, | ||||
| }); | ||||
| @@ -0,0 +1,120 @@ | ||||
| import defineAction from '../../../../helpers/define-action.js'; | ||||
|  | ||||
| export default defineAction({ | ||||
|   name: 'Create incident', | ||||
|   key: 'createIncident', | ||||
|   description: 'Creates an incident that informs the team.', | ||||
|   arguments: [ | ||||
|     { | ||||
|       label: 'Brief Summary', | ||||
|       key: 'briefSummary', | ||||
|       type: 'string', | ||||
|       required: true, | ||||
|       variables: true, | ||||
|       description: 'A short description outlining the issue.', | ||||
|     }, | ||||
|     { | ||||
|       label: 'Description', | ||||
|       key: 'description', | ||||
|       type: 'string', | ||||
|       required: false, | ||||
|       variables: true, | ||||
|       description: | ||||
|         'An elaborate description of the situation, offering insights into what is occurring, along with instructions to reproduce the problem.', | ||||
|     }, | ||||
|     { | ||||
|       label: 'Requester Email', | ||||
|       key: 'requesterEmail', | ||||
|       type: 'string', | ||||
|       required: true, | ||||
|       variables: true, | ||||
|       description: | ||||
|         'This represents the email address of the individual who initiated the incident request.', | ||||
|     }, | ||||
|     { | ||||
|       label: 'Alert Settings - Call', | ||||
|       key: 'alertSettingsCall', | ||||
|       type: 'dropdown', | ||||
|       required: true, | ||||
|       description: 'Should we call the on-call person?', | ||||
|       variables: true, | ||||
|       options: [ | ||||
|         { label: 'Yes', value: 'true' }, | ||||
|         { label: 'No', value: 'false' }, | ||||
|       ], | ||||
|     }, | ||||
|     { | ||||
|       label: 'Alert Settings - Text', | ||||
|       key: 'alertSettingsText', | ||||
|       type: 'dropdown', | ||||
|       required: true, | ||||
|       description: 'Should we text the on-call person?', | ||||
|       variables: true, | ||||
|       options: [ | ||||
|         { label: 'Yes', value: 'true' }, | ||||
|         { label: 'No', value: 'false' }, | ||||
|       ], | ||||
|     }, | ||||
|     { | ||||
|       label: 'Alert Settings - Email', | ||||
|       key: 'alertSettingsEmail', | ||||
|       type: 'dropdown', | ||||
|       required: true, | ||||
|       description: 'Should we email the on-call person?', | ||||
|       variables: true, | ||||
|       options: [ | ||||
|         { label: 'Yes', value: 'true' }, | ||||
|         { label: 'No', value: 'false' }, | ||||
|       ], | ||||
|     }, | ||||
|     { | ||||
|       label: 'Alert Settings - Push Notification', | ||||
|       key: 'alertSettingsPushNotification', | ||||
|       type: 'dropdown', | ||||
|       required: true, | ||||
|       description: 'Should we send a push notification to the on-call person?', | ||||
|       variables: true, | ||||
|       options: [ | ||||
|         { label: 'Yes', value: 'true' }, | ||||
|         { label: 'No', value: 'false' }, | ||||
|       ], | ||||
|     }, | ||||
|     { | ||||
|       label: 'Team Alert Wait Time', | ||||
|       key: 'teamAlertWaitTime', | ||||
|       type: 'string', | ||||
|       required: true, | ||||
|       variables: true, | ||||
|       description: | ||||
|         "What is the time threshold for acknowledgment before escalating to the entire team? (Specify in seconds) - Use a negative value to indicate no team alert if the on-call person doesn't respond, and use 0 for an immediate alert to the entire team.", | ||||
|     }, | ||||
|   ], | ||||
|  | ||||
|   async run($) { | ||||
|     const { | ||||
|       briefSummary, | ||||
|       description, | ||||
|       requesterEmail, | ||||
|       alertSettingsCall, | ||||
|       alertSettingsText, | ||||
|       alertSettingsEmail, | ||||
|       alertSettingsPushNotification, | ||||
|       teamAlertWaitTime, | ||||
|     } = $.step.parameters; | ||||
|  | ||||
|     const body = { | ||||
|       summary: briefSummary, | ||||
|       description, | ||||
|       requester_email: requesterEmail, | ||||
|       call: alertSettingsCall, | ||||
|       sms: alertSettingsText, | ||||
|       email: alertSettingsEmail, | ||||
|       push: alertSettingsPushNotification, | ||||
|       team_wait: teamAlertWaitTime, | ||||
|     }; | ||||
|  | ||||
|     const response = await $.http.post('/v2/incidents', body); | ||||
|  | ||||
|     $.setActionItem({ raw: response.data.data }); | ||||
|   }, | ||||
| }); | ||||
							
								
								
									
										4
									
								
								packages/backend/src/apps/better-stack/actions/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								packages/backend/src/apps/better-stack/actions/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| import acknowledgeIncident from './acknowledge-incident/index.js'; | ||||
| import createIncident from './create-incident/index.js'; | ||||
|  | ||||
| export default [acknowledgeIncident, createIncident]; | ||||
							
								
								
									
										21
									
								
								packages/backend/src/apps/better-stack/assets/favicon.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								packages/backend/src/apps/better-stack/assets/favicon.svg
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| <?xml version="1.0" standalone="no"?> | ||||
| <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" | ||||
|  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> | ||||
| <svg version="1.0" xmlns="http://www.w3.org/2000/svg" | ||||
|  width="200.000000pt" height="200.000000pt" viewBox="0 0 200.000000 200.000000" | ||||
|  preserveAspectRatio="xMidYMid meet"> | ||||
|  | ||||
| <g transform="translate(0.000000,200.000000) scale(0.100000,-0.100000)" | ||||
| fill="#000" stroke="none"> | ||||
| <path d="M0 1000 l0 -1000 1000 0 1000 0 0 1000 0 1000 -1000 0 -1000 0 0 | ||||
| -1000z m1162 460 c14 -11 113 -184 232 -408 228 -429 231 -439 175 -486 -35 | ||||
| -30 -30 -29 -140 -15 -89 12 -123 25 -152 56 -9 11 -72 147 -140 304 -113 263 | ||||
| -124 284 -149 287 -14 2 -29 10 -32 17 -8 21 67 214 94 242 28 29 78 30 112 3z | ||||
| m-340 -148 c10 -10 72 -175 139 -367 114 -325 121 -351 108 -374 -8 -14 -27 | ||||
| -32 -41 -41 -25 -13 -34 -12 -126 18 -55 18 -111 43 -125 56 -19 17 -40 67 | ||||
| -76 182 -36 112 -58 164 -73 176 l-22 16 27 99 c63 224 66 232 95 248 31 17 | ||||
| 69 12 94 -13z m-314 -219 c16 -15 26 -59 56 -243 42 -262 43 -285 17 -300 -11 | ||||
| -5 -24 -10 -30 -10 -19 0 -140 114 -150 141 -7 20 -4 76 10 191 10 90 19 171 | ||||
| 19 181 0 18 33 57 49 57 5 0 18 -8 29 -17z"/> | ||||
| </g> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 1.1 KiB | 
							
								
								
									
										33
									
								
								packages/backend/src/apps/better-stack/auth/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								packages/backend/src/apps/better-stack/auth/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| import verifyCredentials from './verify-credentials.js'; | ||||
| import isStillVerified from './is-still-verified.js'; | ||||
|  | ||||
| export default { | ||||
|   fields: [ | ||||
|     { | ||||
|       key: 'screenName', | ||||
|       label: 'Screen Name', | ||||
|       type: 'string', | ||||
|       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', | ||||
|       required: true, | ||||
|       readOnly: false, | ||||
|       value: null, | ||||
|       placeholder: null, | ||||
|       description: 'Better Stack API key of your account.', | ||||
|       clickToCopy: false, | ||||
|     }, | ||||
|   ], | ||||
|  | ||||
|   verifyCredentials, | ||||
|   isStillVerified, | ||||
| }; | ||||
| @@ -0,0 +1,8 @@ | ||||
| import verifyCredentials from './verify-credentials.js'; | ||||
|  | ||||
| const isStillVerified = async ($) => { | ||||
|   await verifyCredentials($); | ||||
|   return true; | ||||
| }; | ||||
|  | ||||
| export default isStillVerified; | ||||
| @@ -0,0 +1,10 @@ | ||||
| const verifyCredentials = async ($) => { | ||||
|   await $.http.get('/v2/metadata'); | ||||
|  | ||||
|   await $.auth.set({ | ||||
|     screenName: $.auth.data.screenName, | ||||
|     apiKey: $.auth.data.apiKey, | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| export default verifyCredentials; | ||||
| @@ -0,0 +1,9 @@ | ||||
| const addAuthHeader = ($, requestConfig) => { | ||||
|   if ($.auth.data?.apiKey) { | ||||
|     requestConfig.headers.Authorization = `Bearer ${$.auth.data.apiKey}`; | ||||
|   } | ||||
|  | ||||
|   return requestConfig; | ||||
| }; | ||||
|  | ||||
| export default addAuthHeader; | ||||
							
								
								
									
										18
									
								
								packages/backend/src/apps/better-stack/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								packages/backend/src/apps/better-stack/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| import defineApp from '../../helpers/define-app.js'; | ||||
| import addAuthHeader from './common/add-auth-header.js'; | ||||
| import auth from './auth/index.js'; | ||||
| import actions from './actions/index.js'; | ||||
|  | ||||
| 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, | ||||
|   actions, | ||||
| }); | ||||
| @@ -32,6 +32,15 @@ export default defineConfig({ | ||||
|     ], | ||||
|     sidebar: { | ||||
|       '/apps/': [ | ||||
|         { | ||||
|           text: 'Better Stack', | ||||
|           collapsible: true, | ||||
|           collapsed: true, | ||||
|           items: [ | ||||
|             { text: 'Actions', link: '/apps/better-stack/actions' }, | ||||
|             { text: 'Connection', link: '/apps/better-stack/connection' }, | ||||
|           ], | ||||
|         }, | ||||
|         { | ||||
|           text: 'Carbone', | ||||
|           collapsible: true, | ||||
| @@ -305,7 +314,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' }, | ||||
|           ], | ||||
|         }, | ||||
|         { | ||||
|   | ||||
							
								
								
									
										14
									
								
								packages/docs/pages/apps/better-stack/actions.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								packages/docs/pages/apps/better-stack/actions.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| --- | ||||
| favicon: /favicons/better-stack.svg | ||||
| items: | ||||
|   - name: Acknowledge incident | ||||
|     desc: Acknowledges an incident. | ||||
|   - name: Create incident | ||||
|     desc: Creates an incident that informs the team. | ||||
| --- | ||||
|  | ||||
| <script setup> | ||||
|   import CustomListing from '../../components/CustomListing.vue' | ||||
| </script> | ||||
|  | ||||
| <CustomListing /> | ||||
							
								
								
									
										14
									
								
								packages/docs/pages/apps/better-stack/connection.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								packages/docs/pages/apps/better-stack/connection.md
									
									
									
									
									
										Normal file
									
								
							| @@ -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. | ||||
| @@ -2,6 +2,7 @@ | ||||
|  | ||||
| The following integrations are currently supported by Automatisch. | ||||
|  | ||||
| - [Better Stack](/apps/better-stack/actions) | ||||
| - [Carbone](/apps/carbone/actions) | ||||
| - [DeepL](/apps/deepl/actions) | ||||
| - [Delay](/apps/delay/actions) | ||||
|   | ||||
							
								
								
									
										21
									
								
								packages/docs/pages/public/favicons/better-stack.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								packages/docs/pages/public/favicons/better-stack.svg
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| <?xml version="1.0" standalone="no"?> | ||||
| <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" | ||||
|  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> | ||||
| <svg version="1.0" xmlns="http://www.w3.org/2000/svg" | ||||
|  width="200.000000pt" height="200.000000pt" viewBox="0 0 200.000000 200.000000" | ||||
|  preserveAspectRatio="xMidYMid meet"> | ||||
|  | ||||
| <g transform="translate(0.000000,200.000000) scale(0.100000,-0.100000)" | ||||
| fill="#000000" stroke="none"> | ||||
| <path d="M0 1000 l0 -1000 1000 0 1000 0 0 1000 0 1000 -1000 0 -1000 0 0 | ||||
| -1000z m1162 460 c14 -11 113 -184 232 -408 228 -429 231 -439 175 -486 -35 | ||||
| -30 -30 -29 -140 -15 -89 12 -123 25 -152 56 -9 11 -72 147 -140 304 -113 263 | ||||
| -124 284 -149 287 -14 2 -29 10 -32 17 -8 21 67 214 94 242 28 29 78 30 112 3z | ||||
| m-340 -148 c10 -10 72 -175 139 -367 114 -325 121 -351 108 -374 -8 -14 -27 | ||||
| -32 -41 -41 -25 -13 -34 -12 -126 18 -55 18 -111 43 -125 56 -19 17 -40 67 | ||||
| -76 182 -36 112 -58 164 -73 176 l-22 16 27 99 c63 224 66 232 95 248 31 17 | ||||
| 69 12 94 -13z m-314 -219 c16 -15 26 -59 56 -243 42 -262 43 -285 17 -300 -11 | ||||
| -5 -24 -10 -30 -10 -19 0 -140 114 -150 141 -7 20 -4 76 10 191 10 90 19 171 | ||||
| 19 181 0 18 33 57 49 57 5 0 18 -8 29 -17z"/> | ||||
| </g> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 1.1 KiB | 
		Reference in New Issue
	
	Block a user