Send any PDF (not a template-generated PDF) via Webhook

I’m using webhooks to integrate with SharePoint Online / Onedrive for Business as, unfortunately, company policy prevents us from directly using our SharePoint/Onedrive account as a data source/store. Our main Appsheet file storage for templates/temporary storage remains on Google Drive.

At the moment, I can successfully create and send template-generated PDFs to our SharePoint site by making calls to the appropriate REST API endpoint i.e.

https://tenantname.sharepoint.com/sites/sitename/_api/web/GetFolderByServerRelativeUrl(’/sites/siten...]

The content type is PDF and the only additional header is: Authorization: ("Bearer " & [accesstoken]). Everything works as needed. However, I cannot find a way to send a pre-existing PDF from our Google Drive.

Is there a way to send any PDF file stored in our Google Drive via a webhook? I have a column called [UploadedFile], which is a File type column containing the path of the PDF I’d like to send. I tried setting the Body of the webhook to <<[UploadedFile]>> but unsurprisingly I just got a PDF with a text representation of the file link. Is there any way to send the Base64-encoded version of the file itself? The closest I could find on the forums was this post

Out of curiosity, I also tried setting the Body Template to either [UploadedFile] or =[UploadedFile], but in both cases the Process returns an error.

Can anybody suggest possible solutions?

Thanks!
Michael

0 2 395
2 REPLIES 2

Check out the " External URL for Image Files" section of:

Appsheet itself has no way to generate Base64 encodings. Google Apps Script does though. You can have it generate the string and save it in another column, then use that column’s value in your webhook.

Thanks Marc.

I had a look at the External URL option. Unfortunately, we need to send the actual file, not just getting a publicly accessible link.

After digging a bit more on what the SharePoint REST API is expecting, it seems it wants the request body to be a binary stream. Do you know if there is any way to send a binary stream (rather than Base64 representation) with Appsheet webhooks?

It’s a bit strange that we can successfully send PDFs using Google Doc templates, but not any other way. It would be good to know what Appsheet is doing in the background when it sends the template-generated PDF, since that works fine.

Top Labels in this Space