-
Notifications
You must be signed in to change notification settings - Fork 16
Eh/odoo ticket integration #234
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
base: master
Are you sure you want to change the base?
Changes from 11 commits
df68a52
808d2b1
7e42bec
bd436c4
be82415
80e2f34
9e78264
85f84c7
1271a7e
866e692
d62bd32
9a101ba
409f70b
f30f9fe
caa22f2
5c96ce1
366b0ac
3d33904
122cd38
4ed650b
5943d20
570b103
ab5e093
c72e19e
5d11fb3
f220021
b5bdd68
8947eee
c139058
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,112 @@ | ||||||
| import { z, ActionDefinition } from '@botpress/sdk' | ||||||
| import { customerSchema } from 'definitions/schemas' | ||||||
|
|
||||||
| export const createCustomer: ActionDefinition = { | ||||||
| title: 'Create Customer', | ||||||
| description: 'Create a new customer', | ||||||
| input: { | ||||||
| schema: z.object({ | ||||||
| id: z.string().title('ID').describe('The id of the customer'), | ||||||
| email: z.string().title('Email').describe('The email of the customer'), | ||||||
| name: z.string().title('Name').describe('The name of the customer'), | ||||||
| phone: z.string().title('Phone').describe('The phone of the customer'), | ||||||
| }), | ||||||
| }, | ||||||
| output: { | ||||||
| schema: z.object({ | ||||||
| odooId: z.number().title('Odoo ID').describe('The odoo id of the created customer'), | ||||||
| }), | ||||||
| }, | ||||||
| } | ||||||
|
|
||||||
| export const fetchCustomerById: ActionDefinition = { | ||||||
| title: 'Fetch Customer By ID', | ||||||
| description: 'Fetch a customer by id', | ||||||
| input: { | ||||||
| schema: z.object({ | ||||||
| id: z.string().title('ID').describe('The id of the customer to fetch'), | ||||||
| }), | ||||||
| }, | ||||||
| output: { | ||||||
| schema: z.object({ | ||||||
| customer: customerSchema.title('Customer').describe('The fetched customer').optional(), | ||||||
| }), | ||||||
| }, | ||||||
| } | ||||||
|
|
||||||
| export const fetchCustomerByOdooId: ActionDefinition = { | ||||||
| title: 'Fetch Customer By Odoo ID', | ||||||
| description: 'Fetch a customer by odoo id', | ||||||
| input: { | ||||||
| schema: z.object({ | ||||||
| id: z.string().title('ID').describe('The id of the customer to fetch'), | ||||||
|
||||||
| id: z.string().title('ID').describe('The id of the customer to fetch'), | |
| id: z.string().title('ID').describe('The id of the customer to fetch').optional(), |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output schema includes an optional 'error' field but the implementation (in customers.ts) only returns success: boolean. Either the error field should be removed from the schema or the implementation should populate it with error messages when success is false.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,35 @@ | ||||||
| import { z, ActionDefinition } from '@botpress/sdk' | ||||||
| import { helpdeskTeamSchema, stageSchema } from 'definitions/schemas' | ||||||
|
|
||||||
| export const getHelpdeskTeams: ActionDefinition = { | ||||||
| title: 'Get Helpdesk Teams', | ||||||
| description: 'Get all helpdesk teams', | ||||||
| input: { | ||||||
| schema: z.object({}), | ||||||
| }, | ||||||
| output: { | ||||||
| schema: z.object({ | ||||||
| helpdeskTeams: z.array(helpdeskTeamSchema).title('Helpdesk Teams').describe('The list of helpdesk teams'), | ||||||
| }), | ||||||
| }, | ||||||
| } | ||||||
|
|
||||||
| export const getStages: ActionDefinition = { | ||||||
| title: 'Get Stages', | ||||||
| description: 'Get all stages', | ||||||
| input: { | ||||||
| schema: z.object({ | ||||||
| teamId: z.number().title('Team ID').describe('The id of the team to get the stages for'), | ||||||
|
||||||
| teamId: z.number().title('Team ID').describe('The id of the team to get the stages for'), | |
| teamId: z.number().optional().title('Team ID').describe('The id of the team to get the stages for'), |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import * as sdk from '@botpress/sdk' | ||
erichugy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import {actions as customerActions} from './customers' | ||
| import {actions as ticketsActions} from './tickets' | ||
| import {actions as helpdeskActions} from './helpdesk' | ||
|
|
||
| export const actions = { | ||
| ...customerActions, | ||
| ...ticketsActions, | ||
| ...helpdeskActions, | ||
| } as const satisfies sdk.IntegrationDefinitionProps['actions'] | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,95 @@ | ||||||
| import { z, ActionDefinition } from '@botpress/sdk' | ||||||
| import { ticketSchema } from 'definitions/schemas' | ||||||
|
|
||||||
| export const createTicket: ActionDefinition = { | ||||||
| title: 'Create Ticket', | ||||||
| description: 'Create a new ticket', | ||||||
| input: { | ||||||
| schema: z.object({ | ||||||
| name: z.string().title('Name').describe('The name of the ticket'), | ||||||
| description: z.string().title('Description').describe('The description of the ticket'), | ||||||
| teamId: z.number().min(1).title('Team ID').describe('The helpdesk team ID associated with the ticket'), | ||||||
| priority: z.enum(['0', '1', '2', '3']).title('Priority').describe('The priority of the ticket (0 is the lowest priority)').optional(), | ||||||
| customerOdooId: z.number().title('Customer Odoo ID').describe('The Odoo customer ID associated with the ticket'), | ||||||
| stageId: z.number().title('Stage ID').describe('The stage ID associated with the ticket'), | ||||||
|
||||||
| stageId: z.number().title('Stage ID').describe('The stage ID associated with the ticket'), | |
| stageId: z.number().title('Stage ID').describe('The stage ID associated with the ticket').optional(), |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import { actions } from './actions' | ||
| import { states } from './states' | ||
|
|
||
| export { actions, states } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { z } from '@botpress/sdk' | ||
|
|
||
| export const customerSchema = z.object({ | ||
| id: z.string().describe('The id of the customer').optional(), | ||
| odooId: z.number().describe('The Odoo ID of the customer').optional(), | ||
| email: z.string().describe('The email of the customer'), | ||
| name: z.string().describe('The name of the customer').optional(), | ||
| phone: z.string().describe('The phone of the customer').optional(), | ||
| }) | ||
|
|
||
| export type Customer = z.infer<typeof customerSchema> | ||
|
|
||
| const customerPayloadSchema = z.object({ | ||
| email: z.string().describe('The email of the customer'), | ||
| phone: z.string().describe('The phone of the customer').optional(), | ||
| name: z.string().describe('The name of the customer').optional(), | ||
| }) | ||
|
|
||
| export type CustomerPayload = z.infer<typeof customerPayloadSchema> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { z } from '@botpress/sdk' | ||
|
|
||
| export const helpdeskTeamSchema = z.object({ | ||
| name: z.string().describe('The name of the helpdesk team'), | ||
| id: z.number().describe('The id of the helpdesk team'), | ||
| }) | ||
|
|
||
| export type HelpdeskTeam = z.infer<typeof helpdeskTeamSchema> | ||
|
|
||
| const helpdeskTeamPayloadSchema = z.object({ | ||
| name: z.string().describe('The name of the helpdesk team'), | ||
| }) | ||
|
|
||
| export type HelpdeskTeamPayload = z.infer<typeof helpdeskTeamPayloadSchema> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { customerSchema, Customer, CustomerPayload } from './customer' | ||
| import { helpdeskTeamSchema, HelpdeskTeam, HelpdeskTeamPayload } from './helpdesk-team' | ||
| import { prioritySchema, Priority, PriorityPayload } from './priority' | ||
| import { stageSchema, Stage, StagePayload } from './stage' | ||
| import { ticketSchema, Ticket, TicketPayload, TicketResponse } from './ticket' | ||
|
|
||
| export { | ||
| customerSchema, | ||
| helpdeskTeamSchema, | ||
| prioritySchema, | ||
| stageSchema, | ||
| ticketSchema, | ||
| Customer, | ||
| CustomerPayload, | ||
| HelpdeskTeam, | ||
| HelpdeskTeamPayload, | ||
| Priority, | ||
| PriorityPayload, | ||
| Stage, | ||
| StagePayload, | ||
| Ticket, | ||
| TicketPayload, | ||
| TicketResponse, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { z } from '@botpress/sdk' | ||
|
|
||
| export const prioritySchema = z.object({ | ||
| name: z.string().describe('The name of the priority'), | ||
| id: z.number().describe('The id of the priority'), | ||
| }) | ||
|
|
||
| export type Priority = z.infer<typeof prioritySchema> | ||
|
|
||
| const priorityPayloadSchema = z.object({ | ||
| id: z.number().describe('The id of the priority'), | ||
| }) | ||
|
|
||
| export type PriorityPayload = z.infer<typeof priorityPayloadSchema> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { z } from '@botpress/sdk' | ||
|
|
||
| export const stageSchema = z.object({ | ||
| name: z.string().describe('The name of the stage'), | ||
| id: z.number().describe('The id of the stage'), | ||
| teamIds: z.array(z.number()).describe('The ids of the helpdesk teams that the stage belongs to'), | ||
| }) | ||
|
|
||
| export type Stage = z.infer<typeof stageSchema> | ||
|
|
||
| const stagePayloadSchema = z.object({ | ||
| name: z.string().describe('The name of the stage'), | ||
| team_ids: z.array(z.number()).describe('The ids of the helpdesk teams that the stage belongs to'), | ||
| }) | ||
|
|
||
| export type StagePayload = z.infer<typeof stagePayloadSchema> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { z } from '@botpress/sdk' | ||
|
|
||
| export const ticketSchema = z.object({ | ||
| customerOdooId: z.number().describe('The Odoo customer ID associated with the ticket'), | ||
| id: z.number().describe('The ticket ID'), | ||
| name: z.string().describe('The name of the ticket'), | ||
| description: z.string().describe('The description of the ticket'), | ||
| teamId: z.number().describe('The helpdesk team ID associated with the ticket'), | ||
| priority: z.string().describe('The priority of the ticket').optional(), | ||
| stageId: z.number().describe('The stage ID associated with the ticket').optional(), | ||
| }) | ||
| export type Ticket = z.infer<typeof ticketSchema> | ||
|
|
||
| const ticketPayloadSchema = z.object({ | ||
| name: z.string().describe('The name of the ticket'), | ||
| description: z.string().describe('The description of the ticket'), | ||
| team_id: z.number().describe('The helpdesk team ID associated with the ticket'), | ||
| priority: z.string().describe('The priority of the ticket as a string (e.g., "0", "1", "2", "3")').optional(), | ||
| partner_id: z.number().describe('The customer ID associated with the ticket'), | ||
| stage_id: z.number().describe('The stage ID associated with the ticket').optional(), | ||
| }) | ||
| export type TicketPayload = z.infer<typeof ticketPayloadSchema> | ||
|
|
||
| export const ticketResponseSchema = z.object({ | ||
| id: z.number().describe('The ticket ID'), | ||
| name: z.string().describe('The name of the ticket'), | ||
| description: z.string().describe('The description of the ticket'), | ||
| team_id: z.tuple([z.number(), z.string()]).describe('The helpdesk team ID and name as a tuple [id, name]'), | ||
| priority: z.string().describe('The priority of the ticket as a string (e.g., "0", "1", "2", "3")').optional().nullable(), | ||
| partner_id: z.tuple([z.number(), z.string()]).describe('The customer ID and name as a tuple [id, name]'), | ||
| stage_id: z.tuple([z.number(), z.string()]).describe('The stage ID and name as a tuple [id, name]').optional(), | ||
| }) | ||
| export type TicketResponse = z.infer<typeof ticketResponseSchema> |
Uh oh!
There was an error while loading. Please reload this page.