-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Freshservice extended implementation #17602
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
Closed
seynadio
wants to merge
2
commits into
PipedreamHQ:master
from
seynadio:freshservice-complete-implementation
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
components/freshservice/actions/assign-ticket-to-agent/assign-ticket-to-agent.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import freshservice from "../../freshservice.app.mjs"; | ||
|
||
export default { | ||
key: "freshservice-assign-ticket-to-agent", | ||
name: "Assign Ticket to Agent", | ||
description: "Assign a ticket to an agent in Freshservice. [See the documentation](https://api.freshservice.com/v2/#update_ticket)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
freshservice, | ||
ticketId: { | ||
propDefinition: [ | ||
freshservice, | ||
"ticketId", | ||
], | ||
}, | ||
responder_id: { | ||
propDefinition: [ | ||
freshservice, | ||
"agentId", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.freshservice.updateTicket({ | ||
ticketId: this.ticketId, | ||
data: { | ||
responder_id: this.responder_id, | ||
}, | ||
$, | ||
}); | ||
|
||
const ticketName = await this.freshservice.getTicketName(this.ticketId); | ||
$.export("$summary", `Successfully assigned ticket "${ticketName}" to agent`); | ||
return response; | ||
}, | ||
}; |
37 changes: 37 additions & 0 deletions
37
components/freshservice/actions/assign-ticket-to-group/assign-ticket-to-group.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import freshservice from "../../freshservice.app.mjs"; | ||
|
||
export default { | ||
key: "freshservice-assign-ticket-to-group", | ||
name: "Assign Ticket to Group", | ||
description: "Assign a ticket to a group in Freshservice. [See the documentation](https://api.freshservice.com/v2/#update_ticket)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
freshservice, | ||
ticketId: { | ||
propDefinition: [ | ||
freshservice, | ||
"ticketId", | ||
], | ||
}, | ||
group_id: { | ||
propDefinition: [ | ||
freshservice, | ||
"groupId", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.freshservice.updateTicket({ | ||
ticketId: this.ticketId, | ||
data: { | ||
group_id: this.group_id, | ||
}, | ||
$, | ||
}); | ||
|
||
const ticketName = await this.freshservice.getTicketName(this.ticketId); | ||
$.export("$summary", `Successfully assigned ticket "${ticketName}" to group`); | ||
return response; | ||
}, | ||
}; |
31 changes: 31 additions & 0 deletions
31
components/freshservice/actions/close-ticket/close-ticket.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import freshservice from "../../freshservice.app.mjs"; | ||
|
||
export default { | ||
key: "freshservice-close-ticket", | ||
name: "Close Ticket", | ||
description: "Close a ticket in Freshservice. [See the documentation](https://api.freshservice.com/v2/#update_ticket)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
freshservice, | ||
ticketId: { | ||
propDefinition: [ | ||
freshservice, | ||
"ticketId", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.freshservice.updateTicket({ | ||
ticketId: this.ticketId, | ||
data: { | ||
status: 5, // Closed | ||
}, | ||
$, | ||
}); | ||
|
||
const ticketName = await this.freshservice.getTicketName(this.ticketId); | ||
$.export("$summary", `Successfully closed ticket "${ticketName}"`); | ||
return response; | ||
}, | ||
}; |
109 changes: 109 additions & 0 deletions
109
components/freshservice/actions/create-company/create-company.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import freshservice from "../../freshservice.app.mjs"; | ||
import { removeNullEntries } from "../../common/utils.mjs"; | ||
|
||
export default { | ||
key: "freshservice-create-company", | ||
name: "Create Company", | ||
description: "Create a new company in Freshservice. [See the documentation](https://api.freshservice.com/v2/#create_company)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
freshservice, | ||
name: { | ||
type: "string", | ||
label: "Name", | ||
description: "Name of the company", | ||
}, | ||
description: { | ||
type: "string", | ||
label: "Description", | ||
description: "Description of the company", | ||
optional: true, | ||
}, | ||
note: { | ||
type: "string", | ||
label: "Note", | ||
description: "Note about the company", | ||
optional: true, | ||
}, | ||
domains: { | ||
type: "string[]", | ||
label: "Domains", | ||
description: "Domains associated with the company", | ||
optional: true, | ||
}, | ||
primary_email: { | ||
type: "string", | ||
label: "Primary Email", | ||
description: "Primary email of the company", | ||
optional: true, | ||
}, | ||
phone: { | ||
type: "string", | ||
label: "Phone", | ||
description: "Phone number of the company", | ||
optional: true, | ||
}, | ||
address: { | ||
type: "string", | ||
label: "Address", | ||
description: "Address of the company", | ||
optional: true, | ||
}, | ||
city: { | ||
type: "string", | ||
label: "City", | ||
description: "City of the company", | ||
optional: true, | ||
}, | ||
state: { | ||
type: "string", | ||
label: "State", | ||
description: "State of the company", | ||
optional: true, | ||
}, | ||
zip_code: { | ||
type: "string", | ||
label: "Zip Code", | ||
description: "Zip code of the company", | ||
optional: true, | ||
}, | ||
country: { | ||
type: "string", | ||
label: "Country", | ||
description: "Country of the company", | ||
optional: true, | ||
}, | ||
custom_fields: { | ||
type: "object", | ||
label: "Custom Fields", | ||
description: "Custom fields as a JSON object", | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
custom_fields, | ||
domains, | ||
...otherProps | ||
} = this; | ||
|
||
const data = removeNullEntries(otherProps); | ||
|
||
if (custom_fields) { | ||
data.custom_fields = this.freshservice.parseIfJSONString(custom_fields); | ||
} | ||
|
||
if (domains && domains.length > 0) { | ||
data.domains = domains; | ||
} | ||
|
||
const response = await this.freshservice.createCompany({ | ||
data, | ||
$, | ||
}); | ||
|
||
$.export("$summary", `Successfully created company: ${response.company?.name}`); | ||
return response; | ||
}, | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Add validation for required noteBody when internalNote is enabled
When
internalNote
is true butnoteBody
is empty or not provided, the code silently falls through to the ticket update logic. This could confuse users who expect to add a note.Consider adding validation similar to the Freshservice implementation:
🤖 Prompt for AI Agents