Hi @yelmox,
Based on your request, it seems you’re looking to automate the extraction of data from a PDF file in Google Drive, process it using the TextCortex API, and then generate an invoice in JSON format. You can achieve this by creating a Pipedream workflow that uses the TextCortex API to send your prompt and process the data.
Here’s a high-level overview of the steps you would need to take:
- Trigger your workflow with the appropriate event (e.g., a new file in Google Drive).
- Use a Pipedream built-in Google Drive action to get the content of the PDF file.
- Send the extracted text to the TextCortex API using an HTTP request.
- Process the response from TextCortex to format it as an invoice in JSON.
- Perform any additional actions as needed (e.g., sending the JSON to another service or storing it).
Unfortunately, I cannot provide you with live data or access to your Google Drive or TextCortex account to perform these actions. However, I can guide you on how to set up the API call to TextCortex within a Pipedream workflow.
Here’s an example Pipedream component code snippet that makes a POST request to the TextCortex API:
import { axios } from "@pipedream/platform";
export default defineComponent({
props: {
textcortex: {
type: "app",
app: "textcortex",
},
},
async run({ steps, $ }) {
const prompt = "Extract items under Name, Price, QTY, Subtotal, in json format, add a summary field that summarizes the text under Name, Make the json an invoice, adding total and subtotal, Make sure to add all items.";
const data = {
prompt: prompt,
// Include any other necessary parameters according to the TextCortex API documentation
};
return await axios($, {
method: "post",
url: `https://api.textcortex.com/hemingwai/generate_text_v2`,
headers: {
Authorization: `Bearer ${this.textcortex.$auth.api_key}`,
"Content-Type": "application/json",
},
data,
});
},
});
Please note that you’ll need to replace the url
with the correct endpoint from TextCortex API and include any other necessary parameters according to their API documentation.
To integrate with Google
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! Learn how to build your own.