diff --git a/bots/bugbuster/bot.definition.ts b/bots/bugbuster/bot.definition.ts index e919394b025..a94fd3e0221 100644 --- a/bots/bugbuster/bot.definition.ts +++ b/bots/bugbuster/bot.definition.ts @@ -122,5 +122,9 @@ export default new sdk.BotDefinition({ clientSecret: genenv.BUGBUSTER_SLACK_CLIENT_SECRET, signingSecret: genenv.BUGBUSTER_SLACK_SIGNING_SECRET, typingIndicatorEmoji: false, + replyBehaviour: { + location: 'channel', + onlyOnBotMention: false, + }, }, }) diff --git a/bots/bugbuster/src/handlers/lint-all.ts b/bots/bugbuster/src/handlers/lint-all.ts index d9f880b800c..146cef1460e 100644 --- a/bots/bugbuster/src/handlers/lint-all.ts +++ b/bots/bugbuster/src/handlers/lint-all.ts @@ -2,6 +2,8 @@ import * as types from 'src/types' import * as boot from '../bootstrap' import * as bp from '.botpress' +const LINEAR_ISSUE_BASE_URL = 'https://linear.app/botpress/issue/' + export const handleLintAll: bp.WorkflowHandlers['lintAll'] = async (props) => { const { client, workflow, ctx, conversation } = props @@ -112,7 +114,9 @@ export const handleLintAllTimeout: bp.WorkflowHandlers['lintAll'] = async (props } const _buildResultMessage = (results: types.LintResult[]) => { - const failedIssuesLinks = results.filter((result) => result.result === 'failed').map((result) => result.identifier) + const failedIssuesLinks = results + .filter((result) => result.result === 'failed') + .map((result) => `[${result.identifier}](${LINEAR_ISSUE_BASE_URL + result.identifier})`) let messageDetail = 'No issue contained lint errors.' if (failedIssuesLinks.length === 1) { diff --git a/integrations/bamboohr/definitions/actions.ts b/integrations/bamboohr/definitions/actions.ts index 17c2167b2fe..09c13a3aac3 100644 --- a/integrations/bamboohr/definitions/actions.ts +++ b/integrations/bamboohr/definitions/actions.ts @@ -3,6 +3,7 @@ import { bambooHrCompanyInfo, bambooHrEmployeeBasicInfoResponse, bambooHrEmployeeCustomInfoResponse, + bambooHrFields, } from './bamboohr-schemas' import { employeeId, employeeIdObject } from './common' @@ -68,9 +69,23 @@ const getCompanyInfo: ActionDefinition = { }, } +const getFields: ActionDefinition = { + title: 'Get Employee Fields', + description: 'Retrieve the list of available employee fields.', + input: { + schema: z.object({}), + }, + output: { + schema: z.object({ + fields: bambooHrFields, + }), + }, +} + export const actions = { getEmployeeBasicInfo, getEmployeeCustomInfo, listEmployees, getCompanyInfo, + getFields, } as const diff --git a/integrations/bamboohr/definitions/bamboohr-schemas.ts b/integrations/bamboohr/definitions/bamboohr-schemas.ts index d024cc6db9f..959ad2d8749 100644 --- a/integrations/bamboohr/definitions/bamboohr-schemas.ts +++ b/integrations/bamboohr/definitions/bamboohr-schemas.ts @@ -171,7 +171,7 @@ export const bambooHrEmployeeBasicInfoResponse = bambooHrEmployeeWebhookFields.e displayName: z.string().title('Display Name').describe("Employee's display name."), }) -export const bambooHrEmployeeCustomInfoResponse = z.object({ id: employeeId }).catchall(z.string()) +export const bambooHrEmployeeCustomInfoResponse = z.object({ id: employeeId }).passthrough() export const bambooHrEmployeeDirectoryResponse = z.object({ fields: z @@ -211,3 +211,17 @@ export const bambooHrCompanyInfo = z.object({ .describe('Address of the company.'), phone: z.string().nullable().optional().title('Phone Number').describe('Phone number of the company.'), }) + +export const bambooHrFields = z + .array( + z + .object({ + id: z.union([z.string(), z.number()]).title('ID').describe('Unique identifier for the field.'), + name: z.string().title('Name').describe('Name of the field.'), + type: z.string().title('Type').describe('Data type of the field.'), + alias: z.string().optional().title('Alias').describe('Alias used for the field in API requests.'), + }) + .passthrough() + ) + .title('Fields') + .describe('List of available employee fields.') diff --git a/integrations/bamboohr/integration.definition.ts b/integrations/bamboohr/integration.definition.ts index 46f0a5c2f30..16df2b4b271 100644 --- a/integrations/bamboohr/integration.definition.ts +++ b/integrations/bamboohr/integration.definition.ts @@ -3,7 +3,7 @@ import { IntegrationDefinition, z } from '@botpress/sdk' import { actions, events, subdomain } from './definitions' export const INTEGRATION_NAME = 'bamboohr' -export const INTEGRATION_VERSION = '2.0.4' +export const INTEGRATION_VERSION = '2.1.0' export default new IntegrationDefinition({ name: INTEGRATION_NAME, diff --git a/integrations/bamboohr/src/actions/employees.ts b/integrations/bamboohr/src/actions/employees.ts index 2f56addbcbb..38f8e11fa29 100644 --- a/integrations/bamboohr/src/actions/employees.ts +++ b/integrations/bamboohr/src/actions/employees.ts @@ -44,3 +44,14 @@ export const listEmployees: bp.IntegrationProps['actions']['listEmployees'] = as throw new RuntimeError(`Failed to list employees: ${error.message}`) } } + +export const getFields: bp.IntegrationProps['actions']['getFields'] = async ({ client, ctx, logger }) => { + const bambooHrClient = await BambooHRClient.create({ client, ctx, logger }) + + try { + return { fields: await bambooHrClient.getFields() } + } catch (thrown) { + const error = thrown instanceof Error ? thrown : new Error(String(thrown)) + throw new RuntimeError(`Failed to get fields: ${error.message}`) + } +} diff --git a/integrations/bamboohr/src/actions/index.ts b/integrations/bamboohr/src/actions/index.ts index f3e9fd3a0a3..10c68a76a1f 100644 --- a/integrations/bamboohr/src/actions/index.ts +++ b/integrations/bamboohr/src/actions/index.ts @@ -1,5 +1,5 @@ import { getCompanyInfo } from './company' -import { getEmployeeBasicInfo, getEmployeeCustomInfo, listEmployees } from './employees' +import { getEmployeeBasicInfo, getEmployeeCustomInfo, listEmployees, getFields } from './employees' import * as bp from '.botpress' export const actions = { @@ -7,4 +7,5 @@ export const actions = { getEmployeeCustomInfo, listEmployees, getCompanyInfo, + getFields, } satisfies bp.IntegrationProps['actions'] diff --git a/integrations/bamboohr/src/api/bamboohr-client.ts b/integrations/bamboohr/src/api/bamboohr-client.ts index 14adadcacf0..a6848bf774f 100644 --- a/integrations/bamboohr/src/api/bamboohr-client.ts +++ b/integrations/bamboohr/src/api/bamboohr-client.ts @@ -5,6 +5,7 @@ import { bambooHrEmployeeBasicInfoResponse, bambooHrEmployeeCustomInfoResponse, bambooHrEmployeeDirectoryResponse, + bambooHrFields, bambooHrWebhookCreateResponse, } from 'definitions' import * as types from '../types' @@ -131,6 +132,20 @@ export class BambooHRClient { return result.data } + public async getFields(): Promise> { + const url = new URL(`${this._baseUrl}/meta/fields`) + + const res = await this._makeRequest({ method: 'GET', url }) + const result = await parseResponseWithErrors(res, bambooHrFields) + + if (!result.success) { + this._props.logger.forBot().error(result.error, result.details) + throw new Error(result.error) + } + + return result.data + } + public async getEmployeeBasicInfo(employeeId: string): Promise> { const url = new URL(`${this._baseUrl}/employees/${employeeId}`)