I am trying to upload an image to Eventbrite to serve as an event's logo. Zapier allows for custom code (python or javascript+node.js) but does not allow for external libraries to be used or imported.
In the Custom Code step I use javascript+node.js to make the api call. All works well except for the uploading of the image file. Whether I use the image url or a file from google drive, I get:
status_code 400 error_description The file did not upload properly or is not a valid image. error BAD_FILE
Here is the code being used along with the inputData:
image: 'https://coachieve.co/wp-content/uploads/2016/05/nyc-skyline.jpg',
};
let uploadToken = await fetch(
`https://www.eventbriteapi.com/v3/media/upload/?type=image-event-logo&token=abc123`
).then((res) => res.json());
// console.log('uploadToken', uploadToken);
const {upload_data} = uploadToken;
let imageUploadedRes = await fetch(uploadToken.upload_url, {
method: uploadToken.upload_method,
headers: {
'Content-Type': 'multipart/form-data', //'application/json',
},
body: JSON.stringify({
upload_data:{
AWSAccessKeyId: upload_data.AWSAccessKeyId,
bucket: upload_data.bucket,
acl: upload_data.acl,
key: upload_data.key,
signature: upload_data.signature,
policy: upload_data.policy,
[uploadToken.file_parameter_name]: inputData.image,
}
}),
});//.then((res) => res.json());
console.log('imageUploadedRes', imageUploadedRes);
let image = await fetch(`https://www.eventbriteapi.com/v3/media/upload/`, {
method: uploadToken.upload_method,
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer xyz789',
},
body: JSON.stringify({
upload_token: uploadToken.upload_token,
}),
}).then((res) => res.json());
console.log('image', image);```
IS there a way to get images from a link or perhaps stored in a google drive to upload to eventbrite via zapier?
Eventbrite uploads media in 3 steps (get an upload token, upload the image, retrieve the image