Skip to content

Commit 20ab242

Browse files
2824 - Zendesk component added
1 parent 147dc12 commit 20ab242

20 files changed

+1421
-0
lines changed

server/apps/server-app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ dependencies {
306306
implementation(project(":server:libs:modules:components:xlsx-file"))
307307
implementation(project(":server:libs:modules:components:xml-file"))
308308
implementation(project(":server:libs:modules:components:xml-helper"))
309+
implementation(project(":server:libs:modules:components:zendesk"))
309310
implementation(project(":server:libs:modules:components:zendesk-sell"))
310311
implementation(project(":server:libs:modules:components:zeplin"))
311312
implementation(project(":server:libs:modules:components:zoho:zoho-books"))

server/ee/apps/worker-app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ dependencies {
246246
implementation(project(":server:libs:modules:components:xlsx-file"))
247247
implementation(project(":server:libs:modules:components:xml-file"))
248248
implementation(project(":server:libs:modules:components:xml-helper"))
249+
implementation(project(":server:libs:modules:components:zendesk"))
249250
implementation(project(":server:libs:modules:components:zendesk-sell"))
250251
implementation(project(":server:libs:modules:components:zeplin"))
251252
implementation(project(":server:libs:modules:components:zoho:zoho-books"))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version="1.0"
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright 2025 ByteChef
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.bytechef.component.zendesk;
18+
19+
import static com.bytechef.component.definition.ComponentDsl.component;
20+
import static com.bytechef.component.definition.ComponentDsl.tool;
21+
22+
import com.bytechef.component.ComponentHandler;
23+
import com.bytechef.component.definition.ComponentCategory;
24+
import com.bytechef.component.definition.ComponentDefinition;
25+
import com.bytechef.component.zendesk.action.ZendeskCommentTicketAction;
26+
import com.bytechef.component.zendesk.action.ZendeskCreateOrganizationAction;
27+
import com.bytechef.component.zendesk.action.ZendeskCreateTicketAction;
28+
import com.bytechef.component.zendesk.connection.ZendeskConnection;
29+
import com.bytechef.component.zendesk.trigger.ZendeskNewTicketTrigger;
30+
import com.google.auto.service.AutoService;
31+
32+
/**
33+
* @author Nikolina Spehar
34+
*/
35+
@AutoService(ComponentHandler.class)
36+
public class ZendeskComponentHandler implements ComponentHandler {
37+
38+
private static final ComponentDefinition COMPONENT_DEFINITION = component("zendesk")
39+
.title("Zendesk")
40+
.description(
41+
"Zendesk is a customer service and sales platform that helps businesses manage customer interactions" +
42+
" across various channels.")
43+
.icon("path:assets/zendesk.svg")
44+
.categories(ComponentCategory.SURVEYS_AND_FEEDBACK)
45+
.connection(ZendeskConnection.CONNECTION_DEFINITION)
46+
.customAction(true)
47+
.actions(
48+
ZendeskCommentTicketAction.ACTION_DEFINITION,
49+
ZendeskCreateOrganizationAction.ACTION_DEFINITION,
50+
ZendeskCreateTicketAction.ACTION_DEFINITION)
51+
.clusterElements(
52+
tool(ZendeskCommentTicketAction.ACTION_DEFINITION),
53+
tool(ZendeskCreateOrganizationAction.ACTION_DEFINITION),
54+
tool(ZendeskCreateTicketAction.ACTION_DEFINITION))
55+
.triggers(ZendeskNewTicketTrigger.TRIGGER_DEFINITION);
56+
57+
@Override
58+
public ComponentDefinition getDefinition() {
59+
return COMPONENT_DEFINITION;
60+
}
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright 2025 ByteChef
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.bytechef.component.zendesk.action;
18+
19+
import static com.bytechef.component.definition.ComponentDsl.action;
20+
import static com.bytechef.component.definition.ComponentDsl.integer;
21+
import static com.bytechef.component.definition.ComponentDsl.outputSchema;
22+
import static com.bytechef.component.definition.ComponentDsl.string;
23+
import static com.bytechef.component.definition.Context.Http.ResponseType;
24+
import static com.bytechef.component.definition.Context.Http.responseType;
25+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.BODY;
26+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.COMMENT;
27+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.TICKET;
28+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.TICKET_ID;
29+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.TICKET_OBJECT_PROPERTY;
30+
31+
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
32+
import com.bytechef.component.definition.Context;
33+
import com.bytechef.component.definition.Context.Http.Body;
34+
import com.bytechef.component.definition.OptionsDataSource.ActionOptionsFunction;
35+
import com.bytechef.component.definition.Parameters;
36+
import com.bytechef.component.definition.TypeReference;
37+
import com.bytechef.component.zendesk.util.ZendeskUtils;
38+
import java.util.Map;
39+
40+
/**
41+
* @author Nikolina Spehar
42+
*/
43+
public class ZendeskCommentTicketAction {
44+
public static final ModifiableActionDefinition ACTION_DEFINITION = action("commentTicket")
45+
.title("Add Comment to Ticket")
46+
.description("Adds a comment to an existing ticket.")
47+
.properties(
48+
integer(TICKET_ID)
49+
.label("Ticket ID")
50+
.description("ID of the ticket that will get the comment.")
51+
.required(true)
52+
.options((ActionOptionsFunction<Long>) ZendeskUtils::getTicketIdOptions),
53+
string(COMMENT)
54+
.label("Comment")
55+
.description("A ticket comment.")
56+
.required(true))
57+
.output(outputSchema(TICKET_OBJECT_PROPERTY))
58+
.perform(ZendeskCommentTicketAction::perform);
59+
60+
private ZendeskCommentTicketAction() {
61+
}
62+
63+
public static Map<String, Object> perform(
64+
Parameters inputParameters, Parameters connectionParameters, Context context) {
65+
66+
Map<String, Map<String, Object>> response = context.http(http -> http.put(
67+
"/tickets/%s".formatted(inputParameters.getRequiredInteger(TICKET_ID))))
68+
.body(Body.of(TICKET, Map.of(COMMENT, Map.of(BODY, inputParameters.getRequiredString(COMMENT)))))
69+
.configuration(responseType(ResponseType.JSON))
70+
.execute()
71+
.getBody(new TypeReference<>() {});
72+
73+
return response.get(TICKET);
74+
}
75+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/*
2+
* Copyright 2025 ByteChef
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.bytechef.component.zendesk.action;
18+
19+
import static com.bytechef.component.definition.ComponentDsl.action;
20+
import static com.bytechef.component.definition.ComponentDsl.array;
21+
import static com.bytechef.component.definition.ComponentDsl.bool;
22+
import static com.bytechef.component.definition.ComponentDsl.integer;
23+
import static com.bytechef.component.definition.ComponentDsl.object;
24+
import static com.bytechef.component.definition.ComponentDsl.outputSchema;
25+
import static com.bytechef.component.definition.ComponentDsl.string;
26+
import static com.bytechef.component.definition.Context.Http.ResponseType;
27+
import static com.bytechef.component.definition.Context.Http.responseType;
28+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.DETAILS;
29+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.DOMAIN_NAMES;
30+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.NAME;
31+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.NOTES;
32+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.ORGANIZATION;
33+
import static com.bytechef.component.zendesk.util.ZendeskUtils.checkIfNull;
34+
35+
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
36+
import com.bytechef.component.definition.Context;
37+
import com.bytechef.component.definition.Context.Http.Body;
38+
import com.bytechef.component.definition.Parameters;
39+
import com.bytechef.component.definition.TypeReference;
40+
import java.util.Map;
41+
42+
/**
43+
* @author Nikolina Spehar
44+
*/
45+
public class ZendeskCreateOrganizationAction {
46+
public static final ModifiableActionDefinition ACTION_DEFINITION = action("createOrganization")
47+
.title("Create Organization")
48+
.description("Creates an organization.")
49+
.properties(
50+
string(NAME)
51+
.label("Name")
52+
.description("Name of the organization.")
53+
.required(true),
54+
string(DETAILS)
55+
.label("Details")
56+
.description("Any details about the organization, such as the address.")
57+
.required(false),
58+
array(DOMAIN_NAMES)
59+
.label("Domain Names")
60+
.description("An array of domain names associated with this organization.")
61+
.required(true)
62+
.items(
63+
string("domain_name")
64+
.label("Domain Name")
65+
.description("Domain name associated with this organization.")
66+
.required(false)),
67+
string(NOTES)
68+
.label("Notes")
69+
.description("Any notes you have about the organization.")
70+
.required(false))
71+
.output(
72+
outputSchema(
73+
object()
74+
.properties(
75+
string("url")
76+
.description("URL of the created organization."),
77+
string("id")
78+
.description("Organization ID."),
79+
string("name")
80+
.description("Organization name."),
81+
bool("shared_tickets")
82+
.description("Whether the organization can share tickets."),
83+
bool("shared_comments")
84+
.description("Whether the organization can share comments."),
85+
integer("external_id")
86+
.description("External ID of the organization."),
87+
string("created_at")
88+
.description("Date when the organization was created."),
89+
string("updated_at")
90+
.description("Date when the organization was last updated."),
91+
array("domain_names")
92+
.description("Array of domain names of the organization.")
93+
.items(
94+
string("domain_name")),
95+
string("detail")
96+
.description("Details about the organization."),
97+
string("notes")
98+
.description("Notes about the organization."),
99+
integer("group_id")
100+
.description("Group ID of the organization."),
101+
array("tags")
102+
.description("Tags of the organization.")
103+
.items(
104+
string("tag")),
105+
object("organization_fields")
106+
.description("Custom organization fields of the organization."))))
107+
.perform(ZendeskCreateOrganizationAction::perform);
108+
109+
private ZendeskCreateOrganizationAction() {
110+
}
111+
112+
public static Map<String, Object> perform(
113+
Parameters inputParameters, Parameters connectionParameters, Context context) {
114+
115+
return context.http(http -> http.post("/organizations"))
116+
.body(
117+
Body.of(
118+
ORGANIZATION, Map.of(
119+
NAME, inputParameters.getRequiredString(NAME),
120+
DOMAIN_NAMES, inputParameters.getRequiredList(DOMAIN_NAMES),
121+
DETAILS, checkIfNull(inputParameters.getString(DETAILS)),
122+
NOTES, checkIfNull(inputParameters.getString(NOTES)))))
123+
.configuration(responseType(ResponseType.JSON))
124+
.execute()
125+
.getBody(new TypeReference<>() {});
126+
}
127+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* Copyright 2025 ByteChef
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.bytechef.component.zendesk.action;
18+
19+
import static com.bytechef.component.definition.ComponentDsl.action;
20+
import static com.bytechef.component.definition.ComponentDsl.option;
21+
import static com.bytechef.component.definition.ComponentDsl.outputSchema;
22+
import static com.bytechef.component.definition.ComponentDsl.string;
23+
import static com.bytechef.component.definition.Context.Http.ResponseType;
24+
import static com.bytechef.component.definition.Context.Http.responseType;
25+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.BODY;
26+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.COMMENT;
27+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.PRIORITY;
28+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.STATUS;
29+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.SUBJECT;
30+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.TICKET;
31+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.TICKET_OBJECT_PROPERTY;
32+
import static com.bytechef.component.zendesk.constant.ZendeskConstants.TYPE;
33+
import static com.bytechef.component.zendesk.util.ZendeskUtils.checkIfNull;
34+
35+
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
36+
import com.bytechef.component.definition.Context;
37+
import com.bytechef.component.definition.Context.Http.Body;
38+
import com.bytechef.component.definition.Parameters;
39+
import com.bytechef.component.definition.TypeReference;
40+
import java.util.Map;
41+
42+
/**
43+
* @author Nikolina Spehar
44+
*/
45+
public class ZendeskCreateTicketAction {
46+
public static final ModifiableActionDefinition ACTION_DEFINITION = action("createTicket")
47+
.title("Create Ticket")
48+
.description("Creates a ticket.")
49+
.properties(
50+
string(SUBJECT)
51+
.label("Subject")
52+
.description("Subject of the ticket.")
53+
.required(false),
54+
string(TYPE)
55+
.label("Type")
56+
.description("Type of the ticket.")
57+
.options(
58+
option("Problem", "problem"),
59+
option("Incident", "incident"),
60+
option("Question", "question"),
61+
option("Task", "task"))
62+
.required(false),
63+
string(COMMENT)
64+
.label("Comment")
65+
.description("Comment of the ticket.")
66+
.required(true),
67+
string(PRIORITY)
68+
.label("Priority")
69+
.description("Priority of the ticket.")
70+
.options(
71+
option("Low", "low"),
72+
option("Normal", "normal"),
73+
option("High", "high"),
74+
option("Urgent", "urgent"))
75+
.required(false),
76+
string(STATUS)
77+
.label("Status")
78+
.description("Status of the ticket.")
79+
.options(
80+
option("New", "new"),
81+
option("Open", "open"),
82+
option("Pending", "pending"),
83+
option("Hold", "hold"),
84+
option("Solved", "solved"),
85+
option("Closed", "closed"))
86+
.required(false))
87+
.output(outputSchema(TICKET_OBJECT_PROPERTY))
88+
.perform(ZendeskCreateTicketAction::perform);
89+
90+
private ZendeskCreateTicketAction() {
91+
}
92+
93+
public static Map<String, Object> perform(
94+
Parameters inputParameters, Parameters connectionParameters, Context context) {
95+
96+
Map<String, Map<String, Object>> response = context.http(http -> http.post("/tickets"))
97+
.body(
98+
Body.of(
99+
TICKET, Map.of(
100+
COMMENT, Map.of(BODY, inputParameters.getRequiredString(COMMENT)),
101+
PRIORITY, checkIfNull(inputParameters.getString(PRIORITY)),
102+
SUBJECT, checkIfNull(inputParameters.getString(SUBJECT)),
103+
TYPE, checkIfNull(inputParameters.getString(TYPE)),
104+
STATUS, checkIfNull(inputParameters.getString(STATUS)))))
105+
.configuration(responseType(ResponseType.JSON))
106+
.execute()
107+
.getBody(new TypeReference<>() {});
108+
109+
return response.get(TICKET);
110+
}
111+
}

0 commit comments

Comments
 (0)