Capturing an asynchronous APITemplate.io response via an inbound webhook and saving it to a GoHighLevel custom contact field

The client's problem

Current workflow

  • GoHighLevel Workflow
  • Custom Webhook
  • APITemplate.io generates a PDF
  • APITemplate returns a PDF URL

The problem

The PDF is generated successfully, but I cannot get the returned PDF URL written into a custom contact field inside GoHighLevel.
I need that URL saved so it can be inserted into emails.

Your task

  • Review my existing workflow.
  • Determine whether GoHighLevel can save the webhook response into a custom contact field without Make or Zapier.
    • If yes, implement the solution.
    • If no, explain exactly why and recommend the simplest architecture.

Deliverable

A working workflow that stores the returned PDF URL in my custom contact field, or a clear technical explanation of why GoHighLevel cannot do it.

My solution

1

A naive GoHighLevel workflow will sooner or later fail because APITemplate.io allocates 100 seconds to respond to an API request, meaning it might not respond quickly:

GoHighLevel will not keep a workflow's HTTP connection open for that long and will terminate it.
The result will match the result of your unsuccessful attempt (although your attempt might have been unsuccessful due to other reasons): the file will be created by APITemplate.io, but the GoHighLevel workflow will have already timed out, thereby failing to capture the file's URL.

2

The proper solution must be asynchronous: apitemplate.io/docs/integrations/rest-api#synchronous-vs-asynchronous

2.1

This requires 2 workflows in GoHighLevel: Workflow 1 executes an request to APITemplate.io, and the Workflow 2 handles the asynchronous APITemplate.io response via the «Inbound Webhook».

2.2

The «Inbound Webhook» is a premium workflow trigger, so it is necessary to enable «Workflow - Premium Features» at the Agency level.

2.3

The specification for the APITemplate.io API endpoints for PDF generation:

2.3.1

It is necessary to specify async=1 and webhook_url in requests to them.

2.4

By default, the «Inbound Webhook» requires an email address or a phone number in inbound requests:

Providing an Email or Phone number in the payload is mandatory, as the workflow requires contact information. An Email or Phone is required to Find or Create the Contact.

help.gohighlevel.com/support/solutions/articles/48001237383#Important-points-to-be-considered:

2.5

The requirement in §2.4 can be fulfilled by appending ?email={{contact.email}} to the value of the webhook_url parameter (§2.3.1).

2.6

If the requirement in §2.4 cannot be fulfilled due to the absence of both an email address and a phone number, there is a workaround: append ?contact_id={{contact.id}} to the value of the webhook_url parameter (§2.3.1) in Workflow 1 and then use the «Find Contact» workflow action in Workflow 2:

If necessary, you can use the Create/Update or Find Contact actions to retrieve the contact data to the workflow