Python integration - Insert a record

Within the Swimlane application, it is possible to use Python as an integration, but it does not act as a stand-alone python application, but there are several objects which are included and seemingly not well documented, like sw_outputs, sw_inputs. I am trying to automate the insert of a row of data from within this integration based upon an event. Are there inherit objects to use such as these to assist, or is there some critical step i am missing for making this integration work from within Swimlane?

Hello @Chris.Calavas, thanks for reaching out. I will try and respond below and explain further:

sw_inputs

sw_inputs are used when you want to access mapped variables (e.g. from a record, keystore, static, etc.). You can access these by using sw_context.inputs.get(key_value).

So when accessing the data you can use the get method or just access it directly as a dictionary item.

Additionally, you can see all available properties and values on the sw_context object using this:

print(sw_context.__dict__)

sw_outputs

sw_outputs is how you map your own outputs to fields. The sw_outputs object expects a list of dictionaries which then you use the keys as defined output variables in Swimlane’s Output Parameters.

Please note that your key values should utilize underscores for variable names that have spaces or dashes.

Example:

sw_outputs.append({
    'my_key': 'some_value',
   'another_key': 'another_value'
})

I hope this helps, please let me know if you have any more questions and welcome!

Here is a link to Swimlane documentation on inputs

https://swimlane.com/knowledge-center/docs/administrator-guide/integrations/configure-task-input

And here is a link to Swimlane Documentation on outputs

https://swimlane.com/knowledge-center/docs/administrator-guide/integrations/configure-task-output/


To attempt to more directly answer you question it Integrations within Swimlane can operate independent of Swimlane applications (mainly via scheduled triggers) or act as actions taken via applications either via workflow, button press, or triggered events such as on save. Any integration that is tied to an application when it is triggered that integration will have access to the record object within the triggered application. You can then choose to pass in any of these record fields via inputs mapping (see documentation link above). You have although options from keystore, assets to static values that you can also pass in (also documented in the links above).

You are now free to write your own Python script for enrichment or automation. To return the results of these scripts to records either in this application or other you have two options

  1. Leverage output mappings as documented in the link above
  2. Use the Swimlane Python driver to interact directly with the Swimlane API the documentation for this can be found here.

Tom Goetz
Senior SOAR Engineer
Phoenix CyberSecurity

Here is the link to the Python Driver limits in link in replies stop me from putting it in the previous posting