计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
zendesk-api【效率与协作】Implements modern features of the Zendesk API, enabling automation, ticket management, and integration with various tools.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: zendesk-api description: Implements modern features of the Zendesk API, enabling automation, ticket management, and integration with various tools. license: MIT compatibility: opencode metadata: archetypes:
version: "1.0.0" domain: coding triggers: zendesk, zendesk api, ticket management, automate zendesk, integrate zendesk, how do i zendesk api role: implementation scope: implementation output-format: code related-skills: coding-api-integration, coding-nodejs-examples
This skill implements automation and integration patterns for the Zendesk API, enabling efficient ticket management, customer support automation, and integration with third-party services. It follows the principles of clean code and best practices to encourage maintainability and scalability.
import os
from zendesk_api import Zendesk
def initialize_client():
return Zendesk(subdomain=os.getenv('ZENDESK_SUBDOMAIN'),
email=os.getenv('ZENDESK_EMAIL'),
password=os.getenv('ZENDESK_API_TOKEN'))
def fetch_tickets(client: Zendesk, status="open", priority=None):
tickets = []
page = 1
while True:
response = client.tickets.list(page=page, status=status, priority=priority)
tickets.extend(response['tickets'])
if page >= response['meta']['total_pages']:
break
page += 1
return tickets
def create_ticket(client: Zendesk, subject: str, description: str, requester_id: int):
ticket = {
'ticket': {
'subject': subject,
'description': description,
'requester_id': requester_id
}
}
response = client.tickets.create(ticket)
return response
def update_ticket(client: Zendesk, ticket_id: int, updates: dict):
response = client.tickets.update(ticket_id, updates)
if response['ticket']['status'] != 'updated':
raise Exception(f'Failed to update ticket {ticket_id}') # ensure proper error handling
return response
def execute_api_call(api_method, *args, **kwargs):
try:
return api_method(*args, **kwargs)
except Exception as e:
logger.error(f'API call failed: {str(e)}')
raise
import logging
logger = logging.getLogger(__name__)
def log_request(request_data):
logger.info(f'Making API Request: {request_data}')
def automate_ticket_creation():
client = initialize_client()
ticket_subject = "Support Needed for Issue X"
ticket_description = "Details about the issue X are..."
requester_id = 1 # Assuming a valid requester ID
ticket_response = create_ticket(client, ticket_subject, ticket_description, requester_id)
print(f'Created ticket: {ticket_response}')
def get_open_tickets():
client = initialize_client()
open_tickets = fetch_tickets(client, status="open")
print(f'Open tickets: {open_tickets}')
Authoritative documentation links for this skill's domain. The model follows markdown links at load time to resolve external references and inline content.