Custom Coded Workflow Action: Parsing a PDF

Hey team,

Wondering if someone can help me with building out a custom coded workflow action to support parsing a PDF when uploaded and extracting information to other properties, without the need to use a third party application.

When I try to use const pdf = require(‘pdf-parse’);, it doesn’t seem to implement properly so I’m wondering if this isn’t something that’s possible with this action, but wondering if anyone has experienced anything differently?

Hi @McBainKD
Thank you for reaching out to the Community!
I’d like to invite some community members who are subject matter experts to join this conversation.
@karstenkoehler @OBetzalel @Alex_Elborn - Would you be able to share any insights on this? Your expertise would be greatly appreciated.
Best,
Victor

Hi @McBainKD ,

After doing some research I found that you’re correct, that pdf-parse won’t work in custom code actions. HubSpot only supports a specific set of libraries in their serverless environment, and pdf-parse isn’t included.

Your best option is to create an external service that handles the PDF parsing, then call it from your workflow action using the actionUrl or a PRE_ACTION_EXECUTION function. Your external service can use any PDF parsing library you need.

Alternatively, since aws-sdk and googleapis are supported, you could use AWS Textract or Google Document AI for the parsing.

Check out the Custom Workflow Actions documentation for implementation details.

Hope this helps!