Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
df68a52
Created initial odoo helpdesk typing and outline
erichugy Jan 13, 2026
808d2b1
Created helpdesk and ticketing actions
erichugy Jan 15, 2026
7e42bec
Bug: Force to requthenticate
erichugy Jan 15, 2026
bd436c4
Managed to get the helpdesk teams and keep session alive
erichugy Jan 15, 2026
be82415
Feat: Odoo Registration and Helpdesk Teams and Stages
erichugy Jan 15, 2026
80e2f34
Creating customers
erichugy Jan 15, 2026
9e78264
Update Odoo Helpdesk integration: bump package manager version, enhan…
erichugy Jan 16, 2026
85f84c7
Fixed customer creation
erichugy Jan 16, 2026
1271a7e
Completed Create ticket to a final working state
erichugy Jan 18, 2026
866e692
Got Update to work
erichugy Jan 18, 2026
d62bd32
Added Readme for Odoo Helpdesk
erichugy Jan 19, 2026
9a101ba
Fix: Formatting, Integration Version and Name, More Strict Types
erichugy Jan 19, 2026
409f70b
Fix: Reverting root package.json updates
erichugy Jan 19, 2026
f30f9fe
Fix: Made version 1.0.0 and renamed integration name
erichugy Jan 19, 2026
caa22f2
Fix: Removed unused Priority Class. Forced OdooId to be a number. Mad…
erichugy Jan 19, 2026
5c96ce1
Fix: Formatted with Prettier
erichugy Jan 19, 2026
366b0ac
Chore: Added TTYL to cookie cache
erichugy Jan 19, 2026
3d33904
Fix: Added copilot revisions
erichugy Jan 19, 2026
122cd38
Updated Logo
erichugy Jan 19, 2026
4ed650b
Fix: Removed `as unknown`, `as` casts when possible, Non-null asserti…
erichugy Jan 20, 2026
5943d20
fix: Reverted integration definition for production
erichugy Jan 20, 2026
570b103
Fix: Aligned customer schema with create customer function and schemas
erichugy Jan 20, 2026
ab5e093
Refactor: Update Odoo Helpdesk integration with new repository struct…
erichugy Jan 21, 2026
c72e19e
Chore: Removed unused logger parameter
erichugy Jan 21, 2026
5d11fb3
Fix: Shortened hub.md
erichugy Jan 21, 2026
f220021
Fix: Applied prettier formatting
erichugy Jan 21, 2026
b5bdd68
Fix: Unregister the customerIdMapping in unregistration
erichugy Jan 21, 2026
8947eee
Fix: removed unecessary comments. Removed `as` in helpdesk files and …
erichugy Jan 21, 2026
c139058
fix: Reverted integration definiition version and name for prodution …
erichugy Jan 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions integrations/odoo-helpdesk/definitions/actions/customers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import { z, ActionDefinition } from '@botpress/sdk'
import { customerSchema, createCustomerPayloadSchema, createCustomerResultSchema } from 'definitions/schemas'

export const createCustomer: ActionDefinition = {
title: 'Create Customer',
description: 'Create a new customer',
input: {
schema: createCustomerPayloadSchema.extend({
id: z.string().title('ID').describe('The id of the customer'),
}),
},
output: {
schema: z.object({
odooId: createCustomerResultSchema,
}),
},
}

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({
odooId: z.number().title('Odoo ID').describe('The odoo id of the customer to fetch'),
id: z
.string()
.title('ID')
.describe('The id of the customer to fetch. If provided, the returned customer will have this id.')
.optional(),
}),
},
output: {
schema: z.object({
customer: customerSchema.title('Customer').describe('The fetched customer').optional(),
}),
},
}

export const fetchCustomerByEmail: ActionDefinition = {
title: 'Fetch Customer By Email',
description: 'Fetch a customer by email',
input: {
schema: z.object({
email: z.string().title('Email').describe('The email of the customer to fetch'),
id: z
.string()
.title('ID')
.describe('The id of the customer to fetch. If provided, the returned customer will have this id.')
.optional(),
}),
},
output: {
schema: z.object({
customer: customerSchema.title('Customer').describe('The fetched customer').optional(),
}),
},
}

export const updateCustomerById: ActionDefinition = {
title: 'Update Customer',
description: 'Update a customer by id',
input: {
schema: z.object({
id: z.string().title('ID').describe('The id of the customer to update'),
email: z.string().title('Email').describe('The new email of the customer').optional(),
name: z.string().title('Name').describe('The new name of the customer').optional(),
phone: z.string().title('Phone').describe('The new phone of the customer').optional(),
}),
},
output: {
schema: z.object({
success: z.boolean().title('Success').describe('The success of the update'),
}),
},
}

export const updateCustomerByOdooId: ActionDefinition = {
title: 'Update Customer By Odoo ID',
description: 'Update a customer by odoo id',
input: {
schema: z.object({
odooId: z.number().title('Odoo ID').describe('The odoo id of the customer to update'),
email: z.string().title('Email').describe('The new email of the customer').optional(),
name: z.string().title('Name').describe('The new name of the customer').optional(),
phone: z.string().title('Phone').describe('The new phone of the customer').optional(),
}),
},
output: {
schema: z.object({
success: z.boolean().title('Success').describe('The success of the update'),
}),
Comment on lines 85 to 106
Copy link

Copilot AI Jan 19, 2026

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.

Copilot uses AI. Check for mistakes.
},
}

export const updateCustomerByEmail: ActionDefinition = {
title: 'Update Customer By Email',
description: 'Update a customer by email',
input: {
schema: z.object({
email: z.string().title('Email').describe('The email of the customer to update'),
name: z.string().title('Name').describe('The new name of the customer').optional(),
phone: z.string().title('Phone').describe('The new phone of the customer').optional(),
}),
},
output: {
schema: z.object({
success: z.boolean().title('Success').describe('The success of the update'),
}),
},
}

export const actions = {
createCustomer,
fetchCustomerById,
fetchCustomerByEmail,
fetchCustomerByOdooId,
updateCustomerById,
updateCustomerByOdooId,
updateCustomerByEmail,
} as const
35 changes: 35 additions & 0 deletions integrations/odoo-helpdesk/definitions/actions/helpdesk.ts
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().optional().title('Team ID').describe('The id of the team to get the stages for'),
}),
},
output: {
schema: z.object({
stages: z.array(stageSchema).title('Stages').describe('The list of stages'),
}),
},
}

export const actions = {
getHelpdeskTeams,
getStages,
} as const
10 changes: 10 additions & 0 deletions integrations/odoo-helpdesk/definitions/actions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as sdk from '@botpress/sdk'
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']
119 changes: 119 additions & 0 deletions integrations/odoo-helpdesk/definitions/actions/tickets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
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().optional().title('Stage ID').describe('The stage ID associated with the ticket'),
}),
},
output: {
schema: z.object({
ticketId: z.number().title('Ticket ID').describe('The ID of the created ticket'),
}),
},
}

export const fetchTicketById: ActionDefinition = {
title: 'Fetch Ticket',
description: 'Fetch a ticket by id',
input: {
schema: z.object({
id: z.number().title('Ticket ID').describe('The id of the ticket to fetch'),
}),
},
output: {
schema: z.object({
ticket: ticketSchema.title('Ticket').describe('The fetched ticket').optional(),
}),
},
}

export const fetchTicketsByCustomerId: ActionDefinition = {
title: 'Fetch Tickets by Customer',
description: 'Fetch all tickets by customer',
input: {
schema: z.object({
customerOdooId: z.number().title('Customer Odoo ID').describe('The Odoo customer ID associated with the ticket'),
page: z.number().title('Page').describe('The page of the tickets to fetch').min(1).default(1).optional(),
pageSize: z
.number()
.min(1)
.title('Page Size')
.describe('The number of tickets to fetch per page')
.default(100)
.optional(),
}),
},
output: {
schema: z.object({
tickets: z.array(ticketSchema).title('Tickets').describe('The list of tickets associated with the customer'),
}),
},
}

export const fetchTicketsByCustomerEmail: ActionDefinition = {
title: 'Fetch Tickets by Customer Email',
description: 'Fetch all tickets by customer email',
input: {
schema: z.object({
customerEmail: z.string().title('Customer Email').describe('The email of the customer'),
page: z.number().title('Page').describe('The page of the tickets to fetch').min(1).default(1).optional(),
pageSize: z
.number()
.min(1)
.title('Page Size')
.describe('The number of tickets to fetch per page')
.default(100)
.optional(),
}),
},
output: {
schema: z.object({
tickets: z.array(ticketSchema).title('Tickets').describe('The list of tickets associated with the customer'),
}),
},
}

export const updateTicket: ActionDefinition = {
title: 'Update Ticket',
description: 'Update a ticket by id',
input: {
schema: z.object({
ticketId: z.number().title('Ticket ID').describe('The ID of the ticket to update'),
name: z.string().title('Name').describe('The name of the ticket').optional(),
description: z.string().title('Description').describe('The description of the ticket').optional(),
teamId: z.number().min(1).title('Team ID').describe('The helpdesk team ID associated with the ticket').optional(),
priority: z
.enum(['0', '1', '2', '3'])
.title('Priority')
.describe('The priority of the ticket (0 is the lowest priority, 3 is the highest)')
.optional(),
stageId: z.number().title('Stage ID').describe('The stage ID associated with the ticket').optional(),
}),
},
output: {
schema: z.object({
success: z.boolean().title('Success').describe('The success of the update'),
}),
},
}

export const actions = {
createTicket,
fetchTicketById,
fetchTicketsByCustomerId,
fetchTicketsByCustomerEmail,
updateTicket,
} as const
4 changes: 4 additions & 0 deletions integrations/odoo-helpdesk/definitions/index.ts
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,54 @@
import { z } from '@botpress/sdk'

const authPayloadBodySchema = z.object({
jsonrpc: z.literal('2.0'),
params: z.object({
db: z.string().describe('The Odoo database name (Case sensitive).'),
login: z.string().describe('The Odoo email address.'),
password: z.string().describe('The Odoo password.').secret(),
}),
id: z.number().describe('The ID of the request'),
})

const authHeadersSchema = z.object({
'Content-Type': z.literal('application/json'),
})

/**
* Schema for authentication response headers.
* Used to type the headers from axios responses.
*/
const authResponseHeadersSchema = z.object({
'set-cookie': z
.union([z.string(), z.array(z.string())])
.optional()
.describe('The set-cookie header from the Odoo API response.'),
})

const cookieSchema = z.object({
cookie: z.string().describe('The cookie to use for the Odoo API'),
timestamp: z.number().describe('The timestamp of the cookie'),
})

export const authResponseDataSchema = z.object({
jsonrpc: z.literal('2.0'),
result: z
.object({
uid: z.number(),
})
.optional(),
error: z
.object({
code: z.number(),
message: z.string(),
data: z.unknown().optional(),
})
.optional(),
id: z.number(),
})

export type AuthPayloadBody = z.infer<typeof authPayloadBodySchema>
export type AuthHeaders = z.infer<typeof authHeadersSchema>
export type AuthResponseHeaders = z.infer<typeof authResponseHeadersSchema>
export type Cookie = z.infer<typeof cookieSchema>
export type AuthResponseData = z.infer<typeof authResponseDataSchema>
Loading
Loading