diff --git a/components/linkup/README.md b/components/linkup/README.md new file mode 100644 index 0000000000000..690952f35b9ed --- /dev/null +++ b/components/linkup/README.md @@ -0,0 +1,12 @@ +# Overview +The Linkup API allows you to access and retrieve high-quality, real-time content from the internet for various use cases, including search, trend analysis, and contextual data gathering. By integrating the Linkup API with Pipedream, you can automate workflows that leverage Linkup's powerful search capabilities, enabling efficient data retrieval, content processing, and integration with other tools and platforms. + +# Example Use Cases + +- **Automated Content Research and Reporting:** Create a workflow that uses the Linkup API to perform automated searches based on specific queries. The results can be processed and stored in Google Sheets or a database for further analysis. This is particularly useful for market research, trend analysis, or competitive intelligence. + +- **Slack Notifications for Trending Topics:** Use Pipedream to set up a workflow that triggers regular searches on trending topics using the Linkup API. The results can then be sent to a Slack channel, keeping your team informed about the latest developments in your industry. + +- **Dynamic Content Generation for Marketing:** Integrate Linkup with a CMS or email marketing platform. Automatically fetch relevant content or insights from the Linkup API and embed them into newsletters, blog posts, or social media updates, ensuring fresh and engaging content for your audience. + +- **Enhanced Customer Support Knowledge Base:** Use the Linkup API to fetch and update relevant, real-time information from trusted sources to enhance your customer support responses or update your knowledge base dynamically. \ No newline at end of file diff --git a/components/linkup/actions/search/search.mjs b/components/linkup/actions/search/search.mjs new file mode 100644 index 0000000000000..1c57ef0288954 --- /dev/null +++ b/components/linkup/actions/search/search.mjs @@ -0,0 +1,111 @@ +import app from "../../linkup.app.mjs"; + +export default { + name: "Linkup Search", + description: "Search and retrieve insights using the Linkup API. [See the documentation](https://docs.linkup.so/pages/api-reference/endpoint/post-search)", + key: "linkup-search", + version: "0.0.1", + type: "action", + props: { + app, + query: { + type: "string", + label: "Query", + description: "The search query for Linkup.", + }, + depth: { + type: "string", + label: "Search Depth", + description: "Defines the precision of the search. `standard` returns results quickly; `deep` takes longer but yields more complete results.", + options: [ + "standard", + "deep", + ], + }, + outputType: { + type: "string", + label: "Output Type", + description: "The type of output you want to get. Use `structured` for a custom-formatted response defined by `structuredOutputSchema`", + options: [ + { + value: "sourcedAnswer", + label: "Natural language answer and its sources", + }, + { + value: "searchResults", + label: "Raw context", + }, + { + value: "structured", + label: "Json format of the response", + }, + ], + reloadProps: true, + }, + structuredOutputSchema: { + type: "string", + label: "Structured Output Schema", + description: "Schema for structured output (only applicable if Output Type is 'structured'). Provide a JSON schema (as a string) representing the desired response format.", + optional: true, + hidden: true, + }, + includeImages: { + type: "boolean", + label: "Include Images", + description: "Defines whether the API should include images in its results", + optional: true, + }, + }, + additionalProps(props) { + if (this.outputType === "structured") { + props.structuredOutputSchema.optional = false; + props.structuredOutputSchema.hidden = false; + props.structuredOutputSchema.default = `{ + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "year": { + "type": "number" + } + }, + "required": [ + "name", + "year" + ], + "additionalProperties": false + } + } + }, + "required": [ + "results" + ], + "additionalProperties": false + }`; + } + return {}; + }, + async run({ $ }) { + try { + const response = await this.app.search({ + query: this.query, + depth: this.depth, + outputType: this.outputType, + structuredOutputSchema: + this.structuredOutputSchema && JSON.parse(this.structuredOutputSchema), + includeImages: this.includeImages, + }); + $.export("$summary", "Successfully completed search query"); + return response; + } catch (error) { + console.error("Error calling Linkup API:", error); + throw new Error(`Failed to fetch data from Linkup API: ${error.message}`); + } + }, +}; diff --git a/components/linkup/linkup.app.mjs b/components/linkup/linkup.app.mjs index 8f7cd90ab89c5..5b009adf0f11f 100644 --- a/components/linkup/linkup.app.mjs +++ b/components/linkup/linkup.app.mjs @@ -1,11 +1,18 @@ +import { LinkupClient } from "linkup-sdk"; + export default { type: "app", app: "linkup", propDefinitions: {}, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _getClient() { + return new LinkupClient({ + apiKey: this.$auth.api_key, + }); + }, + search(params) { + const client = this._getClient(); + return client.search(params); }, }, }; diff --git a/components/linkup/package.json b/components/linkup/package.json index 25e4c1f3eda47..52e05175f933a 100644 --- a/components/linkup/package.json +++ b/components/linkup/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/linkup", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Linkup Components", "main": "linkup.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "linkup-sdk": "^1.0.3" } -} \ No newline at end of file +} diff --git a/package.json b/package.json index a3163729ac4fa..7b8a6c0668de6 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "@sentry/node": "^7.7.0", "@types/node": "^20.17.6", "crypto": "^1.0.1", + "linkup-sdk": "^1.0.3", "uuid": "^8.3.2", "vue": "^2.6.14" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fb6afae221d92..1369dec8beb36 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,9 @@ importers: crypto: specifier: ^1.0.1 version: 1.0.1 + linkup-sdk: + specifier: ^1.0.3 + version: 1.0.3 uuid: specifier: ^8.3.2 version: 8.3.2 @@ -5891,7 +5894,11 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/linkup: {} + components/linkup: + dependencies: + linkup-sdk: + specifier: ^1.0.3 + version: 1.0.3 components/linqs_cc: {} @@ -7265,7 +7272,7 @@ importers: version: 12.6.1 openai: specifier: ^4.77.0 - version: 4.77.0(zod@3.23.8) + version: 4.77.0(zod@3.24.1) devDependencies: '@types/node': specifier: ^17.0.45 @@ -17757,6 +17764,9 @@ packages: axios@1.7.7: resolution: {integrity: sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==} + axios@1.7.9: + resolution: {integrity: sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==} + axobject-query@4.1.0: resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==} engines: {node: '>= 0.4'} @@ -21706,6 +21716,9 @@ packages: linkify-it@5.0.0: resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==} + linkup-sdk@1.0.3: + resolution: {integrity: sha512-ZgPLzo12AVoInAWyuB3+BIrVinCeeL9U5hjdqRiucFG9nZzvnWq3SLV/nEPEO3wRy4KywpRoSeLA/ETxF8EBiQ==} + lint-staged@12.5.0: resolution: {integrity: sha512-BKLUjWDsKquV/JuIcoQW4MSAI3ggwEImF1+sB4zaKvyVx1wBk3FsG7UK9bpnmBTN1pm7EH2BBcMwINJzCRv12g==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -26000,14 +26013,19 @@ packages: resolution: {integrity: sha512-40fpE2II+Cd3k8HWTWONfeKE2jL+P42iWJ1zzps5W51qcTsOUKM5Q5m2PFb0CLxlmFAaUuUdJGc3OfZy947v0w==} engines: {node: '>=0.2.0'} + zod-to-json-schema@3.24.1: + resolution: {integrity: sha512-3h08nf3Vw3Wl3PK+q3ow/lIil81IT2Oa7YpQyUUDsEWbXveMesdfK1xBd2RhCkynwZndAxixji/7SYJJowr62w==} + peerDependencies: + zod: ^3.24.1 + zod-validation-error@3.4.0: resolution: {integrity: sha512-ZOPR9SVY6Pb2qqO5XHt+MkkTRxGXb4EVtnjc9JpXUOtUB1T9Ru7mZOT361AN3MsetVe7R0a1KZshJDZdgp9miQ==} engines: {node: '>=18.0.0'} peerDependencies: zod: ^3.18.0 - zod@3.23.8: - resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} + zod@3.24.1: + resolution: {integrity: sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==} zwitch@1.0.5: resolution: {integrity: sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==} @@ -33546,6 +33564,14 @@ snapshots: transitivePeerDependencies: - debug + axios@1.7.9: + dependencies: + follow-redirects: 1.15.9(debug@3.2.7) + form-data: 4.0.1 + proxy-from-env: 1.1.0 + transitivePeerDependencies: + - debug + axobject-query@4.1.0: {} b4a@1.6.7: {} @@ -38573,6 +38599,14 @@ snapshots: dependencies: uc.micro: 2.1.0 + linkup-sdk@1.0.3: + dependencies: + axios: 1.7.9 + zod: 3.24.1 + zod-to-json-schema: 3.24.1(zod@3.24.1) + transitivePeerDependencies: + - debug + lint-staged@12.5.0(enquirer@2.4.1): dependencies: cli-truncate: 3.1.0 @@ -39966,7 +40000,7 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) scroll-into-view-if-needed: 3.1.0 - zod: 3.23.8 + zod: 3.24.1 nextra@3.3.1(@types/react@18.3.12)(acorn@8.14.0)(next@14.2.19(@babel/core@8.0.0-alpha.13)(@opentelemetry/api@1.9.0)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3): dependencies: @@ -40010,8 +40044,8 @@ snapshots: unist-util-remove: 4.0.0 unist-util-visit: 5.0.0 yaml: 2.6.1 - zod: 3.23.8 - zod-validation-error: 3.4.0(zod@3.23.8) + zod: 3.24.1 + zod-validation-error: 3.4.0(zod@3.24.1) transitivePeerDependencies: - '@types/react' - acorn @@ -40344,7 +40378,7 @@ snapshots: is-docker: 2.2.1 is-wsl: 2.2.0 - openai@4.77.0(zod@3.23.8): + openai@4.77.0(zod@3.24.1): dependencies: '@types/node': 18.19.68 '@types/node-fetch': 2.6.12 @@ -40354,7 +40388,7 @@ snapshots: formdata-node: 4.4.1 node-fetch: 2.7.0 optionalDependencies: - zod: 3.23.8 + zod: 3.24.1 transitivePeerDependencies: - encoding @@ -44372,11 +44406,15 @@ snapshots: zlib@1.0.5: {} - zod-validation-error@3.4.0(zod@3.23.8): + zod-to-json-schema@3.24.1(zod@3.24.1): + dependencies: + zod: 3.24.1 + + zod-validation-error@3.4.0(zod@3.24.1): dependencies: - zod: 3.23.8 + zod: 3.24.1 - zod@3.23.8: {} + zod@3.24.1: {} zwitch@1.0.5: {}