OpenAI Assistant for Hubspot Chat n8n Workflow Template

n8n workflow template · 26 nodes · Airtable

OpenAI Assistant for Hubspot Chat is a free n8n workflow template that starts when its webhook receives an HTTP request and works with Airtable and OpenAI. It has 26 nodes, 1 of them AI nodes (OpenAI). The notes inside the workflow say: “Watch for new message on the chatbot. This can be triggered with n8n chat widget, hubspot or other chat services.” To run it, you add your own credentials for Airtable API, HubSpot OAuth2, Hubspot App Token, Hubspot Developer API and OpenAI API.

At a glance

Trigger
Webhook (Webhook)
Nodes
26
Apps
Airtable and OpenAI
AI nodes
1
Credentials
5 types
Category
Spreadsheets, databases and docs

Apps and integrations

  • Airtable
  • OpenAI

Node types used

  • HTTP Request
  • Switch
  • Wait
  • Code
  • If
  • Airtable
  • OpenAI
  • Webhook

How it works

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Watch for new message on the chatbot. This can be triggered with n8n chat widget, hubspot or other chat services.

UPDATE USER FILTER FOR DUPLICATION

Search for Thread ID in a database.

This database is maintaing references between messaging service thread id and OpenI Thread ID.

POST a new message to existing thread.

Get Run Status: If still in progress, run again. If action needed go to respective action. If Completed, post message.

Post assistant Message back to chat service, in this case Hubspot

Setup notes

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Create a new Thread, save it to database and RUN

Run required actions based on Assistant answer and respond to Assistant with the function answer.

Each route is a function that you need to define inside your assistant configuration.

Nodes in this workflow

The 26 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. getHubspotMessage (HTTP Request)
  2. OpenAi Create Thread (HTTP Request)
  3. OpenAI Run (HTTP Request)
  4. Get Run (HTTP Request)
  5. Get Last Message (HTTP Request)
  6. HTTP Request (HTTP Request)
  7. Completed, Action or Inprogress (Switch)
  8. Wait (Wait)
  9. Wait1 (Wait)
  10. Submit Data (HTTP Request)
  11. Select Function (Switch)
  12. Code1 (Code)
  13. Wait2 (Wait)
  14. HTTP Request1 (HTTP Request)
  15. Code (Code)
  16. Submit Data1 (HTTP Request)
  17. Wait3 (Wait)
  18. respondHubspotMessage1 (HTTP Request)
  19. IF (If)
  20. Airtable (Airtable)
  21. IF1 (If)
  22. createThread (Airtable)
  23. OpenAI Run1 (HTTP Request)
  24. IF2 (If)
  25. OpenAI (OpenAI)
  26. Webhook (Webhook)

Credentials you need

  • Airtable API – used by Airtable and createThread
  • HubSpot OAuth2 – used by getHubspotMessage and respondHubspotMessage1
  • Hubspot App Token – used by getHubspotMessage and respondHubspotMessage1
  • Hubspot Developer API – used by getHubspotMessage and respondHubspotMessage1
  • OpenAI API – used by Get Last Message, Get Run, OpenAI and OpenAI Run and others

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us