Question:
I’m trying to use Google Drive API to upload a “file upload field” data from a wix from to a google drive.
import wixData from 'wix-data';
import wixFetch from 'wix-fetch';
import wixSecretsManager from 'wix-secrets-manager';
$w("#wixForms1").onWixFormSubmit(() => {
const uploadedFile = $w("#fileUpload").value[0];
uploadFileToGoogleDrive(uploadedFile);
});
async function uploadFileToGoogleDrive(file) {
// ... (Secrets fetching remains the same)
// Get file URL from Form submission
const fileUrl = file.url;
// Get file data
const fileData = await wixFetch(fileUrl).then(response => response.arrayBuffer());
// Send webhook to Integromat (replace with your actual Integromat webhook URL)
const integromatWebhookUrl = 'https://hohttps//hook.eu1.make.com/bf8rm1x0h6kke25v1u1yznsndlkz1g5nok.integromat.com/xxxx';
const response = await wixFetch(integromatWebhookUrl, {
method: 'POST',
body: JSON.stringify({
fileData: fileData
})
});
// ...
}
This is a code I’m currently trying to use, but I get these errors:
- import wixSecretsManager from ‘wix-secrets-manager’; - wixSecretsManager’ is declared but its value is never read.
Cannot find module ‘wix-secrets-manager’ or its corresponding type declarations.
- const fileData = await wixFetch(fileUrl).then(response => response.arrayBuffer()); - This expression is not callable. Type ‘typeof import(“wix-fetch”)’ has no call signatures.
are there any ways to fix it?