Impartner

Impartner is the fastest-growing, most award-winning channel management solution provider on the market.

Utilities · Impartner

Details

IDImpartner
ProviderImpartner
CategoryUtilities
From Version6.0.0
Docker Imagedemisto/python3:3.12.13.10116658
Supported ModulesAgentix XSIAM

README

Impartner is the fastest-growing, most award-winning channel management solution provider on the market.
This integration was integrated and tested with version v1 of Impartner Objects API.

Configure Impartner on Cortex XSOAR

  1. Navigate to Settings > Integrations > Servers & Services.
  2. Search for Impartner.
  3. Click Add instance to create and configure a new integration instance.

    Parameter Description Required
    Your server URL   True
    API Key The API Key to use for connection True
    Trust any certificate (not secure)   False
  4. Click Test to validate the URLs, token, and connection.
  5. to get API key, please reach out to Impartner contact
    6.

Commands

You can execute these commands from the Cortex XSOAR CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.

impartner-get-account-list


Get account IDs from Impartner

Base Command

impartner-get-account-list

Input

Argument Name Description Required
query query for searching accounts. Optional
fields Comma separated list of fields to retrieve. Optional
filter Optional where clause (eg, Field1 = Val1 and Field2 > Val2). Optional
orderby Comma separated list of fields to sort by. Optional
skip Number of results to skip for pagination. Optional
take Number of results to take for pagination. Optional

Context Output

Path Type Description
Impartner.Account.count String Number of results returned.
Impartner.Account.entity String Type of entity returned.
Impartner.Account.results.id String ID of account.
Impartner.Account.results.name String Name of account.
Impartner.Account.results.recordLink String Link to account.
Impartner.Account.results.tech_BD_Assigned_for_XSOAR__cf String Tech partner BD assigned to account.

Command example

Human Readable Output

List of account ID’s

id name recordLink tech_BBD_Assigned_for_XSOAR__cf
1111 1111 https://prod.impartner.live/load/ACT/1111  
1112 1112 https://prod.impartner.live/load/ACT/1112  
1113 1113 https://prod.impartner.live/load/ACT/1113  
1114 1114 https://prod.impartner.live/load/ACT/1114  
1115 1115 https://prod.impartner.live/load/ACT/1115  
1116 1116 https://prod.impartner.live/load/ACT/1116  
1117 1117 https://prod.impartner.live/load/ACT/1117  
1118 1118 https://prod.impartner.live/load/ACT/1118  
1119 1119 https://prod.impartner.live/load/ACT/1119  
1120 1120 https://prod.impartner.live/load/ACT/1120  

impartner-get-account-id


Get account details from Impartner

Base Command

impartner-get-account-id

Input

Argument Name Description Required
id id of Impartner account. required
fields Comma separated list of fields to retrieve. Optional
all_fields Whether to return all fields. Optional

Context Output

Path Type Description
Impartner.Account.id Number Account ID.
Impartner.Account.isActive Boolean Is account active.
Impartner.Account.tech_BD_Assigned_for_XSOAR__cf String Tech partner BD assigned to account.
Impartner.Account.mailingCity String City of account.
Impartner.Account.mailingCountry String Country of account.
Impartner.Account.mailingPostalCode String Account postal code.
Impartner.Account.mailingState String State of account.
Impartner.Account.mailingStreet String Street of account.
Impartner.Account.name String Account Name.
Impartner.Account.recordLink Date Link to account in Impartner.
Impartner.Account.website Number Account website.
Impartner.Account.mainProductToIntegrate String Partner main product they are looking to integrate with.
Impartner.Account.mutualCustomer String Partner mutual customer with XSOAR.
Impartner.Account.tpA_Product_s__cf String Cortex products TPA is signed for.
Impartner.Account.target_customers__cf String Target customers for partner.
Impartner.Account.company_Main_Market_Segment__cf String Partner main market segment.
Impartner.Account.panW_Integration_Product__cf String Cortex integrated products.
Impartner.Account.account_Integration_Status__cf String Account integration status.
Impartner.Account.accountTimeline String Account timeline.

Command example

!impartner-get-account-id id=2247998

Context Example

{
    "Impartner": {
        "Account": {
                      'id': 11111111, 
                      'isActive': True,
                      'tech_BD_Assigned_for_XSOAR__cf': 'Edi',
                      'mailingCity': 'Palo Alto',
                      'mailingCountry': 'United States', 
                      'mailingPostalCode': '11111', 
                      'mailingState': 'California', 
                      'mailingStreet': '236 test Ave',
                      'name': 'test_account', 
                      'recordLink': 'https://prod.impartner.live/load/ACT/11111111',
                      'website': 'https://www.test-account.ai/', 
                      'mainProductToIntegrate': 'test', 
                      'mutualCustomer': 'test', 
                      'tpA_Product_s__cf': 'test', 
                      'integration_Status__cf': 'Integration Approved',
                      'target_customers__cf': ['Large Enterprise', 'SMB', 'SME'], 
                      'company_Main_Market_Segment__cf': ['Automation Orchestration & SOC tools', 'Data Security Governance & Classification'],
                      'panW_Integration_Product__cf': ['test'],
                      'account_Integration_Status__cf': ['Integrations in Process'],
                      'accountTimeline': '2022-06-30T00:00:00'
        }
    }
}

Human Readable Output

Account Details

Name ID Link PST Engineer
test_account 11111111 https://prod.impartner.live/load/ACT/11111111 Edi

Configuration parameters

  • url — Your server URL (required)
  • credentials — (required)
  • insecure — Trust any certificate (not secure)

Commands (2)

  • impartner-get-account-id

    Get account details from Impartner

  • impartner-get-account-list

    Get account IDs from Impartner.

from typing import Any

import demistomock as demisto  # noqa: F401
import urllib3
from CommonServerPython import *  # noqa: F401

from CommonServerUserPython import *  # noqa

# Disable insecure warnings
urllib3.disable_warnings()

""" CLIENT CLASS """


class Client(BaseClient):
    """Client class to interact with the service API

    This Client implements API calls, and does not contain any XSOAR logic.
    Should only do requests and return data.
    It inherits from BaseClient defined in CommonServer Python.
    Most calls use _http_request() that handles proxy, SSL verification, etc.
    For this  implementation, no special attributes defined
    """

    def __init__(self, base_url, verify: bool, api_key: str = ""):
        headers = {"Authorization": "prm-key " + api_key}
        super().__init__(base_url=base_url, verify=verify, headers=headers)

    def get_accounts_list(self, params):
        result = self._http_request(method="GET", url_suffix="/account", params=params, headers=self._headers)
        return result

    def get_accounts_id(self, id, params):
        result = self._http_request(method="GET", url_suffix=f"/account/{id}", params=params, headers=self._headers)
        return result


""" COMMAND FUNCTIONS """


def test_module(client: Client) -> str:  # pragma: no cover
    """Tests API connectivity and authentication'

    Returning 'ok' indicates that the integration works like it is supposed to.
    Connection to the service is successful.
    Raises exceptions if something goes wrong.

    :type client: ``Client``
    :param Client: client to use

    :return: 'ok' if test passed, anything else will fail the test.
    :rtype: ``str``
    """

    message: str = ""
    try:
        res = client.get_accounts_list({})
        if res.get("success"):
            message = "ok"
    except DemistoException as e:
        raise e
    return message


def impartner_get_account_list_command(client: Client, args: dict[str, Any]) -> CommandResults:
    query = args.get("query", "")
    fields = args.get("fields", "name, id, recordLink, tech_BD_Assigned_for_XSOAR__cf")
    filter = args.get("filter", "")
    orderby = args.get("orderby", "")
    skip = args.get("skip", "0")
    take = args.get("take", "10")
    params = assign_params(q=query, fields=fields, filter=filter, orderby=orderby, skip=skip, take=take)

    # Call the Client function and get the raw response
    result = client.get_accounts_list(params)
    parsed_result = result.get("data", {})
    readable_output = tableToMarkdown("List of accounts", parsed_result.get("results"))
    return CommandResults(
        outputs_prefix="Impartner.Account", readable_output=readable_output, outputs_key_field="id", outputs=parsed_result
    )


def impartner_get_account_id_command(client: Client, args: dict[str, Any]) -> CommandResults:
    id = args.get("id")
    fields = args.get("fields")
    all_fields = argToBoolean(args.get("all_fields", False))
    if all_fields:
        fields = ""
    params = assign_params(fields=fields)
    # Call the Client function and get the raw response
    result = client.get_accounts_id(id, params)
    parsed_result = result.get("data", {})
    if all_fields:
        context_result = {
            "id": parsed_result.get("id"),
            "isActive": parsed_result.get("isActive"),
            "tech_BD_Assigned_for_XSOAR__cf": parsed_result.get("tech_BD_Assigned_for_XSOAR__cf"),
            "mailingCity": parsed_result.get("mailingCity"),
            "mailingCountry": parsed_result.get("mailingCountry"),
            "mailingPostalCode": parsed_result.get("mailingPostalCode"),
            "mailingState": parsed_result.get("mailingState"),
            "mailingStreet": parsed_result.get("mailingStreet"),
            "name": parsed_result.get("name"),
            "recordLink": parsed_result.get("recordLink"),
            "website": parsed_result.get("website"),
            "mainProductToIntegrate": parsed_result.get(
                "what_is_your_main_product_you_are_looking_to_integrate_with_Palo_Alto_Networks__cf"
            ),
            "mutualCustomer": parsed_result.get(
                "if_yes_please_share_at_least_1_mutual_customer_that_will_use_and_test_the_integration__cf"
            ),
            "tpA_Product_s__cf": parsed_result.get("tpA_Product_s__cf"),
            "integration_Status__cf": parsed_result.get("integration_Status__cf"),
            "target_customers__cf": parsed_result.get("target_customers__cf"),
            "company_Main_Market_Segment__cf": parsed_result.get("company_Main_Market_Segment__cf"),
            "panW_Integration_Product__cf": parsed_result.get("panW_Integration_Product__cf"),
            "account_Integration_Status__cf": parsed_result.get("account_Integration_Status__cf"),
            "accountTimeline": parsed_result.get("if_there_is_a_timeline_to_complete_the_integration_please_enter_the_date__cf"),
        }
    else:
        context_result = {
            "name": parsed_result.get("name"),
            "id": parsed_result.get("id"),
            "link": parsed_result.get("recordLink"),
            "tech_BD_Assigned_for_XSOAR__cf": parsed_result.get("tech_BD_Assigned_for_XSOAR__cf"),
        }
    readable_list = {
        "name": parsed_result.get("name"),
        "ID": parsed_result.get("id"),
        "link": parsed_result.get("recordLink"),
        "PST Engineer": parsed_result.get("tech_BD_Assigned_for_XSOAR__cf"),
    }
    readable_output = tableToMarkdown(
        "Account Details", readable_list, ["name", "ID", "link", "PST Engineer"], headerTransform=pascalToSpace
    )

    return CommandResults(
        outputs_prefix="Impartner.Account",
        readable_output=readable_output,
        outputs_key_field="id",
        outputs=context_result,
    )


""" MAIN FUNCTION """


def main() -> None:  # pragma: no cover
    """
    main function, parses params and runs command functions
    """

    api_key = demisto.params().get("credentials", {}).get("password")

    # get the service API url
    base_url = urljoin(demisto.params()["url"], "/api/objects/v1/")
    verify_certificate = not demisto.params().get("insecure", False)

    demisto.debug(f"Command being called is {demisto.command()}")
    try:
        client = Client(base_url=base_url, api_key=api_key, verify=verify_certificate)

        if demisto.command() == "test-module":
            # This is the call made when pressing the integration Test button.
            result = test_module(client)
            return_results(result)

        elif demisto.command() == "impartner-get-account-list":
            return_results(impartner_get_account_list_command(client, demisto.args()))
        elif demisto.command() == "impartner-get-account-id":
            return_results(impartner_get_account_id_command(client, demisto.args()))

    # Log exceptions and return errors
    except Exception as e:
        return_error(f"Failed to execute {demisto.command()} command.\nError:\n{e!s}")


""" ENTRY POINT """


if __name__ in ("__main__", "__builtin__", "builtins"):
    main()