You can use webhooks in HubSpot to send data back to your WordPress site using WP Fusion. Using these webhooks, you can create new users on your WordPress site, or update existing users’ meta data and lists.
Webhooks are available in the following HubSpot editions:
- Marketing Hub Professional
- Marketing Hub Enterprise
- Sales Hub Enterprise
Webhooks are managed in HubSpot by going to Automation >> Workflows from the top navigation menu.
For this tutorial, we’ll be showing you how to create a new WordPress user when a contact is added to a specific HubSpot list. See below for additional options when configuring the workflow action.
First create a new workflow, and then add an enrollment trigger. Here we’ve set workflow to run whenever someone is added to the static list “Membership Trial.”
Click the + symbol to add a new action to the workflow, and from the Actions panel, select Update WordPress.
A panel will appear where you can configure the webhook to your WordPress site.
In this example, we’ve set the action to Add user, and disabled the welcome email that is sent to new users.
Now, every time a contact is added to this list, a new WordPress user will be created based on their contact data in HubSpot. If the user already exists on the site, they will be updated (no duplicate users will be created).
The available options in the workflow action are:
URL to your WordPress site: This is the URL to the site where you have WP Fusion installed.
Your access key: This is the access key from the bottom of the General tab in the WP Fusion settings. This helps to secure your webhook URL.
Action: There are three options:
- Update user’s lists: If a user already exists on your site for this contact, their lists will be loaded from their HubSpot contact record.
- Update user’s metadata lists: If a user already exists on your site for this contact, their lists and custom field values will be loaded from their HubSpot contact record.
- Add user: This will import the contact as a new WordPress user. If a user already exists with that contact ID, their lists and custom field values will be loaded from HubSpot.
Send a welcome email to new users: If your webhook action is set to Add, you can choose whether or not to send a welcome email to new users. If you select Yes, the default WordPress welcome email will be sent to any newly imported users, containing a link to reset their password.
user_passon your website, the new users will be given the usernames and passwords stored in their HubSpot contact record.
#Example – syncing changed email addresses
As an example, to sync changes in a contact’s email address (or any other custom field) back to WordPress automatically, choose Contact properties for the trigger filter type, and then choose Email and is known.
Then click on the Re-enrollment tab, and select Email is known as a re-enrollment trigger.
Now, any time a contact’s email address is updated, the workflow will be triggered and the new address will be synced back to WordPress automatically.
For more information on re-enrollment triggers and the is known condition, see the HubSpot documentation.
New user accounts will be created with an automatically generated password. If you’d like to use this password in your email marketing, you can send the password back to HubSpot after it has been generated.
In the Webhooks section of the General settings tab, check the box for Return Password, and select a field in HubSpot where the password should be stored.
After a new user is created, their automatically generated password will now be saved back to their contact record, and you can use a merge field to include it in an email. The username will be the contact’s email address.