this code work after some minor adjustment. I now want to upload to Signnow using Google Doc URL. But when i try to run it, it saying error during upload with code error 21004000. How to make this work
Here the Google Doc URL: https://drive.google.com/file/d/asdjkxzckzxlkjasoidjasjd/view?usp=drivesdk
Here my code:
import axios from “axios”;
export default defineComponent({
name: “Upload Document to SignNow”,
version: “0.0.1”,
type: “action”,
key: “upload_document_signnow”,
description: “Uploads a document to SignNow from a URL and assigns a signer without sending.”,
props: {
signnow: {
type: “app”,
app: “signnow”,
},
fileUrl: {
type: “string”,
label: “File URL”,
description: “Enter the URL of the document to upload.”,
},
signerEmail: {
type: “string”,
label: “Signer Email”,
description: “Enter the email address of the signer.”,
},
signerRole: {
type: “string”,
label: “Signer Role”,
description: “Enter the role of the signer (e.g., ‘Customer’, ‘Recipient 1’).”,
default: “Customer”, // Default role, update as needed
},
checkFields: {
type: “boolean”,
label: “Check Fields”,
description: “Set to true
to check fields in the document.”,
default: true,
},
},
async run({ steps, $ }) {
// Get OAuth token from Pipedream account store
const authToken = this.signnow.$auth.oauth_access_token;
const headers = {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
Accept: "application/json",
};
const payload = {
url: this.fileUrl,
check_fields: this.checkFields,
signers: [
{
email: this.signerEmail, // Assign the email
role: this.signerRole, // Assign the role (e.g., 'Customer' or 'Recipient 1')
order: 1, // Ensures signing order
},
],
};
try {
const response = await [axios.post](http://axios.post)(
"https://api.signnow.com/v2/documents/url",
payload,
{ headers }
);
return response.data;
} catch (error) {
return { error: error.response?.data || error.message };
}
},
});