Read Data from Websites
Quick Overview Video
Copying and pasting data is a waste of time, especially when the data is already available on the website where you’re using your snippets. This is common with tools like EMRs, CRMs, customer support ticketing systems, and other databases.
Selecting website contents text
When selecting website contents text, Text Blaze lets you mouse over a website's components to select the one you need to use in your snippet.
The text you select must be visible on the page where you use your snippet, and not hidden behind other website elements (such as requiring a click or a mouse-over to show that data).
Selections are placeholders
The website contents text option will always retrieve the text inside the area that you selected. When configuring this command in your snippet, think of your selection as a placeholder that will be dynamically filled in each time the snippet is used.
As an example, using the website contents text command and selecting the value of this dropdown from Zendesk will retrieve the value of that dropdown for any Zendesk ticket I use the snippet in.
The command is looking at that specific portion of the Zendesk ticket page, and adding whatever text is listed in that dropdown as the value. This is, basically, telling Text Blaze "look at this part of the website, and pull in whatever it says there".
Choosing the website content
Before adding the website command, it is helpful to already have another tab open on the page from which you’d like to retrieve the contents. For instance, if I plan to retrieve information from a LinkedIn profile page, start by opening another tab with anyone’s LinkedIn profile page in it.
Once that tab is open, follow these instructions:
- Step 1: click the website command, and then the website contents text option
- Step 2: click the blue "select from website" button
- Step 3: switch to the tab where the contents you’d like to retrieve is located. As you mouse over the different components of the website, you’ll see it highlighted in yellow. Once you’ve highlighted the portion you want to use, click your mouse.
- Step 4: click the blue "insert into snippet" button
Uses for website contents text
Merge website contents data into your snippet
This is the most-common use-case for this feature. Following the instructions in the previous section will result in the selected data being merged directly into the text of the snippet.
Below is an example of this working in a snippet that retrieves someone’s current company from their LinkedIn profile page. The same process can easily be applied to data inside your EMR, CRM, customer support tool, or other databases.
Hi {linkedin-firstname},
I see that you're currently {site: text; selector=:last-child > .artdeco-list__item div > .full-height > span > :nth-child(1)} at {site: text; selector=:nth-child(1) > .text-align-left .inline-show-more-text}. That's great experience for a new role I'm hiring for at Text Blaze, so I wanted to reach out and see if you're interested in discussing this opportunity with me further.
Power conditional rules or validation
Sometimes it won’t be necessary to add the actual text into your snippet. Instead, Text Blaze can retrieve that text and use it to power conditional rules. By adding the website contents command inside an if/else command, Text Blaze can detect data on a page and follow the rules that you define to determine what the snippet should do.
This snippet is meant to be used inside of Hubspot when leaving a note on a Contact record.
The snippet looks at the "Lifecycle Stage" field in my Hubspot instance and generates different text depending on which stage the contact is in.
This snippet is meant to be used inside of Zendesk when responding to a ticket.
The snippet looks at the field that shows the number of contacts in the last 30 days, and displays a warning to the support agent if that field says there have been more than 5 contacts.
{note}{if: {site: text; selector=.grid-ticket-fields-panel [data-garden-id="forms.input"]}>5}{error: Warning! This user has contacted us more than 5 times in the last 30 days. They may need special assistance, so be proactive in offering help!}{endif}{endnote} Hi {site: text; selector=.requester [data-garden-id="typography.ellipsis"]},
Thanks for getting in touch with product support. To further assist you, could you please provide the following information about your issue?
{formparagraph}
Additional tips for the website command
Different behavior based on website URL
Examples up to this point have been looking at the contents of websites. Another common use-case is to have a snippet perform different actions based on the URL where the snippet is used.
Like the previous examples, doing this uses the if/else command with the website command inside of it.
This time, we’ll instead use the website URL option for the website command. Depending on your use, you may want to use the website path or website domain option instead.
Handling errors or missing data
Sometimes a website contents text command will not find matching data, or the data won’t be what the snippet was expecting.
Rather than resulting in a complete error, the catch function can replace that error with a default text of your choosing.
Adding the catch function to your snippet will display the selected text if a match is found, or will display that default value if no match is found.
Shortening selected text by splitting it or using regex
Sometimes you may want only a portion of the text that is selected with this command. For instance, a website might store both the first and last name together, but you only need the first name.
Splitting the text into a list and selecting one item is one option. The example below pulls the name from the website, splits the text everywhere there's a space into a list of items and then pulls the first item in the list:
Using regex, specifically the extractregex function can also help to retrieve only the specific text that you need.
Here’s an example of shortening the selection of a full name to just a first name: