Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Creating and editing custom functions

Editable files allow you to modify code that can be used to leverage Koji functionalities. There is no access to source code of the software, but editable files help you modify some parts.

To view and modify editable files:

...

3. Modify its content in the window and click Save.

Note that by default Workflow Utility files provide you with the tips on how to create functions.

...

Sample

Creating a function

Here is a sample demonstrating a function that asks a user whether they are satisfied with the support and stores the reply in a keyword key.

Code Block
def ask_support_feedback(key=''):
    """ Ask user for his satisfaction with a support and store the response 
    into keyword key"""
    dialog = Bot.Bot().GetDialog()
    response = dialog.UserAsk("Tell us how you are satisfied with out JSM support?")
    if key:
        dialog.AddKeyword(key, response.text)
    return "Success"

You can copy this code and paste it into one of Workflow Utility files. Make sure to click Save and Apply.

...

Using the function in a workflow

1. Open your workflow in Content > Workflows and add the Call function node.

2. In the Function name field, specify the function. Our ask_support_feedback function is created in my1 file, so it is referred to as wf.my1.ask_support_feedback.

...

Testing a workflow

To test your workflow, go to chat and enter the #workflow <your-workflow-name> command.

...

Debug

To view the debug information, type the #debug on command in a chat. It turns on the debug mode, so you can view processing and messaging details right in the chat.

...