How to
How to create HubSpot tickets from QR codes
QR codes provide a quick and easy way for your customers to request support. By gathering requests via this method, you can easily gather the information needed to triage requests, create a new ticket, and let the customer know that someone is responding to their request, in a matter of minutes.
Requirements
This example uses a HubSpot private app to process incoming webhooks. You will need a HubSpot user with "Super Admin" permissions to create this.
Creating a HubSpot private app
HubSpot private apps are a powerful tool to quickly connect with external services, like Pendula, that support webhooks. Creating a private app takes about 15 minutes, and can be done by any user with the "Super Admin" role.
Step 1 - Name your private app
- Log in as a Super Admin and navigate to Settings > Integrations > Private Apps.
- Click Create a private app.
- In the Basic Info tab, enter a Name, and, optionally, a Logo and Description that will help you to identify the app within your HubSpot environment.
Step 2 - Select the data you want to use with Pendula
Select the Scopes tab and select the HubSpot data you want to use in your Pendula flows.
Use the search field to find the data you want to use, then select the correct permissions - either Read or Write, for the selected data.
For this example, our private app uses the following scopes:
- crm.objects.contacts.read
- crm.objects.contacts.sensitive.read
- crm.objects.contacts.sensitive.write
- tickets
- tickets.sensitive
Activating your private app
To active your private app, click Create app.
This generates a modal that reminds you to securely store the token that will be displayed on the next screen.
Click Continue creating.
Copy the token and securely save it so you can access it later. This is the token you will use to authenticate your webhooks from Pendula.
Once you have saved the token, click Close. Your private app is now ready to be used with Pendula.
NOTE: You only need to create one private app to connect to Pendula. Once it is set up, the private app can be used for any flows where you want to read or write data from HubSpot. You can update the Scopes at any time to add or remove permissions as required.
Saving your HubSpot token in Pendula
HubSpot private apps use a bearer token for authentication. You can securely store this in Pendula and use it in any of your HubSpot flows.
To store the token in Pendula:
- Navigate to Integrations.
- Under the Setup connection heading, select Web request credentials.
- Select Save a bearer token.
- Enter a Name and Description that will make it easy to identify the credentials.
- Copy and paste the HubSpot token into the Token field.
- Click Save connection.
The HubSpot credentials for your private app are now available to be used in any Pendula flow.
Creating your Pendula flow
This flow uses Pendula's ability to read and write via webhooks to
- capture the customer request via QR code or text input
- request an identifier for the contact - in this case, the customers email address
- verify that the contact exists
- retrieve the first name from the contact record
- request more information from the customer, using their first name
- create a ticket in HubSpot linked to their contact record
- let the customer know that a ticket has been created and that someone will be in contact soon.
This flow uses the Inbound message trigger to start the flow.
Enter the keywords from your QR code into the Value field, and set the Rule to is exactly to match messages that exactly match those keywords.
The Conversation node is used to acknowledge the request, and identify the customer.
Use a free reply path to capture the email address.
Now that the customer has responded with their email address, we can check that against our HubSpot record to verify that the Contact exists, and return any information we need from the Contact record to continue the conversation.
Add the Make a web request node to the flow and select Bearer from the Authentication field, and the HubSpot credentials you saved earlier.
You can now use the messageBody
merge field to include the email address that the customer supplied in the GET request to HubSpot.
Copy and paste this URL into the API endpoint URL field:
https://api.hubapi.com/crm/v3/objects/contacts/messageBody?idProperty=email
Replace the messageBody
part of the URL with the messageBody field from the merge field explorer values for your flow.
This request will validate that a contact record exists that matches the email record, and return any details about that contact - for example, their first name - that we want to use in the rest of the conversation.
Paste the following sample payload in the Merge fields > Payload tab of the Conversation node so you can reference this information in following nodes.
{
"id": "51",
"properties": {
"createdate": "2023-12-18T01:08:50.238Z",
"email": "bh@hubspot.com",
"firstname": "Brian",
"hs_object_id": "51",
"lastmodifieddate": "2023-12-18T01:08:54.780Z",
"lastname": "Halligan (Sample Contact)"
},
"createdAt": "2023-12-18T01:08:50.238Z",
"updatedAt": "2023-12-18T01:08:54.780Z",
"archived": false
}
Next, we'll use another Conversation node to ask the customer about the nature of their inquiry.
From the merge field explorer, select the merge field(s) you want to use in the conversation.
Use a free reply path to capture the customers response.
Now that we have the information needed to create a ticket, we can create the HubSpot ticket.
Add the Make a web request node to the flow and select Bearer from the Authentication field, and the HubSpot credentials you saved earlier.
Select POST as the Request type. Copy and paste this URL into the API endpoint URL field:
https://api.hubapi.com/crm/v3/objects/tickets
In the Request body section, select the Convert to code option from the more menu.
Copy and paste the following code into the JSON field:
{
"properties": {
"hs_pipeline": "0",
"hs_pipeline_stage": "1",
"hs_ticket_priority": "HIGH",
"subject": "{{ conversation_2.messageBody }}"
},
"associations": [
{
"to": {
"id": "{{ webRequest_1.id }}"
},
"types": [
{
"associationCategory": "HUBSPOT_DEFINED",
"associationTypeId": 16
} ]
}
]
}
Replace the {{ conversation_2.messageBody }}
and {{ webRequest_1.id }}
with the merge field explorer values for your flow.
Paste the following sample payload in the Merge fields > Payload tab so you can reference the ticket information in SMS reply.
{
"id": "2807216478",
"properties": {
"createdate": "2024-06-07T04:23:59.750Z",
"hs_helpdesk_sort_timestamp": "2024-06-07T04:23:59.750Z",
"hs_last_message_from_visitor": "false",
"hs_lastmodifieddate": "2024-06-07T04:23:59.750Z",
"hs_object_id": "2807216478",
"hs_object_source": "INTEGRATION",
"hs_object_source_id": "3405549",
"hs_object_source_label": "INTEGRATION",
"hs_pipeline": "0",
"hs_pipeline_stage": "1",
"hs_ticket_id": "2807216478",
"hs_ticket_priority": "HIGH",
"subject": "sample ticket"
},
"createdAt": "2024-06-07T04:23:59.750Z",
"updatedAt": "2024-06-07T04:23:59.750Z",
"archived": false
}
Now that the ticket is created and linked to the contact, we'll use the Outbound SMS node to let the customer know.
Copy the detail(s) of the ticket that you want to use in your reply from the merge field explorer.
Your flow is now ready to activate and to start receiving customer inquiries!