Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions plugins/zendesk/.CHECKSUM
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"spec": "5f6c8627300deeea935527e69617f0d9",
"manifest": "0dd87fc59f0f1452c8ccee31fdbeec69",
"setup": "8cc3662caa0b7471e18a8a909d29dfbe",
"spec": "5c33522a1bf15a8aff90ea911310ea40",
"manifest": "cb91d84a1e7343dee9f974f0cc0a0e70",
"setup": "ac15db442b2d95cbdbae8de4d5c8d1bc",
"schemas": [
{
"identifier": "create_ticket/schema.py",
Expand Down Expand Up @@ -41,7 +41,7 @@
},
{
"identifier": "connection/schema.py",
"hash": "cabf274f93c52d1123267db22ca6d37b"
"hash": "504aa9d960591a5c631a99dd28fc4653"
}
]
}
4 changes: 2 additions & 2 deletions plugins/zendesk/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 rapid7/insightconnect-python-3-slim-plugin:6.3.10 AS builder
FROM --platform=linux/amd64 rapid7/insightconnect-python-3-slim-plugin:6.4.1 AS builder

WORKDIR /python/src

Expand All @@ -11,7 +11,7 @@ ADD . /python/src
RUN pip install .
RUN pip uninstall -y setuptools

FROM --platform=linux/amd64 rapid7/insightconnect-python-3-slim-plugin:6.3.10
FROM --platform=linux/amd64 rapid7/insightconnect-python-3-slim-plugin:6.4.1

LABEL organization=rapid7
LABEL sdk=python
Expand Down
4 changes: 2 additions & 2 deletions plugins/zendesk/bin/icon_zendesk
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ from sys import argv

Name = "Zendesk"
Vendor = "rapid7"
Version = "4.0.3"
Description = "Regulate customer communications by managing tickets and users in Zendesk data"
Version = "5.0.0"
Description = "The [Zendesk](https://www.zendesk.com) plugin helps manage communication with customers. This plugin allows you to manage tickets and users in Zendesk. Customer Resource Management tool to manage tickets of user complaints and support issues. This plugin utilizes the [Zendesk Python SDK](https://github.com/facetoe/zenpy)"


def main():
Expand Down
16 changes: 6 additions & 10 deletions plugins/zendesk/help.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Description

The [Zendesk](https://www.zendesk.com) plugin helps manage communication with customers. This plugin allows you to manage tickets and users in Zendesk. Customer Resource Management tool to manage tickets of user complaints and support issues.

This plugin utilizes the [Zendesk Python SDK](https://github.com/facetoe/zenpy).
The [Zendesk](https://www.zendesk.com) plugin helps manage communication with customers. This plugin allows you to manage tickets and users in Zendesk. Customer Resource Management tool to manage tickets of user complaints and support issues. This plugin utilizes the [Zendesk Python SDK](https://github.com/facetoe/zenpy)

# Key Features

Expand All @@ -26,19 +24,16 @@ The connection configuration accepts the following parameters:

|Name|Type|Default|Required|Description|Enum|Example|Placeholder|Tooltip|
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
|api_key|credential_secret_key|None|False|Zendesk API key|None|A6yLhgioJiF2wOP1omP9sTa5yWSTvucx2U7yg67u|None|None|
|credentials|credential_username_password|None|True|Email and password|None|{"username": "user@example.com", "password": "password"}|None|None|
|api_token|string|None|True|Zendesk API Token|None|A6yLhgioJiF2wOP1omP9sTa5yWSTvucx2U7yg67u|None|None|
|email|string|None|True|Email|None|user@example.com|None|None|
|subdomain|string|None|True|Zendesk subdomain|None|example-subdomain|None|None|

Example input:

```
{
"api_key": "A6yLhgioJiF2wOP1omP9sTa5yWSTvucx2U7yg67u",
"credentials": {
"password": "password",
"username": "user@example.com"
},
"api_token": "A6yLhgioJiF2wOP1omP9sTa5yWSTvucx2U7yg67u",
"email": "user@example.com",
"subdomain": "example-subdomain"
}
```
Expand Down Expand Up @@ -701,6 +696,7 @@ Example output:

# Version History

* 5.0.0 - Deprecating username:password authentication method | Updated SDK to the latest version (6.4.1)
* 4.0.3 - Update dependency version | Updated SDK to the latest version
* 4.0.2 - Updated SDK to the latest version | `Search`: Fixed issue where only one search result was returned
* 4.0.1 - Updated the exceptions for all the actions | Show Organization Memberships: Added types to the actions output
Expand Down
34 changes: 22 additions & 12 deletions plugins/zendesk/icon_zendesk/connection/connection.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import insightconnect_plugin_runtime
from .schema import ConnectionSchema
from .schema import ConnectionSchema, Input

# Custom imports below
from insightconnect_plugin_runtime.exceptions import PluginException, ConnectionTestException
Expand All @@ -12,20 +12,30 @@ def __init__(self):
self.client = None

def connect(self, params):
email = params.get(Input.EMAIL, "").strip()
subdomain = params.get(Input.SUBDOMAIN, "").strip()
api_token = params.get(Input.API_TOKEN, "").strip()

missing_fields = []

if not email:
missing_fields.append(Input.EMAIL)
if not subdomain:
missing_fields.append(Input.SUBDOMAIN)
if not api_token:
missing_fields.append(Input.API_TOKEN)

if missing_fields:
fields_str = ", ".join(missing_fields)
assistance_message = f"Please provide the following required field(s): {fields_str}."
raise PluginException(cause="Could not authenticate to Zendesk.", assistance=assistance_message)

creds = {
"email": params.get("credentials").get("username"),
"subdomain": params.get("subdomain"),
"email": email,
"subdomain": subdomain,
"token": api_token,
}

if params.get("credentials").get("password"):
creds["password"] = params.get("credentials").get("password")
elif params.get("api_key").get("secretKey"):
creds["token"] = params.get("api_key").get("secretKey")
else:
raise PluginException(
cause="Could not authenticate to Zendesk.", assistance="Please provide a password or API key."
)

self.client = zenpy.Zenpy(**creds)
self.logger.info("Connect: Connecting...")

Expand Down
70 changes: 13 additions & 57 deletions plugins/zendesk/icon_zendesk/connection/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


class Input:
API_KEY = "api_key"
CREDENTIALS = "credentials"
API_TOKEN = "api_token"
EMAIL = "email"
SUBDOMAIN = "subdomain"


Expand All @@ -16,16 +16,16 @@ class ConnectionSchema(insightconnect_plugin_runtime.Input):
"type": "object",
"title": "Variables",
"properties": {
"api_key": {
"$ref": "#/definitions/credential_secret_key",
"title": "API Key",
"description": "Zendesk API key",
"api_token": {
"type": "string",
"title": "API Token",
"description": "Zendesk API Token",
"order": 2
},
"credentials": {
"$ref": "#/definitions/credential_username_password",
"title": "Email and Password",
"description": "Email and password",
"email": {
"type": "string",
"title": "Email",
"description": "Email",
"order": 1
},
"subdomain": {
Expand All @@ -36,55 +36,11 @@ class ConnectionSchema(insightconnect_plugin_runtime.Input):
}
},
"required": [
"credentials",
"api_token",
"email",
"subdomain"
],
"definitions": {
"credential_username_password": {
"id": "credential_username_password",
"title": "Credential: Username and Password",
"description": "A username and password combination",
"type": "object",
"properties": {
"username": {
"type": "string",
"title": "Username",
"description": "The username to log in with",
"order": 1
},
"password": {
"type": "string",
"title": "Password",
"description": "The password",
"format": "password",
"displayType": "password",
"order": 2
}
},
"required": [
"username",
"password"
]
},
"credential_secret_key": {
"id": "credential_secret_key",
"type": "object",
"title": "Credential: Secret Key",
"description": "A shared secret key",
"required": [
"secretKey"
],
"properties": {
"secretKey": {
"type": "string",
"title": "Secret Key",
"description": "The shared secret key",
"format": "password",
"displayType": "password"
}
}
}
}
"definitions": {}
}
"""
)
Expand Down
31 changes: 17 additions & 14 deletions plugins/zendesk/plugin.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ extension: plugin
products: [insightconnect]
name: zendesk
title: Zendesk
description: Regulate customer communications by managing tickets and users in Zendesk data
version: 4.0.3
connection_version: 4
description: The [Zendesk](https://www.zendesk.com) plugin helps manage communication with customers.
This plugin allows you to manage tickets and users in Zendesk. Customer Resource Management tool to manage tickets of user complaints and support issues.
This plugin utilizes the [Zendesk Python SDK](https://github.com/facetoe/zenpy)
version: 5.0.0
connection_version: 5
supported_versions: ["2024-07-11"]
vendor: rapid7
support: community
status: []
sdk:
type: slim
version: 6.3.10
version: 6.4.1
user: nobody
key_features:
- "Create, manage, and delete issues and epics"
Expand All @@ -21,6 +23,7 @@ requirements:
- "A Zendesk API key"
- "Information about your Zendesk instance"
version_history:
- "5.0.0 - Deprecating username:password authentication method | Updated SDK to the latest version (6.4.1)"
- "4.0.3 - Update dependency version | Updated SDK to the latest version"
- "4.0.2 - Updated SDK to the latest version | `Search`: Fixed issue where only one search result was returned"
- "4.0.1 - Updated the exceptions for all the actions | Show Organization Memberships: Added types to the actions output"
Expand Down Expand Up @@ -412,18 +415,18 @@ types:
type: date
required: false
connection:
credentials:
title: Email and Password
description: Email and password
type: credential_username_password
example: '{"username": "user@example.com", "password": "password"}'
email:
title: Email
description: Email
type: string
example: user@example.com
required: true
api_key:
type: credential_secret_key
title: API Key
description: Zendesk API key
api_token:
type: string
title: API Token
description: Zendesk API Token
example: A6yLhgioJiF2wOP1omP9sTa5yWSTvucx2U7yg67u
required: false
required: true
subdomain:
type: string
title: Subdomain
Expand Down
4 changes: 2 additions & 2 deletions plugins/zendesk/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

setup(
name="zendesk-rapid7-plugin",
version="4.0.3",
description="Regulate customer communications by managing tickets and users in Zendesk data",
version="5.0.0",
description="The [Zendesk](https://www.zendesk.com) plugin helps manage communication with customers. This plugin allows you to manage tickets and users in Zendesk. Customer Resource Management tool to manage tickets of user complaints and support issues. This plugin utilizes the [Zendesk Python SDK](https://github.com/facetoe/zenpy)",
author="rapid7",
author_email="",
url="",
Expand Down
4 changes: 2 additions & 2 deletions plugins/zendesk/unit_test/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def default_connector(action, connect_params: object = None):
params = connect_params
else:
params = {
Input.API_KEY: "API_KEY",
Input.API_TOKEN: "API_TOKEN",
Input.SUBDOMAIN: "testdomain",
Input.CREDENTIALS: {"username": "user", "password": "pass"},
Input.EMAIL: "test@test.com",
}
default_connection.connect(params)
action.connection = default_connection
Expand Down