Create a suggestion box
In this example, you will use the PurgoMalum API to remove profanity and other objectionable content from feature requests and feedback, notify your customer support team of any potentially irate customers, and store approved suggestions in a SharePoint list. |
This is a simple example that uses no authentication Identifying the requestor of the API using techniques such as a username and password, an API key, or OAuth2.0., passes parameters A piece of information passed to a third-party API during a request. in the query Part of the URL that does not fit into the path structure, and provides additional information or parameters for the request. The query is prefaced by a question mark (?) in the URL, for example: http://example.com?color=blue., and accepts a simple JSON JavaScript Object Notation: a data format based on JavaScript that is commonly used for API request parameters and responses. object as a response The return from a third-party API after a request has been made by the client.. The n-ntx-summary specification extension A Nintex-specific OpenAPI Specification key that allows special functionality within Nintex Xtensions. and watermarking have been used to provide additional guidance to the workflow designer.
The complete OpenAPI Specification A Nintex-specific OpenAPI Specification key that allows special functionality within Nintex Xtensions. and icon for this example are available here.
The PurgoMalum API
The PurgoMalum API is a free service that checks a given section of text against a list of profane or objectionable words, and replaces any it finds with a fill-word or fill-character to sanitize it. You can specify additional words to censor, and what fill-word or fill-characters to use. The API also provides a simple check on whether profane content is present, which returns a boolean result.
More information can be found at PurgoMalum.com
Create the Open API Specification
Build an OpenAPI Specification that:
- Uses HTTP to access the host The domain name of the third-party API's URL.www.purgomalum.com with the base path of /service and no authentication.
- Uses a get method on the path The part of the URL after the hostname that directs the request to a specific resources within the host. For example, the section after "example.com" in http://example.com/this/is/a/path./json with
three parameters in the query:
- Text, which is the text to be sanitized.
- Add, which is any additional words to sanitize from the text.
- Fill_text, which is the word used to replace the censored text.
- Responds 200 with the sanitized text in a string named result.
Add a second operation to check for profanity that:
- Uses a get method on the path /checkProfanity with two parameters in the query:
- Text, which is the text to be sanitized.
- Add, which is any additional words to sanitize from the text.
- Responds 200 with a boolean value:
- True if the text contained profanity.
- False if it did not.
- Produces text/plain rather than application/json.
For more information on adding multiple operations, see Define the operations.
{
"swagger": "2.0",
"info": {
"version": "1.0",
"title": "PurgoMalum",
"description": "The example sanitises text"
},
"host": "www.purgomalum.com",
"basePath": "/service",
"schemes": [ "https" ],
"consumes": [ "application/json" ],
"produces": [ "application/json" ],
"paths": {
"/json": {
"get": {
"summary": "Sanitize a comment",
"description": "Remove obscenity from text",
"operationId": "SanitizeJSON",
"produces": [ "application/json" ],
"parameters": [
{
"name": "text",
"description": "The text to be sanitised",
"in": "query",
"type": "string",
"x-ntx-summary": "Text to sanitize"
},
{
"name": "add",
"description": "Up to 10 words, or 200 characters",
"in": "query",
"type": "string",
"x-ntx-summary": "Additional blacklisted words"
},
{
"name": "fill_text",
"description": "(Max 20 characters)",
"in": "query",
"type": "string",
"x-ntx-summary": "Replacement text"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"properties": {
"result": {
"type": "string"
}
}
}
}
}
}
},
"/containsprofanity": {
"get": {
"summary": "Check a comment for profanity",
"description": "Check for profanity in text",
"operationId": "CheckProfanity",
"produces": [ "text/plain" ],
"parameters": [
{
"name": "text",
"description": "The text to be checked",
"in": "query",
"type": "string",
"x-ntx-summary": "Text to check"
},
{
"name": "add",
"description": "Up to 10 words, or 200 characters",
"in": "query",
"type": "string",
"x-ntx-summary": "Additional blacklisted words"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "boolean"
}
}
}
}
}
}
}
Build the workflow
Build a workflow that:
- Takes customer suggestions by a public web form and checks them for profanity.
- Notifies customer support of any potentially irate customers for personal follow-up.
- Sends an email to thank customers who sent non-profane suggestions for their suggestion.
- Sanitizes profane suggestions, and then sends them to a community manager for approval.
- Stores approved suggestions in a SharePoint list for future development.
Step 1: Add your Xtension
Import the OpenAPI Specification you created into Nintex Automation Cloud:
- Open your Nintex Automation Cloud tenancy.
- Click Xtensions in the dashboard to open the Xtensions page.
- Click in the Private connector list.
- Click Choose a file. Navigate to the OpenAPI Specification on your computer.
- Wait for Nintex Automation Cloud to validate the file.
- Click Next.
- The Xtension does not use authorization, so click Next.
- Edit the Name of the Xtension, which becomes the name of the action group in the Workflow designer.
- Edit the Description of the Xtension. This appears in the Private connector list in the Xtensions page.
- Select or upload an icon for the Xtension. This is displayed for each action or event in the Workflow designer.
- Click Publish.
Step 2: Create the workflow
For more information on creating workflows, see the Workflow Designer.
- Click Create workflow in your Nintex Automation Cloud tenancy.
- Configure the Start event to be a Nintex form with two text variables:
- The customer's email.
- The customer's suggestion.
- Drag a Check a comment for profanity action after the Start event.
- Configure the action to:
- Check the suggestion variable.
- Store the result in a new boolean variable.
- Drag a Branch by condition action after the Check a comment for profanity
action.
For more information, see Branch by condition. - Configure the Branch by condition action to test if the boolean variable equals Yes.
- Drag a Sanitize a comment action into the Yes branch.
- Configure the Text to sanitize to be the suggestion variable.
- Create a variable to store the result.
- Drag a Send an email action after the Sanitize a comment action.
For more information, see Send an email. - Configure the email to notify the customer support staff that a customer may need attention, and add the sanitized suggestion.
- Drag another Send an email action into the No branch.
- Configure the Send an email action to send an email to the customer thanking them for their suggestion.
- Drag an Assign a task action after the Branch by condition has merged.
For more information, see Assign a task. - Configure the Assign a task action to email the sanitized suggestion in the result variable to a community manager, who will vet their inclusion in the suggestion box.
- Drag a SharePoint Online Create an item action on the Accept branch.
For more information, see SharePoint Online - Create an item. - Configure the Create an item action to store the accepted suggestion in a SharePoint list for suggestions.
- Click Test to test the workflow.
- Save or publish the workflow.
For more information on designing forms in Nintex Automation Cloud, see Design a form.
Tip: If you want to troubleshoot an Xtension, select Development as the Assigned Use when you publish the workflow. Development workflows display more detailed error messages in their instance details. Republish your workflow as Production when you're ready to use it.