- Zapier Document Refresh action (create) added

This commit is contained in:
Josako
2024-12-17 16:40:21 +01:00
parent 53c625599a
commit f7cd58ed2a
9 changed files with 381 additions and 194 deletions

View File

@@ -138,7 +138,6 @@ module.exports = {
// Get the file URL from Zapier
const tempFileUrl = await z.stashFile(bundle.inputData.file);
// Log the temporary URL for debugging
z.console.log('Temporary URL created:', tempFileUrl);
// Create request data as an object
@@ -190,73 +189,5 @@ module.exports = {
throw error;
}
}
// perform: async (z, bundle) => {
// try {
// z.console.log("Starting New Log Trace for add_document")
// z.console.log("=======================================")
//
// // Prepare base metadata
// const baseMetadata = {
// service: bundle.inputData.metadata_service || 'Zapier',
// source: bundle.inputData.metadata_source,
// unique_id: bundle.inputData.metadata_unique_id,
// unique_url: bundle.inputData.metadata_unique_url,
// };
//
// // If there's additional metadata, merge it with the base metadata
// if (bundle.inputData.additional_metadata) {
// Object.assign(baseMetadata, bundle.inputData.additional_metadata);
// }
//
// const requestData = {
//
// catalog_id: bundle.inputData.catalog_id,
// language: bundle.inputData.language,
//
// // Add optional fields if they exist
// name: bundle.inputData.name || undefined,
// user_context: bundle.inputData.user_context || undefined,
// valid_from: bundle.inputData.valid_from || undefined,
// user_metadata: JSON.stringify(baseMetadata),
// catalog_properties: JSON.stringify(bundle.inputData.catalog_properties) || undefined,
// file: z.stashFile(bundle.inputData.file),
// }
//
// // Make request to your API
// const response = await z.request({
// url: 'https://evie.askeveai.com/api/api/v1/documents/add_document',
// method: 'POST',
// body: requestData,
// headers: {
// 'Authorization': `Bearer ${bundle.authData.access_token}`,
// 'Content-Type': 'multipart/form-data',
// },
// });
//
// // Log the response for debugging
// z.console.log('API Response:', {
// status: response.status,
// body: response.data
// });
// // Return the parsed response
// return response.json;
// } catch (error) {
// // Enhanced error logging
// z.console.error('Error details:', {
// message: error.message,
// response: error.response ? {
// status: error.response.status,
// headers: error.response.headers,
// data: error.response.data
// } : 'No response',
// request: error.request ? {
// method: error.request.method,
// url: error.request.url,
// headers: error.request.headers
// } : 'No request'
// });
// throw error;
// }
// }
}
};