diff --git a/.wordlist.txt b/.wordlist.txt index 2c118ef11dccf..d3f4b53684d23 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -1076,4 +1076,4 @@ Golang UX taskSchedulerURL taskId -codebase \ No newline at end of file +codebase diff --git a/components/sendoso/README.md b/components/sendoso/README.md deleted file mode 100644 index c70c24d9f2a9e..0000000000000 --- a/components/sendoso/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Overview - -Sendoso is a sending platform that enables companies to engage with customers through direct mail, eGifts, and other physical deliveries. Utilizing the Sendoso API via Pipedream allows for the automation of these outreach efforts, seamlessly integrating with CRM systems, marketing automation, or customer support tools. By leveraging workflows and events, you can trigger Sendoso actions based on user behavior, sales milestones, or support tickets, enhancing the physical impact of your digital engagements. - -# Example Use Cases - -- **Lead Nurturing Campaigns**: Automatically send personalized gifts or swag to leads who have reached a specific stage in your sales funnel in Salesforce. This can improve conversion rates and foster customer relationships. - -- **Customer Milestone Celebrations**: Set up a workflow that monitors subscription lengths or user achievements in your service platform, like Stripe, and sends a token of appreciation via Sendoso when a customer reaches a new tier or milestone. - -- **Event Follow-Up**: After an event stored in Eventbrite, automate sending thank you notes or relevant merchandise to attendees, showing appreciation and keeping your brand top of mind. diff --git a/components/sendoso/actions/create-egift-links/create-egift-links.mjs b/components/sendoso/actions/create-egift-links/create-egift-links.mjs new file mode 100644 index 0000000000000..641827b4697a5 --- /dev/null +++ b/components/sendoso/actions/create-egift-links/create-egift-links.mjs @@ -0,0 +1,50 @@ +import sendoso from "../../sendoso.app.mjs"; + +export default { + key: "sendoso-create-egift-links", + name: "Create eGift Links", + description: "Generate eGift links. [See the documentation](https://developer.sendoso.com/rest-api/reference/sends/egift/eGiftlink)", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: false, + }, + type: "action", + props: { + sendoso, + touchId: { + propDefinition: [ + sendoso, + "touchId", + ], + }, + viaFrom: { + type: "string", + label: "Via From", + description: "The name of the application making the send request. Please make sure this is consistent per application.", + }, + recipientUsers: { + type: "string[]", + label: "Recipient Users", + description: "The list of recipient emails to generate eGift links for.", + }, + }, + async run({ $ }) { + const response = await this.sendoso.createEgiftLinks({ + $, + data: { + send: { + touch_id: this.touchId, + via: "generate_egift_links", + via_from: this.viaFrom, + recipient_users: this.recipientUsers.map((email) => ({ + email, + })), + }, + }, + }); + $.export("$summary", "Successfully created eGift links"); + return response; + }, +}; diff --git a/components/sendoso/actions/generate-egift-link/generate-egift-link.mjs b/components/sendoso/actions/generate-egift-link/generate-egift-link.mjs deleted file mode 100644 index fb2a3f54a5952..0000000000000 --- a/components/sendoso/actions/generate-egift-link/generate-egift-link.mjs +++ /dev/null @@ -1,83 +0,0 @@ -import sendoso from "../../sendoso.app.mjs"; - -export default { - key: "sendoso-generate-egift-link", - name: "Generate eGift Link", - version: "0.0.2", - annotations: { - destructiveHint: false, - openWorldHint: true, - readOnlyHint: false, - }, - description: "Generate a new E-Gift link [See the docs here](https://sendoso.docs.apiary.io/#reference/send-management/generate-egift-links/sending-a-e-gift)", - type: "action", - props: { - sendoso, - via: { - propDefinition: [ - sendoso, - "via", - ], - }, - template: { - propDefinition: [ - sendoso, - "template", - ], - optional: true, - }, - groupId: { - propDefinition: [ - sendoso, - "groupId", - ], - }, - touchId: { - propDefinition: [ - sendoso, - "touchId", - (c) => ({ - groupId: c.groupId, - }), - ], - }, - recipientUsers: { - propDefinition: [ - sendoso, - "recipientUsers", - (c) => ({ - groupId: c.groupId, - }), - ], - optional: true, - }, - viaFrom: { - propDefinition: [ - sendoso, - "viaFrom", - ], - optional: true, - }, - }, - async run({ $ }) { - const { - via, - template, - touchId, - viaFrom, - recipientUsers, - } = this; - - const response = await this.sendoso.sendGift({ - $, - via, - template, - touch_id: touchId, - via_from: viaFrom, - recipient_users: recipientUsers, - }); - - $.export("$summary", `E-Gift successfully generated with tracking code: ${response.tracking_code}!`); - return response; - }, -}; diff --git a/components/sendoso/actions/get-campaign/get-campaign.mjs b/components/sendoso/actions/get-campaign/get-campaign.mjs new file mode 100644 index 0000000000000..75e33561dc70d --- /dev/null +++ b/components/sendoso/actions/get-campaign/get-campaign.mjs @@ -0,0 +1,35 @@ +import sendoso from "../../sendoso.app.mjs"; + +export default { + key: "sendoso-get-campaign", + name: "Get Campaign", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + description: "Retrieve details about a specific campaign. [See the documentation](https://developer.sendoso.com/rest-api/reference/campaigns/get-campaign)", + type: "action", + props: { + sendoso, + campaignId: { + propDefinition: [ + sendoso, + "campaignId", + ], + }, + }, + async run({ $ }) { + const { campaignId } = this; + + const response = await this.sendoso.getCampaign({ + $, + campaignId, + }); + + $.export("$summary", `Successfully retrieved campaign ID: ${campaignId}`); + return response; + }, +}; + diff --git a/components/sendoso/actions/get-current-user/get-current-user.mjs b/components/sendoso/actions/get-current-user/get-current-user.mjs new file mode 100644 index 0000000000000..bb7cfb9fb63c7 --- /dev/null +++ b/components/sendoso/actions/get-current-user/get-current-user.mjs @@ -0,0 +1,24 @@ +import sendoso from "../../sendoso.app.mjs"; + +export default { + key: "sendoso-get-current-user", + name: "Get Current User", + description: "Get information about the current user. [See the documentation](https://developer.sendoso.com/rest-api/reference/users/get-current-user)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + sendoso, + }, + async run({ $ }) { + const response = await this.sendoso.getCurrentUser({ + $, + }); + $.export("$summary", `Successfully retrieved current user information for ${response.email || "user"}`); + return response; + }, +}; diff --git a/components/sendoso/actions/get-send-status/get-send-status.mjs b/components/sendoso/actions/get-send-status/get-send-status.mjs index 6cec942fe1939..6cbffb561f581 100644 --- a/components/sendoso/actions/get-send-status/get-send-status.mjs +++ b/components/sendoso/actions/get-send-status/get-send-status.mjs @@ -3,7 +3,7 @@ import sendoso from "../../sendoso.app.mjs"; export default { key: "sendoso-get-send-status", name: "Get Send Status", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, diff --git a/components/sendoso/actions/invite-new-user/invite-new-user.mjs b/components/sendoso/actions/invite-new-user/invite-new-user.mjs new file mode 100644 index 0000000000000..0283aa35782d8 --- /dev/null +++ b/components/sendoso/actions/invite-new-user/invite-new-user.mjs @@ -0,0 +1,63 @@ +import sendoso from "../../sendoso.app.mjs"; + +export default { + key: "sendoso-invite-new-user", + name: "Invite New User", + description: "Invite a new user to the account. [See the documentation](https://developer.sendoso.com/rest-api/reference/users/invite-user)", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: false, + }, + type: "action", + props: { + sendoso, + groupId: { + propDefinition: [ + sendoso, + "groupId", + ], + }, + email: { + type: "string", + label: "Email", + description: "The email address of the user to invite.", + }, + firstName: { + type: "string", + label: "First Name", + description: "The first name of the user to invite.", + }, + lastName: { + type: "string", + label: "Last Name", + description: "The last name of the user to invite.", + }, + role: { + type: "string", + label: "Role", + description: "The role of the user to invite.", + options: [ + "regular", + "manager", + ], + }, + }, + async run({ $ }) { + const response = await this.sendoso.inviteNewUser({ + $, + data: { + user: { + team_group_id: this.groupId, + email: this.email, + first_name: this.firstName, + last_name: this.lastName, + role: this.role, + }, + }, + }); + $.export("$summary", `Successfully invited new user ${this.firstName} ${this.lastName} to group ${this.groupId}`); + return response; + }, +}; diff --git a/components/sendoso/actions/list-all-users/list-all-users.mjs b/components/sendoso/actions/list-all-users/list-all-users.mjs new file mode 100644 index 0000000000000..abcdf6577b483 --- /dev/null +++ b/components/sendoso/actions/list-all-users/list-all-users.mjs @@ -0,0 +1,45 @@ +import sendoso from "../../sendoso.app.mjs"; + +export default { + key: "sendoso-list-all-users", + name: "List All Users", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + description: "Retrieve a list of all users in the account. [See the documentation](https://developer.sendoso.com/rest-api/reference/users/get-users)", + type: "action", + props: { + sendoso, + page: { + propDefinition: [ + sendoso, + "page", + ], + }, + perPage: { + propDefinition: [ + sendoso, + "perPage", + ], + }, + }, + async run({ $ }) { + const response = await this.sendoso.listUsers({ + $, + params: { + page: this.page, + per_page: this.perPage, + }, + }); + + const count = Array.isArray(response) ? + response.length : + (response.data?.length || 0); + $.export("$summary", `Successfully retrieved ${count} user(s)`); + return response; + }, +}; + diff --git a/components/sendoso/actions/list-campaigns/list-campaigns.mjs b/components/sendoso/actions/list-campaigns/list-campaigns.mjs new file mode 100644 index 0000000000000..fdbe8a40e0105 --- /dev/null +++ b/components/sendoso/actions/list-campaigns/list-campaigns.mjs @@ -0,0 +1,45 @@ +import sendoso from "../../sendoso.app.mjs"; + +export default { + key: "sendoso-list-campaigns", + name: "List Campaigns", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + description: "Retrieve a list of all campaigns with optional filters. [See the documentation](https://developer.sendoso.com/rest-api/reference/campaigns/get-campaigns)", + type: "action", + props: { + sendoso, + page: { + propDefinition: [ + sendoso, + "page", + ], + }, + perPage: { + propDefinition: [ + sendoso, + "perPage", + ], + }, + }, + async run({ $ }) { + const response = await this.sendoso.listCampaigns({ + $, + params: { + page: this.page, + per_page: this.perPage, + }, + }); + + const count = Array.isArray(response) ? + response.length : + (response.data?.length || 0); + $.export("$summary", `Successfully retrieved ${count} campaign(s)`); + return response; + }, +}; + diff --git a/components/sendoso/actions/list-catalog-items/list-catalog-items.mjs b/components/sendoso/actions/list-catalog-items/list-catalog-items.mjs new file mode 100644 index 0000000000000..6480101bac77c --- /dev/null +++ b/components/sendoso/actions/list-catalog-items/list-catalog-items.mjs @@ -0,0 +1,47 @@ +import sendoso from "../../sendoso.app.mjs"; + +export default { + key: "sendoso-list-catalog-items", + name: "List Catalog Items", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + description: "Retrieve a list of catalog items available for sending. [See the documentation](https://developer.sendoso.com/marketplace/reference/products/get-products)", + type: "action", + props: { + sendoso, + categoryIds: { + type: "string[]", + label: "Category IDs", + description: "Filter by category IDs", + optional: true, + }, + after: { + type: "string", + label: "After", + description: "The start for cursor for pagination. This is returned in the pagination object of the previous response.", + optional: true, + }, + }, + async run({ $ }) { + const params = { + category_ids: this.categoryIds, + after: this.after, + }; + + const response = await this.sendoso.listCatalogItems({ + $, + params, + }); + + const count = Array.isArray(response) ? + response.length : + (response.data?.length || 0); + $.export("$summary", `Successfully retrieved ${count} catalog item(s)`); + return response; + }, +}; + diff --git a/components/sendoso/actions/list-group-members/list-group-members.mjs b/components/sendoso/actions/list-group-members/list-group-members.mjs new file mode 100644 index 0000000000000..a4406c0d85dc9 --- /dev/null +++ b/components/sendoso/actions/list-group-members/list-group-members.mjs @@ -0,0 +1,35 @@ +import sendoso from "../../sendoso.app.mjs"; + +export default { + key: "sendoso-list-group-members", + name: "List Group Members", + description: "List all members (users) of a specific group. [See the documentation](https://developer.sendoso.com/rest-api/reference/teams/get-team-users)", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + type: "action", + props: { + sendoso, + groupId: { + propDefinition: [ + sendoso, + "groupId", + ], + }, + }, + async run({ $ }) { + const response = await this.sendoso.listGroupMembers({ + $, + groupId: this.groupId, + }); + + const count = Array.isArray(response) ? + response.length : + (response.data?.length || response.users?.length || 0); + $.export("$summary", `Successfully retrieved ${count} member(s)`); + return response; + }, +}; diff --git a/components/sendoso/actions/list-groups/list-groups.mjs b/components/sendoso/actions/list-groups/list-groups.mjs new file mode 100644 index 0000000000000..cfed30d3447c6 --- /dev/null +++ b/components/sendoso/actions/list-groups/list-groups.mjs @@ -0,0 +1,41 @@ +import sendoso from "../../sendoso.app.mjs"; + +export default { + key: "sendoso-list-groups", + name: "List Groups", + description: "List all groups (teams). [See the documentation](https://developer.sendoso.com/rest-api/reference/teams/get-teams)", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + type: "action", + props: { + sendoso, + page: { + propDefinition: [ + sendoso, + "page", + ], + }, + perPage: { + propDefinition: [ + sendoso, + "perPage", + ], + }, + }, + async run({ $ }) { + const response = await this.sendoso.listGroups({ + $, + params: { + page: this.page, + per_page: this.perPage, + }, + }); + + $.export("$summary", `Successfully retrieved ${response.length} groups`); + return response; + }, +}; diff --git a/components/sendoso/actions/list-sends/list-sends.mjs b/components/sendoso/actions/list-sends/list-sends.mjs new file mode 100644 index 0000000000000..07b5fcd64b3fe --- /dev/null +++ b/components/sendoso/actions/list-sends/list-sends.mjs @@ -0,0 +1,45 @@ +import sendoso from "../../sendoso.app.mjs"; + +export default { + key: "sendoso-list-sends", + name: "List Sends", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + description: "Retrieve a list of all sends/gifts with optional filters. [See the documentation](https://developer.sendoso.com/rest-api/reference/sends/get-sends)", + type: "action", + props: { + sendoso, + page: { + propDefinition: [ + sendoso, + "page", + ], + }, + perPage: { + propDefinition: [ + sendoso, + "perPage", + ], + }, + }, + async run({ $ }) { + const response = await this.sendoso.listSends({ + $, + params: { + page: this.page, + per_page: this.perPage, + }, + }); + + const count = Array.isArray(response) ? + response.length : + (response.data?.length || 0); + $.export("$summary", `Successfully retrieved ${count} send(s)`); + return response; + }, +}; + diff --git a/components/sendoso/actions/send-egift/send-egift.mjs b/components/sendoso/actions/send-egift/send-egift.mjs new file mode 100644 index 0000000000000..7d948f8587319 --- /dev/null +++ b/components/sendoso/actions/send-egift/send-egift.mjs @@ -0,0 +1,63 @@ +import sendoso from "../../sendoso.app.mjs"; + +export default { + key: "sendoso-send-egift", + name: "Send an eGift", + description: "Send an eGift. [See the documentation](https://developer.sendoso.com/rest-api/reference/sends/egift/eGift)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: false, + }, + props: { + sendoso, + touchId: { + propDefinition: [ + sendoso, + "touchId", + ], + }, + name: { + type: "string", + label: "Name", + description: "The name of the recipient.", + optional: true, + }, + email: { + type: "string", + label: "Email", + description: "The email address of the recipient.", + }, + customMessage: { + type: "string", + label: "Custom Message", + description: "A custom message to include with the send.", + optional: true, + }, + viaFrom: { + propDefinition: [ + sendoso, + "viaFrom", + ], + }, + }, + async run({ $ }) { + const response = await this.sendoso.sendGift({ + $, + data: { + send: { + touch_id: this.touchId, + name: this.name, + email: this.email, + custom_message: this.customMessage, + via_from: this.viaFrom, + via: "single_email_address", + }, + }, + }); + $.export("$summary", `Successfully created send with tracking code: ${response.tracking_code || response.message || "Send created"}`); + return response; + }, +}; diff --git a/components/sendoso/actions/send-physical-gift-with-address-confirmation/send-physical-gift-with-address-confirmation.mjs b/components/sendoso/actions/send-physical-gift-with-address-confirmation/send-physical-gift-with-address-confirmation.mjs index 5a650d270d01d..9272df98ce65b 100644 --- a/components/sendoso/actions/send-physical-gift-with-address-confirmation/send-physical-gift-with-address-confirmation.mjs +++ b/components/sendoso/actions/send-physical-gift-with-address-confirmation/send-physical-gift-with-address-confirmation.mjs @@ -3,13 +3,13 @@ import sendoso from "../../sendoso.app.mjs"; export default { key: "sendoso-send-physical-gift-with-address-confirmation", name: "Send A Physical Gift With Address Confirmation", - version: "0.0.2", + version: "0.0.3", annotations: { destructiveHint: false, openWorldHint: true, readOnlyHint: false, }, - description: "Send a physical gift. [See the docs here](https://sendoso.docs.apiary.io/#reference/send-management/send-a-gift/sending-a-gift)", + description: "Send a physical gift. [See the docs here](https://developer.sendoso.com/rest-api/reference/sends/physical/physicalAC)", type: "action", props: { sendoso, @@ -40,37 +40,6 @@ export default { label: "Name", description: "The name of the person receiving the gift.", }, - address: { - type: "string", - label: "Address", - description: "The first line of the street address.", - }, - address1: { - type: "string", - label: "Address 1", - description: "The second line of the street address if applicable.", - optional: true, - }, - city: { - type: "string", - label: "City", - description: "City of recipients address.", - }, - state: { - type: "string", - label: "State", - description: "US state of the address (International sending is not available via API at this time).", - }, - country: { - type: "string", - label: "Country", - description: "E.g. USA", - }, - zip: { - type: "string", - label: "ZIP", - description: "Zip code of recipients shipping address.", - }, viaFrom: { propDefinition: [ sendoso, @@ -119,12 +88,6 @@ export default { via, touchId, name, - address, - address1, - city, - state, - country, - zip, viaFrom, customMessage, addressConfirmationVia, @@ -135,22 +98,20 @@ export default { const response = await this.sendoso.sendGift({ $, - via, - touch_id: touchId, - name, - address, - address1, - city, - state, - country, - zip, - via_from: viaFrom, - custom_message: customMessage, - confirm_address: "TRUE", - address_confirmation_via: addressConfirmationVia, - resume_with_unconfirmed_address: resumeWithUnconfirmedAddress, - no_address: noAddress, - expire_after_days: expireAfterDays, + data: { + send: { + via, + touch_id: touchId, + name, + via_from: viaFrom, + custom_message: customMessage, + confirm_address: "TRUE", + address_confirmation_via: addressConfirmationVia, + resume_with_unconfirmed_address: resumeWithUnconfirmedAddress, + no_address: noAddress, + expire_after_days: expireAfterDays, + }, + }, }); $.export("$summary", `Gift sent successfully with Tracking Code: ${response.tracking_code}!`); diff --git a/components/sendoso/actions/send-physical-gift/send-physical-gift.mjs b/components/sendoso/actions/send-physical-gift/send-physical-gift.mjs new file mode 100644 index 0000000000000..b6f9b81ebaaa4 --- /dev/null +++ b/components/sendoso/actions/send-physical-gift/send-physical-gift.mjs @@ -0,0 +1,114 @@ +import sendoso from "../../sendoso.app.mjs"; + +export default { + key: "sendoso-send-physical-gift", + name: "Send a Physical Gift", + description: "Send a physical gift. [See the documentation](https://developer.sendoso.com/rest-api/reference/sends/physical/physical)", + version: "0.0.1", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: false, + }, + type: "action", + props: { + sendoso, + touchId: { + propDefinition: [ + sendoso, + "touchId", + ], + }, + via: { + type: "string", + label: "Send Type", + description: "Type of send. Use 'single_person_or_company' for physical gifts or 'single_email_address' for eGifts.", + options: [ + "single_person_or_company", + "single_email_address", + ], + }, + viaFrom: { + type: "string", + label: "Via From", + description: "Application name or sender identifier.", + }, + email: { + type: "string", + label: "Email", + description: "The email address of the recipient.", + }, + name: { + type: "string", + label: "Name", + description: "The name of the recipient.", + optional: true, + }, + address: { + type: "string", + label: "Address", + description: "The address of the recipient (for physical gifts).", + optional: true, + }, + city: { + type: "string", + label: "City", + description: "The city of the recipient.", + optional: true, + }, + state: { + type: "string", + label: "State", + description: "The state of the recipient.", + optional: true, + }, + zip: { + type: "string", + label: "Zip", + description: "The zip code of the recipient.", + optional: true, + }, + country: { + type: "string", + label: "Country", + description: "The country of the recipient.", + optional: true, + }, + customMessage: { + type: "string", + label: "Custom Message", + description: "A custom message to include with the send.", + optional: true, + }, + confirmAddress: { + type: "boolean", + label: "Confirm Address", + description: "Whether to confirm the recipient's address (for physical gifts). Set to false if providing complete address.", + optional: true, + default: false, + }, + }, + async run({ $ }) { + const response = await this.sendoso.sendGift({ + $, + data: { + send: { + touch_id: this.touchId, + via: this.via, + via_from: this.viaFrom, + email: this.email, + name: this.name, + address: this.address, + city: this.city, + state: this.state, + zip: this.zip, + country: this.country, + custom_message: this.customMessage, + confirm_address: this.confirmAddress, + }, + }, + }); + $.export("$summary", `Successfully created send with tracking code: ${response.tracking_code || response.message || "Send created"}`); + return response; + }, +}; diff --git a/components/sendoso/common/utils.mjs b/components/sendoso/common/utils.mjs new file mode 100644 index 0000000000000..dcc9cc61f6f41 --- /dev/null +++ b/components/sendoso/common/utils.mjs @@ -0,0 +1,24 @@ +export const parseObject = (obj) => { + if (!obj) return undefined; + + if (Array.isArray(obj)) { + return obj.map((item) => { + if (typeof item === "string") { + try { + return JSON.parse(item); + } catch (e) { + return item; + } + } + return item; + }); + } + if (typeof obj === "string") { + try { + return JSON.parse(obj); + } catch (e) { + return obj; + } + } + return obj; +}; diff --git a/components/sendoso/package.json b/components/sendoso/package.json index 8b2bf2a4004f1..81272918b36d5 100644 --- a/components/sendoso/package.json +++ b/components/sendoso/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/sendoso", - "version": "0.0.3", + "version": "0.1.0", "description": "Pipedream Sendoso Components", "main": "sendoso.app.mjs", "keywords": [ @@ -13,6 +13,6 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^1.6.8" + "@pipedream/platform": "^3.1.1" } } diff --git a/components/sendoso/sendoso.app.mjs b/components/sendoso/sendoso.app.mjs index 80c58ad9f9a7e..6b9b22f5a2de9 100644 --- a/components/sendoso/sendoso.app.mjs +++ b/components/sendoso/sendoso.app.mjs @@ -19,44 +19,12 @@ export default { })); }, }, - recipientUsers: { - type: "string[]", - label: "Recipient Users", - description: "The array of gift recipient users. If not provided, links can be redeemed by anyone.", - async options({ groupId }) { - const data = await this.listUsers(groupId); - - return data.map(({ email }) => email); - }, - }, - template: { - type: "integer", - label: "Template", - description: "The ID of the Template.", - async options() { - const data = await this.listTemplates(); - let result; - if (typeof data === "string") { - result = data.replace(/(},)(?!.*\1)/gs, "}"); - result = JSON.parse(result); - } else { - result = data; - } - - return result.custom_template.map(({ - id: value, name: label, - }) => ({ - label, - value, - })); - }, - }, touchId: { type: "integer", label: "Touch ID", description: "The ID of the Touch.", - async options({ groupId }) { - const data = await this.listTouches(groupId); + async options() { + const data = await this.listCampaigns(); return data.map(({ id: value, name: label, @@ -91,6 +59,45 @@ export default { label: "Via From", description: "Specify the name of your Company or Application.", }, + sendId: { + type: "string", + label: "Send ID", + description: "The ID of the send.", + }, + campaignId: { + type: "string", + label: "Campaign ID", + description: "The ID of the campaign.", + }, + userId: { + type: "string", + label: "User ID", + description: "The ID of the user.", + }, + startDate: { + type: "string", + label: "Start Date", + description: "Start date for filtering (YYYY-MM-DD format).", + }, + endDate: { + type: "string", + label: "End Date", + description: "End date for filtering (YYYY-MM-DD format).", + }, + page: { + type: "integer", + label: "Page", + description: "Page number to return.", + optional: true, + default: 1, + }, + perPage: { + type: "integer", + label: "Per Page", + description: "Number of results to return per page.", + optional: true, + default: 50, + }, }, methods: { _apiUrl() { @@ -98,7 +105,7 @@ export default { }, _getHeaders() { return { - "Authorization": `Bearer ${this.$auth.oauth_access_token}`, + Authorization: `Bearer ${this.$auth.oauth_access_token}`, }; }, async _makeRequest({ @@ -111,32 +118,44 @@ export default { }; return axios($, config); }, - sendGift({ - $, ...data - }) { + createEgiftLinks(opts = {}) { return this._makeRequest({ - $, - path: "send.json", + path: "send/generate_egift_links", method: "POST", - data, + ...opts, + }); + }, + getCurrentUser(opts = {}) { + return this._makeRequest({ + path: "me", + ...opts, }); }, - getSentGifts() { + sendGift(opts = {}) { + return this._makeRequest({ + path: "send", + method: "POST", + ...opts, + }); + }, + getSentGifts(opts = {}) { return this._makeRequest({ path: "sent_gifts.json", + ...opts, }); }, getSendStatus({ - $, trackingId, + trackingId, ...opts }) { return this._makeRequest({ - $, path: `gifts/status/${trackingId}`, + ...opts, }); }, - listGroups() { + listGroups(opts = {}) { return this._makeRequest({ - path: "groups.json", + path: "groups", + ...opts, }); }, listSendGifts() { @@ -144,19 +163,65 @@ export default { path: "sent_gifts.json", }); }, - listTemplates() { + listUsers(opts = {}) { + return this._makeRequest({ + path: "users", + ...opts, + }); + }, + listGroupMembers({ + groupId, ...opts + }) { + return this._makeRequest({ + path: `groups/${groupId}/members`, + ...opts, + }); + }, + // Send Management Methods + listSends(opts = {}) { + return this._makeRequest({ + path: "send", + ...opts, + }); + }, + // Touch Management Methods + getCampaign({ + campaignId, ...opts + }) { return this._makeRequest({ - path: "user_custom_templates.json", + path: `touches/${campaignId}`, + ...opts, }); }, - listTouches(groupId) { + // Campaign Management Methods + listCampaigns(opts = {}) { return this._makeRequest({ - path: `groups/${groupId}/group_touches.json`, + path: "touches", + ...opts, }); }, - listUsers(groupId) { + // Catalog Management Methods + listCatalogItems(opts = {}) { return this._makeRequest({ - path: `groups/${groupId}/members.json`, + path: "marketplace/products", + ...opts, + }); + }, + // eGift Management Methods + getEgiftLink({ + linkId, ...opts + }) { + return this._makeRequest({ + path: `egift_links/${linkId}`, + ...opts, + }); + }, + // User Management Methods + inviteNewUser(opts = {}) { + return this._makeRequest({ + path: "users", + method: "POST", + ...opts, }); }, }, diff --git a/components/sendoso/sources/new-send/new-send.mjs b/components/sendoso/sources/new-send/new-send.mjs index ac47e1e1e2404..eb5e9052f23b1 100644 --- a/components/sendoso/sources/new-send/new-send.mjs +++ b/components/sendoso/sources/new-send/new-send.mjs @@ -7,7 +7,7 @@ export default { name: "New Send Created", key: "sendoso-new-send", description: "Emit new event when a new send is created. [See docs here](https://sendoso.docs.apiary.io/#reference/send-management/get-all-sent-giftsitems/get-sent-gifts)", - version: "0.0.1", + version: "0.0.2", dedupe: "unique", props: { ...common.props, diff --git a/components/sendoso/sources/send-status-updated/send-status-updated.mjs b/components/sendoso/sources/send-status-updated/send-status-updated.mjs index e3efa70a2f2a9..74789302b8b2f 100644 --- a/components/sendoso/sources/send-status-updated/send-status-updated.mjs +++ b/components/sendoso/sources/send-status-updated/send-status-updated.mjs @@ -8,7 +8,7 @@ export default { name: "New Send Status Updated", key: "sendoso-send-status-updated", description: "Emit new event when a send status is updated. [See docs here](https://sendoso.docs.apiary.io/#reference/send-management/send-tracking/fetch-the-status-of-a-send)", - version: "0.0.1", + version: "0.0.2", dedupe: "unique", props: { ...common.props, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3fe83b377b8c9..9ea50ae35bdae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13222,8 +13222,8 @@ importers: components/sendoso: dependencies: '@pipedream/platform': - specifier: ^1.6.8 - version: 1.6.8 + specifier: ^3.1.1 + version: 3.1.1 components/sendowl: dependencies: