Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
mathieuf
Alteryx
Alteryx

The objective of this workflow is to track platform usage focusing on comments. As an administrator/ moderator of the platform, I need to control the politeness in the comments by forbidding a certain number of keywords.

 

Here is a overview of the workflow which will be detailed through the six steps (colored Comment tools):

 

MathieuF_0-1607957089715.png

 

Step 1 : Authentication to Connect

 

mathieuf_0-1622711236776.png

 

The step n°1 help us to authenticate to Connect using Connect APIs (more details on Connect APIs).

 

First, we need three pieces of information: Connect URL, username and password (in the Text Input tool):

 

login.png

 

The API access point for authentication is created using the Formula tool and is used with the user's credentials in the Download tool. The last tool, JSON Parse, is used to retrieve the cookie from the connection that will allow us to download the results in step 3.

 

Step 2: Keywords to search

 

mathieuf_0-1634645428950.png

 

In this step, we list the keywords to be monitored; i.e. the prohibited words for which an alert is set up.

 

MathieuF_1-1607959019530.png

 

Then a unique identifier is assigned to these words using the Record ID tool.

 

Step 3: Downloading the data associated with the keywords

 

mathieuf_1-1634645467595.png

 

The "Cookie & Query" formula allows to perform two operations. The first one is the renaming of the cookie, and the second creates the search query for each keyword:

 

[host] + "/x/search?query=commentbody:" + [keywords] + "*"

 

Note: "commentbody" allows to search in the content of the comments.

 

The request is sent via the API and the Download tool then the results are returned. Below is a sample:

 

MathieuF_0-1607959689233.png

 

Step 4: Cleaning and renaming

 

mathieuf_2-1634645504560.png

 

We obtained a lot of data (14 fields and 91 rows) from the five-keyword search. First, we will keep only the useful fields:

 

  • the Connect URL (for step 6)
  • the keyword identifier
  • the keyword
  • the cookie (for step 6)
  • the property name (URL, Name, Comment, ...)
  • the value of the property

 

Then, we keep only the interesting properties. In this example, only three properties are kept:

  • the URL of the comment
  • the comment
  • the object on which the comment was left

 

Contains([JSON_Name2],"excerpt")
OR
Contains([JSON_Name2],"absoluteUrl")
OR
Contains([JSON_Name2],".name")
AND NOT Contains([JSON_Name2],"With")

 

Finally, we rename the properties for clarity:

 

IF Contains([JSON_Name2],"excerpt")
THEN 'Comment'
ELSE IF Contains([JSON_Name2],"name")
THEN 'Object'
ELSE IF Contains([JSON_Name2],"url")
THEN 'URL'
ELSE ''
ENDIF ENDIF ENDIF

 

Step 5: Comment's Author

 

mathieuf_3-1634645607926.png

 

Warning: this step could not be tested; some adjustments may be necessary.

 

In order to have information about the authors, we keep the name of the objects and then we send a request with these objects to Connect. In return, we get the following information:

 

mathieuf_0-1622231696829.png

 

The "Comment Author" block allows us to keep the commentAuthorName property and do some cleanup in our data 😊.

 

mathieuf_1-1622231818294.png

 

Step 6: Formatting

 

mathieuf_4-1634645652476.png

 

This last step combines the information from step 4 and step 5 to obtain the following complete table:

 

mathieuf_2-1622231850527.png

 

Conclusion

Combining the richness of Connect with the flexibility and strength of Designer offers many possibilities and perspectives for data exploitation, especially through APIs.

 

 

Banner image by geralt-9031