Hello everyone! I have a case where I need to work with API and I decided to work with fn_components app to make my python integration. My problem is that I can not pass any values from SOAR to fn_components. Here is my script for test:
import logging
from resilient_circuits import ResilientComponent, function, handler, StatusMessage, FunctionResult, FunctionError
PACKAGE_NAME = "test"
log = logging.getLogger(__name__)
class FunctionComponent(ResilientComponent):
"""Component that implements Resilient function"""
def __init__(self, opts):
"""constructor provides access to the configuration options"""
super(FunctionComponent, self).__init__(opts)
self.options = opts.get(PACKAGE_NAME, {})
@handler("reload")
def _reload(self, event, opts):
"""Configuration options have changed, save new values"""
self.options = opts.get(PACKAGE_NAME, {})
@function("test")
def _test(self, event, *args, **kwargs):
"""Function: None"""
try:
# Get the wf_instance_id of the workflow this Function was called in
wf_instance_id = event.message["workflow_instance"]["workflow_instance_id"]
yield StatusMessage("Starting 'test' running in workflow '{0}'".format(wf_instance_id))
# Get the function parameters:
incident_id = kwargs.get("incident_id")
log.info("success",incident_id)
Then I created message destination for fn_components that uses API "fn_components" and also created message destination for "test" that also uses same API key. Also, created a function that messages to 'test' destination with incident_id field. But when I used this function in workflow and ran it on incident it returns an error: "AttributeError: Invalid field name: incident_id"
------------------------------
Magzhan Leskhan
------------------------------