Hello everyone,
I made a n8n workflow trying to circumvent some limitations in a wordpress plugin I use called Funnelkit Automations. Funnelkit has a node based interface to build marketing automations, similar to n8n but much simpler. Funnelkit has a Webhook trigger too, but its simple interface is unable to answer to that HTTP request with anything other than a plain success response. However it can trigger an HTTP request itself to another server after receiving the webhook.
For example, if I make a HTTP POST request to the funnelkit webhook to request the contact information of a lead email, it returns 200, it does not return the contact info on that response, but after that it makes the request to my n8n workflow.
My n8n workflow is basically ‘wrapping’ these webhooks and http calls between funnelkit so that I can make a single HTTP POST request to the n8n workflow with the email address as the body parameter and after some seconds it responds to it with the received info from funnelkit.
the workflow initial trigger is an n8n POST webhook, n8n creates a requestId uuid and uses that to insert a document in a MongoDB database, calls the funnelkit webhook with an additional parameter $execution.resumeUrl
of an n8n wait node, a requestId parameter and the url of the second webhook trigger of that same n8n workflow (receive contact info1)
funnelkit receives the n8n http request in its own webhook, answers 200 to than and then makes a post http request to the second n8n webhook (receive contact info1) with the contact information.
the second webhook is received in n8n, i store the received information in the mongodb with the corresponding requestId, then I make an http request to the resumeUrl
of the n8n wait node to continue with the first execution (from the original webhook trigger), then I retrieve the updated mongodb record with the information that should be there by now, and finally use a respond to webhook node to respond to the initial request. This two executions and storing the state in MongoDB helps me to share the state between the executions.
The first problem I encountered was a Cannot read properties of undefined (reading 'name')
error but that resolved after updating to the latest n8n version.
Now on the latest version the two executions show up as successful and seeing the output of the execution in the n8n execution browser looks like both executions were correct, but what I find is that n8n never actually responds to the initial webhook with the data retrieved, it just hangs and eventually timeouts. Is the wait node affecting somehow the ability of the ‘respond to webhook’ node to work correctly? It looks like a bug to me.
The first execution (the nodes in the lower part) takes about 30-50s
The second execution (the 4 nodes in the upper part) takes about 1s.
I’ve placed the nodes of the second execution in a line above the first (main) execution in the sequence that they are executed so that it’s a bit easier to understand.
Thank you,
Output of the ‘respond to webhook’ node (first execution).
[
{
"_id": "667098d160a7cb204fe3a3b6",
"requestId": "011cb5e3-75c7-416d-8102-c82b3e1025b6",
"status": "pending",
"contactEmail": "[email protected]",
"callbackUrl": "https://n8n.example.com/webhook/1e030dcd-3391-4aed-a17d-27ccc687b1e5",
"resumeUrl": "https://n8n.example.com/webhook-waiting/78996",
"getContactUrl": "https://www.funnelkit-example.com/wp-json/autonami/v1/webhook/?bwfan_autonami_webhook_id=22&bwfan_autonami_webhook_key=f78fdf0f69d86edd1d6abe213fc3e49a",
"payload": {
"contact_first_name": "John",
"contact_last_name": "Doe",
"contact_creation_date": "2024-06-17T01:54:57-06:00",
"contact_user_role": "",
"contact_phone": "omitted",
"contact_city": "",
"contact_country": "MX",
"contact_postcode": "",
"contact_state": "",
"contact_username": "",
"contact_user_id": "",
"contact_address": "Mexico",
"contact_dob": "",
"contact_company": "",
"contact_gender": "",
"contact_status": "Subscribed",
"contact_timezone": "",
"contact_language": "",
"contact_order_count": "0",
"contact_purchased_product_category": "",
"contact_products_purchased": "",
"contact_total_spent": "0",
"contact_email": "[email protected]",
"request_id": "011cb5e3-75c7-416d-8102-c82b3e1025b6",
"resume_url": "https://n8n.example.com/webhook-waiting/78996"
},
"createdAt": "2024-06-17T20:13:04.185Z",
"updatedAt": "2024-06-17T20:13:33.951Z"
}
]
Output of the last node of the first execution (mongodb3):
[
{
"status": "completed",
"updatedAt": "2024-06-17T20:13:35.527Z",
"requestId": "011cb5e3-75c7-416d-8102-c82b3e1025b6"
}
]
Output of the last node of the second execution (http request1)
[
{
"message": "Workflow was started"
}
]
Information on your n8n setup
- n8n Version 1.45.1
- SQLite
- EXECUTIONS_PROCESS default
- Docker via portainer
- Ubuntu 22.04.1 LTS