whatsapp.api 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. import "../base.api"
  2. import "./agent.api"
  3. import "./label_relationship.api"
  4. type (
  5. // The data of whatsapp information | Whatsapp信息
  6. WhatsappInfo {
  7. BaseIDInfo
  8. // Status 1: normal 2: ban | 状态 1 正常 2 禁用
  9. Status *uint8 `json:"status,optional"`
  10. WaId *string `json:"waId,optional"`
  11. WaName *string `json:"waName,optional"`
  12. // 回调地址
  13. Callback *string `json:"callback,optional"`
  14. // 模式ID
  15. AgentId *uint64 `json:"agentId,optional"`
  16. AgentInfo *AgentInfo `json:"agentInfo,optional"`
  17. // 微信账号
  18. Account *string `json:"account,optional"`
  19. // 手机号
  20. Phone *string `json:"phone,optional"`
  21. Cc *string `json:"cc,optional"`
  22. // 号码名称
  23. PhoneName *string `json:"phoneName,optional"`
  24. // 号码状态
  25. PhoneStatus *string `json:"phoneStatus,optional"`
  26. Tokens *uint64 `json:"tokens,optional"`
  27. Frequency *string `json:"frequency,optional"`
  28. // 号码质量
  29. Quality *string `json:"quality,optional"`
  30. // 号码校验状态
  31. VerifyStatus *string `json:"verifyStatus,optional"`
  32. // 号码发送频率
  33. MessagingLimitTier *string `json:"messagingLimitTier,optional"`
  34. // 机构 ID
  35. OrganizationId *uint64 `json:"organizationId,optional"`
  36. OrganizationName *string `json:"organizationName,optional"`
  37. // 大模型服务地址
  38. ApiBase *string `json:"apiBase,optional"`
  39. // 大模型服务密钥
  40. ApiKey *string `json:"apiKey,optional"`
  41. // 白名单
  42. AllowList []ContactInfo `json:"allowList,optional"`
  43. // 群白名单
  44. GroupAllowList []ContactInfo `json:"groupAllowList,optional"`
  45. // 黑名单
  46. BlockList []ContactInfo `json:"blockList,optional"`
  47. // 群黑名单
  48. GroupBlockList []ContactInfo `json:"groupBlockList,optional"`
  49. }
  50. WhatsappPhoneInfo {
  51. Avatar *string `json:"avatar,optional"`
  52. Industry *string `json:"industry,optional"`
  53. Intro *string `json:"intro,optional"`
  54. Address *string `json:"address,optional"`
  55. Email *string `json:"email,optional"`
  56. Website *string `json:"website,optional"`
  57. }
  58. // The response data of whatsapp list | Whatsapp列表数据
  59. WhatsappListResp {
  60. BaseDataInfo
  61. // Whatsapp list data | Whatsapp列表数据
  62. Data WhatsappListInfo `json:"data"`
  63. }
  64. // Whatsapp list data | Whatsapp列表数据
  65. WhatsappListInfo {
  66. BaseListInfo
  67. // The API list data | Whatsapp列表数据
  68. Data []WhatsappInfo `json:"data"`
  69. }
  70. // Get whatsapp list request params | Whatsapp列表请求参数
  71. WhatsappListReq {
  72. PageInfo
  73. // 手机号
  74. Phone *string `json:"phone,optional"`
  75. // 号码名称
  76. PhoneName *string `json:"phoneName,optional"`
  77. WaId *string `json:"waId,optional"`
  78. OrganizationId *uint64 `json:"organizationId,optional"`
  79. }
  80. // Whatsapp information response | Whatsapp信息返回体
  81. WhatsappInfoResp {
  82. BaseDataInfo
  83. // Whatsapp information | Whatsapp数据
  84. Data WhatsappInfo `json:"data"`
  85. }
  86. AutomationReq {
  87. WaId *string `json:"waId,optional"`
  88. Phone *string `json:"phone,optional"`
  89. }
  90. AutomationResp {
  91. BaseDataInfo
  92. // Whatsapp list data | Whatsapp列表数据
  93. Data ConversationalAutomationInfo `json:"data"`
  94. }
  95. ConversationalAutomationInfo {
  96. Prompts []string `json:"prompts,optional"`
  97. Commands []Command `json:"commands,optional"`
  98. Phone string `json:"phone,optional"`
  99. EnableWelcomeMessage bool `json:"enableWelcomeMessage,optional"`
  100. }
  101. Command {
  102. CommandDescription string `json:"commandDescription,optional"`
  103. CommandName string `json:"commandName,optional"`
  104. }
  105. SetAutomationReq {
  106. EnableWelcomeMessage bool `json:"enableWelcomeMessage,optional"`
  107. Phone string `json:"phone,optional"`
  108. Commands []Command `json:"commands,optional"`
  109. Prompts []string `json:"prompts,optional"`
  110. WaId string `json:"waId,optional"`
  111. }
  112. sendCodeReq {
  113. Phone *string `json:"phone"`
  114. WaId *string `json:"waId"`
  115. Method *string `json:"method"`
  116. Locale *string `json:"locale"`
  117. }
  118. submitCodeReq {
  119. Phone *string `json:"phone"`
  120. WaId *string `json:"waId"`
  121. Code *string `json:"code"`
  122. }
  123. getQrcodeReq {
  124. Phone *string `json:"phone"`
  125. WaId *string `json:"waId"`
  126. }
  127. getQrcodeResp {
  128. BaseDataInfo
  129. Data []Qrcode `json:"data"`
  130. }
  131. Qrcode {
  132. Phone string `json:"phone,optional"`
  133. QrdlCode string `json:"qrdlCode,optional"`
  134. GenerateQrImage string `json:"generateQrImage,optional"`
  135. PrefilledMessage string `json:"prefilledMessage,optional"`
  136. DeepLinkUrl string `json:"deepLinkUrl,optional"`
  137. QrImageUrl string `json:"qrImageUrl,optional"`
  138. }
  139. createQrcodeReq {
  140. Phone string `json:"phone"`
  141. GenerateQrImage string `json:"generateQrImage"`
  142. PrefilledMessage string `json:"prefilledMessage"`
  143. WaId string `json:"waId"`
  144. }
  145. updateQrcodeReq {
  146. Phone string `json:"phone,optional"`
  147. GenerateQrImage string `json:"generateQrImage,optional"`
  148. PrefilledMessage string `json:"prefilledMessage,optional"`
  149. QrdlCode string `json:"qrdlCode,optional"`
  150. WaId string `json:"waId"`
  151. }
  152. removeQrcodeReq {
  153. Phone string `json:"phone,optional"`
  154. QrdlCode string `json:"qrdlCode,optional"`
  155. WaId string `json:"waId"`
  156. }
  157. getBusinessReq {
  158. Phone *string `json:"phone"`
  159. WaId *string `json:"waId"`
  160. }
  161. getBusinessResp {
  162. BaseDataInfo
  163. Data BusinessInfo `json:"data"`
  164. }
  165. BusinessInfo {
  166. Vertical string `json:"vertical,optional"`
  167. Description string `json:"description,optional"`
  168. Email string `json:"email,optional"`
  169. Address string `json:"address,optional"`
  170. ProfilePictureUrl string `json:"profilePictureUrl,optional"`
  171. Websites []string `json:"websites,optional"`
  172. About string `json:"about,optional"`
  173. }
  174. setBusinessReq {
  175. Phone *string `json:"phone"`
  176. WaId *string `json:"waId"`
  177. Vertical string `json:"vertical,optional"`
  178. Description string `json:"description,optional"`
  179. Email string `json:"email,optional"`
  180. Address string `json:"address,optional"`
  181. ProfilePictureUrl string `json:"profilePictureUrl,optional"`
  182. Websites []string `json:"websites,optional"`
  183. About string `json:"about,optional"`
  184. }
  185. registerReq {
  186. Phone *string `json:"phone"`
  187. WaId *string `json:"waId"`
  188. }
  189. deregisterReq {
  190. Phone *string `json:"phone"`
  191. WaId *string `json:"waId"`
  192. }
  193. )
  194. @server(
  195. jwt: Auth
  196. group: whatsapp
  197. middleware: Authority
  198. )
  199. service Wechat {
  200. // Create whatsapp information | 创建Whatsapp
  201. @handler createWhatsapp
  202. post /whatsapp/create (WhatsappInfo) returns (BaseMsgResp)
  203. // Update whatsapp information | 更新Whatsapp
  204. @handler updateWhatsapp
  205. post /whatsapp/update (WhatsappPhoneInfo) returns (BaseMsgResp)
  206. // Delete whatsapp information | 删除Whatsapp信息
  207. @handler deleteWhatsapp
  208. post /whatsapp/delete (IDsReq) returns (BaseMsgResp)
  209. // Get whatsapp list | 获取Whatsapp列表
  210. @handler getWhatsappList
  211. post /whatsapp/list (WhatsappListReq) returns (WhatsappListResp)
  212. // Get whatsapp by ID | 通过ID获取Whatsapp
  213. @handler getWhatsappById
  214. post /whatsapp (IDReq) returns (WhatsappInfoResp)
  215. // 发送验证码
  216. @handler sendWhatsappCode
  217. post /whatsapp/sendCode (sendCodeReq) returns (BaseMsgResp)
  218. // 提交验证信息
  219. @handler submitWhatsappCode
  220. post /whatsapp/submitCode (submitCodeReq) returns (BaseMsgResp)
  221. // 获取开场白
  222. @handler getAutomation
  223. post /whatsapp/getAutomation (AutomationReq) returns (AutomationResp)
  224. // 编辑开场白
  225. @handler setAutomation
  226. post /whatsapp/setAutomation (SetAutomationReq) returns (BaseMsgResp)
  227. // 获取二维码
  228. @handler getQrcode
  229. post /whatsapp/getQrcode (getQrcodeReq) returns (getQrcodeResp)
  230. // 创建二维码
  231. @handler createQrcode
  232. post /whatsapp/createQrcode (createQrcodeReq) returns (BaseMsgResp)
  233. // 删除二维码
  234. @handler removeQrcode
  235. post /whatsapp/removeQrcode (removeQrcodeReq) returns (BaseMsgResp)
  236. // 修改二维码
  237. @handler updateQrcode
  238. post /whatsapp/updateQrcode (updateQrcodeReq) returns (BaseMsgResp)
  239. // 获取商业信息
  240. @handler getBusinessInfo
  241. post /whatsapp/getBusinessInfo (getBusinessReq) returns (getBusinessResp)
  242. // 设置商业信息
  243. @handler setBusinessInfo
  244. post /whatsapp/setBusinessInfo (setBusinessReq) returns (BaseMsgResp)
  245. // 注册WhatsApp号码
  246. @handler registerPhoneNumber
  247. post /whatsapp/registerPhoneNumber (registerReq) returns (BaseMsgResp)
  248. // 取消注册WhatsApp号码
  249. @handler deregisterPhoneNumber
  250. post /whatsapp/deregisterPhoneNumber (deregisterReq) returns (BaseMsgResp)
  251. }