The Function API allows you to run code snippets in various programming languages directly through API calls. This capability can extend Pipedream workflows by enabling custom logic processing, data transformation, or any operation that requires server-side code execution without deploying or managing servers. By using the Function API, you can incorporate code that's beyond the native actions available within Pipedream, offering a flexible and powerful way to handle complex tasks in your automations.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
function: {
type: "app",
app: "function",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://api.fxn.ai/user`,
headers: {
Authorization: `Bearer ${this.function.$auth.api_key}`,
},
})
},
})
Data Transformation and Aggregation: Integrate Function API within a Pipedream workflow to process incoming data from a webhook. Transform the data structure, filter out unnecessary elements, or aggregate information before sending it to a database like PostgreSQL.
Custom Authentication Logic: When handling webhooks that require custom authentication, use the Function API to implement the necessary logic. Verify signatures or decrypt data to ensure secure communication between your Pipedream workflow and other services.
Image or Document Processing: In a workflow where you need to manipulate media, the Function API can perform tasks such as image resizing, format conversion, or PDF generation. Once processed, the results can be uploaded to a cloud storage service like Amazon S3.
Function uses API keys for authentication. When you connect your Function account, Pipedream securely stores the keys so you can easily authenticate to Function APIs in both code and no-code steps.