Uploading file to Marketo, via Drupal site

Charles_Sander1
Level 4

Uploading file to Marketo, via Drupal site

I'm trying to see if there's a way to streamline one of our internal processes. At it's simplest, we have a Drupal 8 page, where we add a 'content type' item - for example a resource. What I'd like is that, when a user uploads a file using the Drupal file field, it  passes that file to the Marketo images/resources-x folder.

I imagine it's some mix of API, XML and Base64... but maybe somebody has gone down this road and can give me suggestions or a how-to... or knows an easier way I'm not aware of.

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Uploading file to Marketo, via Drupal site

Base64 is only necessary if you're writing binary (i.e. image) data to a field that expects to store text, like a Textarea field on the lead or a Text my.token.

If your destination is the Design Studio asset library then Drupal would be doing a multipart post (like a standard HTML form post) to the Files API endpoint as spec'd in the docs. (No XML, either!)

But I do question the design of having (as it sounds) two different content repos. Far better is to store the content in one place only, because you will not be keeping these repos in sync (deletion from one side, or direct creation in the Marketo UI, will not be propagated).

Charles_Sander1
Level 4

Re: Uploading file to Marketo, via Drupal site

Funny you should ask that - it's exactly the problem I'm investigating a solution for.

We have an inherited Drupal 7 site, with a weird process to add resources to the website listings (white papers, case studies, etc). The marketing team enters a new resource in Drupal - which includes a file upload field. This is used to pass the file name as a parameter in the URL of the resource request page which. Yeah... I don't know why it's done that way either.

In turn, the parameter populates a hidden field an embedded Marketo form, so that we can automate sending them the resource they requested.

... then, of course, they have to go upload the file in Marketo, so that the email doesn't give a broken link.

I'm hoping there's a way I can streamline so that, in Drupal when they add a resource listing, the file they upload actually gets passed to Marketo. This way, they don't have to log into two places.  Unless I'm overthinking it. We want the pdf files to be sitting in Marketo, not on the site (nor in both places - because, as you observed, that seems silly.

Your thoughts? Please tell me we're overthinking this somehow!

SanfordWhiteman
Level 10 - Community Moderator

Re: Uploading file to Marketo, via Drupal site

I'm hoping there's a way I can streamline so that, in Drupal when they add a resource listing, the file they upload actually gets passed to Marketo.

This certainly is possible. The file would have to live in Drupal temporarily (even if it were in a hidden PHP-level tempfile instead of in the Drupal Resources proper, it would always have to make a brief stop in the Drupal/PHP world).

Then it would get pushed to the Marketo Design Studio library and the temporary file deleted on success.