Skip to content
Bitzsoft.Integrationsbitzsoft.integrations

Reference

Freshdesk

Bitzsoft.Integrations.Ticketing.Freshdesk 包参考——Basic Auth(api_key:x)鉴权、ITicketService 配置与使用示例。

Last updated

Freshdesk 基于 Freshdesk API v2,实现 ITicketService 统一接口。

包信息

NuGet 包Bitzsoft.Integrations.Ticketing.Freshdesk
实现接口ITicketService
Provider IDfreshdesk
鉴权方式HTTP Basic Auth,凭据格式 api_key:x(api_key 作为用户名,密码为空即 x),Base64 编码后作为 Authorization: Basic
默认 BaseUrl由 Domain 自动拼接为 https://{domain}.freshdesk.com/api/v2
区域Global

凭据(API Key)在 Freshdesk 个人设置(Profile Settings > API and Security)获取。

配置字段

字段类型必填默认值说明
DomainstringFreshdesk 子域名(如 mycompany
ApiKeystringAPI Key
BaseUrlstring留空时由 Domain 自动拼接 https://{domain}.freshdesk.com/api/v2
HttpClientNamestringTicketingFreshdesk业务 HttpClient 命名

配置 JSON 示例

{
"Ticketing": {
"Freshdesk": {
"Domain": "mycompany",
"ApiKey": "xxxxxxxxxxxxxxxxxx"
}
}
}

DI 注册

// 从配置节注册(默认节名 Ticketing:Freshdesk)
services.AddFreshdeskTicket(configuration);
// 或用回调单独配置
services.AddFreshdeskTicket(options =>
{
options.Domain = "mycompany";
options.ApiKey = "xxxxxxxxxxxxxxxxxx";
});

使用示例

public class SupportService
{
private readonly ITicketService _ticket;
public SupportService(ITicketService ticket) => _ticket = ticket;
public Task<TicketInfo> CreateAsync(string subject, string description, string requesterEmail)
=> _ticket.CreateTicketAsync(new CreateTicketRequest
{
Subject = subject,
Description = description,
RequesterEmail = requesterEmail
});
public Task<TicketingResult> ReplyAsync(string ticketId, string reply)
=> _ticket.AddCommentAsync(ticketId, reply, publicComment: true);
}

依赖

说明
Bitzsoft.Integrations.Ticketing工单系统服务抽象层
Bitzsoft.Integrations.Core公共基座

已知限制

  • Basic Auth 凭据格式为 api_key:x(密码占位为 x),仅需 API Key 一项凭据。

100%

滚轮或按钮缩放 · 放大后拖动画面 · 双击切换 100% / 200%