Skip to content

Latest commit

 

History

History
72 lines (43 loc) · 3.24 KB

ask-and-hubspot.md

File metadata and controls

72 lines (43 loc) · 3.24 KB

This simple chatbot gets user data through a dyna-form and then creates (or updates) a Contact on Hubspot.

To use this integration you need a Hubspot Access token. We'll learn how to create one.

The main block is askandsend.

This block uses a form to ask the follwing data, creating the corresponding chatbot attributes:

  • User first name. Attribute: firstname
  • User full name. Attribute: lastname
  • User email. Attribute: userEmail

form to ask data

Once the form is configured you can move to the next step, sending contact's data to Hubspot.

To achieve this goal first create a new Private App on Hubspot. In this way you will get a new Access token to connect to their APIs.

Hubspot Private app

When asked, select the "scope" of your app, taking care of selectiong "contacts" and assigning at least the Write permission (that we use for our chatbot).

Once created you can go to the App's details page where you can get your Access token. We'll use this later.

Configure your connection

Now back to our chatbot. Add a WebRequest Action from the side menu.

The WebRequest Action simply executes an HTTP call to the Hubspot "create a contact" REST API. See related https://developers.hubspot.com/docs/api/crm/contacts documentation.

Setup the HTTP url with the documented API endpoint using the POST HTTP method.

Hubspot contact's API endpoint:

https://api.hubapi.com/crm/v3/objects/contacts

Then setup all the HTTP headers fields as in the picture, taking care to set the Authorization header field with your own Access token.

Now move to the body section and set the dyna-form related attributes in the Hubspot JSON body, as shown in the picture:

Contact JSON body:

{
	"properties": {
		"email": "${userEmail}",
		"firstname": "${firstname}",
		"lastname": "${lastname}"
	}
}

Well, now press Test it out to see the chatbot in action:

As soon as the conversation ends The WebRequest action sends all the contact data to Hubspot Contacts. You we'll see your updated contact in the Hubspot's Contact center:

Hope you enjoy this simple chatbot 🤖

If you need any help please feel free to contact me at andrea at tiledesk.com 🤓