diff --git a/components/kustomer/actions/create-conversation/create-conversation.mjs b/components/kustomer/actions/create-conversation/create-conversation.mjs index 68c3416e212fe..8500ef6980176 100644 --- a/components/kustomer/actions/create-conversation/create-conversation.mjs +++ b/components/kustomer/actions/create-conversation/create-conversation.mjs @@ -7,7 +7,7 @@ export default { key: "kustomer-create-conversation", name: "Create Conversation", description: "Creates a new conversation in Kustomer. [See the documentation](https://developer.kustomer.com/kustomer-api-docs/reference/createaconversation)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { kustomer, diff --git a/components/kustomer/actions/create-customer/create-customer.mjs b/components/kustomer/actions/create-customer/create-customer.mjs index a2987830f4e81..448b59d6f82f9 100644 --- a/components/kustomer/actions/create-customer/create-customer.mjs +++ b/components/kustomer/actions/create-customer/create-customer.mjs @@ -7,7 +7,7 @@ export default { key: "kustomer-create-customer", name: "Create Customer", description: "Creates a new customer in Kustomer. [See the documentation](https://developer.kustomer.com/kustomer-api-docs/reference/createacustomer)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { kustomer, diff --git a/components/kustomer/actions/get-custom-object-by-external-id/get-custom-object-by-external-id.mjs b/components/kustomer/actions/get-custom-object-by-external-id/get-custom-object-by-external-id.mjs new file mode 100644 index 0000000000000..55ad2b28343b8 --- /dev/null +++ b/components/kustomer/actions/get-custom-object-by-external-id/get-custom-object-by-external-id.mjs @@ -0,0 +1,38 @@ +import { ConfigurationError } from "@pipedream/platform"; +import kustomer from "../../kustomer.app.mjs"; + +export default { + key: "kustomer-get-custom-object-by-external-id", + name: "Get Custom Object by External ID", + description: "Gets a custom object by external ID in Kustomer. [See the documentation](https://developer.kustomer.com/kustomer-api-docs/reference/get-klasses-name-externalid-externalid)", + version: "0.0.1", + type: "action", + props: { + kustomer, + klassName: { + propDefinition: [ + kustomer, + "klassName", + ], + }, + externalId: { + type: "string", + label: "External ID", + description: "The external ID of the custom object to retrieve", + }, + }, + async run({ $ }) { + try { + const response = await this.kustomer.getCustomObjectByExternalId({ + $, + klassName: this.klassName, + externalId: this.externalId, + }); + + $.export("$summary", `Successfully retrieved custom object with external ID ${this.externalId}`); + return response; + } catch ({ response }) { + throw new ConfigurationError(response.data.errors[0].title); + } + }, +}; diff --git a/components/kustomer/actions/get-custom-object-by-id/get-custom-object-by-id.mjs b/components/kustomer/actions/get-custom-object-by-id/get-custom-object-by-id.mjs new file mode 100644 index 0000000000000..6bc2fc64413d6 --- /dev/null +++ b/components/kustomer/actions/get-custom-object-by-id/get-custom-object-by-id.mjs @@ -0,0 +1,42 @@ +import { ConfigurationError } from "@pipedream/platform"; +import kustomer from "../../kustomer.app.mjs"; + +export default { + key: "kustomer-get-custom-object-by-id", + name: "Get Custom Object by ID", + description: "Gets a custom object by ID in Kustomer. [See the documentation](https://developer.kustomer.com/kustomer-api-docs/reference/getkobject)", + version: "0.0.1", + type: "action", + props: { + kustomer, + klassName: { + propDefinition: [ + kustomer, + "klassName", + ], + }, + customObjectId: { + propDefinition: [ + kustomer, + "customObjectId", + ({ klassName }) => ({ + klassName, + }), + ], + }, + }, + async run({ $ }) { + try { + const response = await this.kustomer.getCustomObjectById({ + $, + klassName: this.klassName, + customObjectId: this.customObjectId, + }); + + $.export("$summary", `Successfully retrieved custom object with ID ${this.customObjectId}`); + return response; + } catch ({ response }) { + throw new ConfigurationError(response.data.errors[0].title); + } + }, +}; diff --git a/components/kustomer/actions/get-custom-objects/get-custom-objects.mjs b/components/kustomer/actions/get-custom-objects/get-custom-objects.mjs new file mode 100644 index 0000000000000..e3bad8bbf1eff --- /dev/null +++ b/components/kustomer/actions/get-custom-objects/get-custom-objects.mjs @@ -0,0 +1,41 @@ +import { ConfigurationError } from "@pipedream/platform"; +import kustomer from "../../kustomer.app.mjs"; + +export default { + key: "kustomer-get-custom-objects", + name: "Get Custom Objects", + description: "Gets custom objects in Kustomer. [See the documentation](https://developer.kustomer.com/kustomer-api-docs/reference/getkobjects)", + version: "0.0.1", + type: "action", + props: { + kustomer, + klassName: { + propDefinition: [ + kustomer, + "klassName", + ], + }, + fromDate: { + type: "string", + label: "From Date", + description: "Date-time string in Internet Date/Time format (ISO 8601) E.g. `2025-07-25T00:00:00Z`", + optional: true, + }, + }, + async run({ $ }) { + try { + const response = await this.kustomer.listCustomObjects({ + $, + klassName: this.klassName, + params: { + fromDate: this.fromDate, + }, + }); + + $.export("$summary", `Successfully retrieved ${response.data.length} custom objects`); + return response; + } catch ({ response }) { + throw new ConfigurationError(response.data.errors[0].title); + } + }, +}; diff --git a/components/kustomer/actions/update-conversation/update-conversation.mjs b/components/kustomer/actions/update-conversation/update-conversation.mjs index 2e2a1c486dfd6..ecac6e12f44ea 100644 --- a/components/kustomer/actions/update-conversation/update-conversation.mjs +++ b/components/kustomer/actions/update-conversation/update-conversation.mjs @@ -7,7 +7,7 @@ export default { key: "kustomer-update-conversation", name: "Update Conversation", description: "Updates an existing conversation in Kustomer. [See the documentation](https://developer.kustomer.com/kustomer-api-docs/reference/updateconversation).", - version: "0.0.1", + version: "0.0.2", type: "action", props: { kustomer, diff --git a/components/kustomer/actions/update-custom-object-by-id/update-custom-object-by-id.mjs b/components/kustomer/actions/update-custom-object-by-id/update-custom-object-by-id.mjs new file mode 100644 index 0000000000000..26e23e5883bfd --- /dev/null +++ b/components/kustomer/actions/update-custom-object-by-id/update-custom-object-by-id.mjs @@ -0,0 +1,97 @@ +import { ConfigurationError } from "@pipedream/platform"; +import { parseObject } from "../../common/utils.mjs"; +import kustomer from "../../kustomer.app.mjs"; + +export default { + key: "kustomer-update-custom-object-by-id", + name: "Update Custom Object by ID", + description: "Updates a custom object identified by ID in Kustomer. [See the documentation](https://developer.kustomer.com/kustomer-api-docs/reference/updatekobject)", + version: "0.0.1", + type: "action", + props: { + kustomer, + klassName: { + propDefinition: [ + kustomer, + "klassName", + ], + }, + customObjectId: { + propDefinition: [ + kustomer, + "customObjectId", + ({ klassName }) => ({ + klassName, + }), + ], + }, + externalId: { + type: "string", + label: "External ID", + description: "The external ID of the custom object to update", + optional: true, + }, + title: { + type: "string", + label: "Title", + description: "The title of the custom object to update", + optional: true, + }, + description: { + type: "string", + label: "Description", + description: "The description of the custom object to update", + optional: true, + }, + data: { + type: "object", + label: "Data", + description: "The data to update the custom object with", + optional: true, + }, + custom: { + type: "object", + label: "Custom", + description: "The custom data of the custom object to update", + optional: true, + }, + tags: { + propDefinition: [ + kustomer, + "tags", + ], + label: "Tags", + description: "Tags associated with the custom object", + optional: true, + }, + rev: { + type: "integer", + label: "Rev", + description: "The rev of the custom object to update", + optional: true, + }, + }, + async run({ $ }) { + try { + const response = await this.kustomer.updateCustomObjectById({ + $, + klassName: this.klassName, + customObjectId: this.customObjectId, + data: { + externalId: this.externalId, + title: this.title, + description: this.description, + data: parseObject(this.data), + custom: parseObject(this.custom), + tags: parseObject(this.tags), + rev: this.rev, + }, + }); + + $.export("$summary", `Successfully updated custom object with ID ${this.customObjectId}`); + return response; + } catch ({ response }) { + throw new ConfigurationError(response.data.errors[0].title); + } + }, +}; diff --git a/components/kustomer/actions/update-customer/update-customer.mjs b/components/kustomer/actions/update-customer/update-customer.mjs index 22227af9e6843..1511d934e8b56 100644 --- a/components/kustomer/actions/update-customer/update-customer.mjs +++ b/components/kustomer/actions/update-customer/update-customer.mjs @@ -7,7 +7,7 @@ export default { key: "kustomer-update-customer", name: "Update Customer", description: "Updates an existing customer in Kustomer. [See the documentation](https://developer.kustomer.com/kustomer-api-docs/reference/updatecustomer)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { kustomer, diff --git a/components/kustomer/kustomer.app.mjs b/components/kustomer/kustomer.app.mjs index 02350afd565d9..cbc22d62b2cb3 100644 --- a/components/kustomer/kustomer.app.mjs +++ b/components/kustomer/kustomer.app.mjs @@ -127,6 +127,49 @@ export default { })); }, }, + klassName: { + type: "string", + label: "Klass Name", + description: "Klass name of the KObjects (custom objects)", + async options({ page }) { + const { data } = await this.listKlasses({ + params: { + page: page + 1, + pageSize: LIMIT * page, + }, + }); + return data.map(({ + attributes: { + name: value, displayName: label, + }, + }) => ({ + label, + value, + })); + }, + }, + customObjectId: { + type: "string", + label: "Custom Object ID", + description: "The ID of the custom object to retrieve", + async options({ + page, klassName, + }) { + const { data } = await this.listCustomObjects({ + klassName, + params: { + page: page + 1, + pageSize: LIMIT * page, + }, + }); + return data.map(({ + id: value, attributes: { title: label }, + }) => ({ + label, + value, + })); + }, + }, externalId: { type: "string", label: "External ID", @@ -327,6 +370,51 @@ export default { ...opts, }); }, + listKlasses(opts = {}) { + return this._makeRequest({ + path: "/klasses", + ...opts, + }); + }, + listCustomObjects({ + klassName, ...opts + }) { + return this._makeRequest({ + path: `/klasses/${klassName}`, + ...opts, + }); + }, + getCustomObjectById({ + klassName, + customObjectId, + ...opts + }) { + return this._makeRequest({ + path: `/klasses/${klassName}/${customObjectId}`, + ...opts, + }); + }, + getCustomObjectByExternalId({ + klassName, + externalId, + ...opts + }) { + return this._makeRequest({ + path: `/klasses/${klassName}/externalId=${externalId}`, + ...opts, + }); + }, + updateCustomObjectById({ + klassName, + customObjectId, + ...opts + }) { + return this._makeRequest({ + method: "PUT", + path: `/klasses/${klassName}/${customObjectId}`, + ...opts, + }); + }, createWebhook(opts = {}) { return this._makeRequest({ method: "POST", diff --git a/components/kustomer/package.json b/components/kustomer/package.json index 461537a2f3dad..c341e4171a549 100644 --- a/components/kustomer/package.json +++ b/components/kustomer/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/kustomer", - "version": "0.1.0", + "version": "0.2.0", "description": "Pipedream Kustomer Components", "main": "kustomer.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3" + "@pipedream/platform": "^3.1.0" } } diff --git a/components/kustomer/sources/new-conversation-instant/new-conversation-instant.mjs b/components/kustomer/sources/new-conversation-instant/new-conversation-instant.mjs index 3e43317b7df50..23007485106ef 100644 --- a/components/kustomer/sources/new-conversation-instant/new-conversation-instant.mjs +++ b/components/kustomer/sources/new-conversation-instant/new-conversation-instant.mjs @@ -6,7 +6,7 @@ export default { key: "kustomer-new-conversation-instant", name: "New Conversation Created (Instant)", description: "Emit new event when a conversation is created in Kustomer.", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { diff --git a/components/kustomer/sources/new-customer-instant/new-customer-instant.mjs b/components/kustomer/sources/new-customer-instant/new-customer-instant.mjs index f95c61d64135b..0004b43cb3a47 100644 --- a/components/kustomer/sources/new-customer-instant/new-customer-instant.mjs +++ b/components/kustomer/sources/new-customer-instant/new-customer-instant.mjs @@ -6,7 +6,7 @@ export default { key: "kustomer-new-customer-instant", name: "New Customer Created (Instant)", description: "Emit new event when a new customer is added to Kustomer.", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { diff --git a/components/kustomer/sources/new-message-instant/new-message-instant.mjs b/components/kustomer/sources/new-message-instant/new-message-instant.mjs index 6a1dc899c41fb..7c2e92a52c95c 100644 --- a/components/kustomer/sources/new-message-instant/new-message-instant.mjs +++ b/components/kustomer/sources/new-message-instant/new-message-instant.mjs @@ -6,7 +6,7 @@ export default { key: "kustomer-new-message-instant", name: "New Message Created in Conversation (Instant)", description: "Emit new event when a new message is created in a conversation.", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { diff --git a/components/kustomer/sources/updated-conversation-instant/updated-conversation-instant.mjs b/components/kustomer/sources/updated-conversation-instant/updated-conversation-instant.mjs index eea7b13895ee1..226db71f6abd5 100644 --- a/components/kustomer/sources/updated-conversation-instant/updated-conversation-instant.mjs +++ b/components/kustomer/sources/updated-conversation-instant/updated-conversation-instant.mjs @@ -6,7 +6,7 @@ export default { key: "kustomer-updated-conversation-instant", name: "Updated Conversation (Instant)", description: "Emit new event when an existing conversation is updated in Kustomer.", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { diff --git a/components/kustomer/sources/updated-customer-instant/updated-customer-instant.mjs b/components/kustomer/sources/updated-customer-instant/updated-customer-instant.mjs index bfc23bd58c609..29390d3ee1679 100644 --- a/components/kustomer/sources/updated-customer-instant/updated-customer-instant.mjs +++ b/components/kustomer/sources/updated-customer-instant/updated-customer-instant.mjs @@ -6,7 +6,7 @@ export default { key: "kustomer-updated-customer-instant", name: "Updated Customer (Instant)", description: "Emit new event when an existing customer's details are updated in Kustomer.", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4fb257878b384..300eeacb1a3cd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4158,8 +4158,7 @@ importers: specifier: ^3.0.3 version: 3.0.3 - components/ebay: - specifiers: {} + components/ebay: {} components/echtpost_postcards: dependencies: @@ -7347,8 +7346,8 @@ importers: components/kustomer: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 components/kvdb: dependencies: @@ -9571,8 +9570,7 @@ importers: specifier: ^4.3.2 version: 4.5.0 - components/openum: - specifiers: {} + components/openum: {} components/openweather_api: dependencies: @@ -12837,8 +12835,7 @@ importers: components/sms_magic: {} - components/sms_messages: - specifiers: {} + components/sms_messages: {} components/sms_partner: {} @@ -14908,8 +14905,7 @@ importers: specifier: ^3.0.0 version: 3.0.3 - components/wbiztool: - specifiers: {} + components/wbiztool: {} components/wealthbox: dependencies: @@ -17651,12 +17647,12 @@ packages: '@datadog/sketches-js@2.1.1': resolution: {integrity: sha512-d5RjycE+MObE/hU+8OM5Zp4VjTwiPLRa8299fj7muOmR16fb942z8byoMbCErnGh0lBevvgkGrLclQDvINbIyg==} - '@definitelytyped/header-parser@0.2.19': - resolution: {integrity: sha512-zu+RxQpUCgorYUQZoyyrRIn9CljL1CeM4qak3NDeMO1r7tjAkodfpAGnVzx/6JR2OUk0tAgwmZxNMSwd9LVgxw==} + '@definitelytyped/header-parser@0.2.20': + resolution: {integrity: sha512-97YPAlUo8XjWNtZ+6k+My+50/ljE2iX6KEPjOZ1Az1RsZdKwJ6taAX3F5g6SY1SJr50bzdm2RZzyQNdRmHcs4w==} engines: {node: '>=18.18.0'} - '@definitelytyped/typescript-versions@0.1.8': - resolution: {integrity: sha512-iz6q9aTwWW7CzN2g8jFQfZ955D63LA+wdIAKz4+2pCc/7kokmEHie1/jVWSczqLFOlmH+69bWQxIurryBP/sig==} + '@definitelytyped/typescript-versions@0.1.9': + resolution: {integrity: sha512-Qjalw9eNlcTjXhzx0Q6kHKuRCOUt/M5RGGRGKsiYlm/nveGvPX9liZSQlGXZVwyQ5I9qvq/GdaWiPchQ+ZXOrQ==} engines: {node: '>=18.18.0'} '@definitelytyped/utils@0.1.8': @@ -34879,13 +34875,13 @@ snapshots: '@datadog/sketches-js@2.1.1': {} - '@definitelytyped/header-parser@0.2.19': + '@definitelytyped/header-parser@0.2.20': dependencies: - '@definitelytyped/typescript-versions': 0.1.8 + '@definitelytyped/typescript-versions': 0.1.9 '@definitelytyped/utils': 0.1.8 semver: 7.7.2 - '@definitelytyped/typescript-versions@0.1.8': {} + '@definitelytyped/typescript-versions@0.1.9': {} '@definitelytyped/utils@0.1.8': dependencies: @@ -42233,7 +42229,7 @@ snapshots: dts-critic@3.3.11(typescript@5.7.2): dependencies: - '@definitelytyped/header-parser': 0.2.19 + '@definitelytyped/header-parser': 0.2.20 command-exists: 1.2.9 rimraf: 3.0.2 semver: 6.3.1 @@ -42245,8 +42241,8 @@ snapshots: dtslint@4.2.1(typescript@5.7.2): dependencies: - '@definitelytyped/header-parser': 0.2.19 - '@definitelytyped/typescript-versions': 0.1.8 + '@definitelytyped/header-parser': 0.2.20 + '@definitelytyped/typescript-versions': 0.1.9 '@definitelytyped/utils': 0.1.8 dts-critic: 3.3.11(typescript@5.7.2) fs-extra: 6.0.1