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):
Step 1 : Authentication to Connect
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):
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
In this step, we list the keywords to be monitored; i.e. the prohibited words for which an alert is set up.
Then a unique identifier is assigned to these words using the Record ID tool.
Step 3: Downloading the data associated with the keywords
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:
Step 4: Cleaning and renaming
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
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:
The "Comment Author" block allows us to keep the commentAuthorName property and do some cleanup in our data 😊.
Step 6: Formatting
This last step combines the information from step 4 and step 5 to obtain the following complete table:
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
Get comments from Connect.yxmd