Commit 2fa4eb4c by zhaolianjie

加入群组

1 parent ef437550
...@@ -27,7 +27,8 @@ public class FeiShuChatDTO { ...@@ -27,7 +27,8 @@ public class FeiShuChatDTO {
private String userIdType; private String userIdType;
@JsonProperty("user_id_list") @JsonProperty("user_id_list")
private String[] userIdList; private String[] userIdList;
// 加入群聊的成员列表
@JsonProperty("id_list")
private String[] idList;
} }
...@@ -396,7 +396,25 @@ public class FeiShuApiService { ...@@ -396,7 +396,25 @@ public class FeiShuApiService {
throw new ServiceException("飞书:" + api + "接口调用失败" + "\n" + e); throw new ServiceException("飞书:" + api + "接口调用失败" + "\n" + e);
} }
} }
public String joinChatList(FeiShuChatDTO feiShuChatDTO) {
String api = "/im/v1/chats/{chat_id}/members";
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", "Bearer " + getTenantToken());
headers.set("Content-Type", "application/json; charset=utf-8");
String url = feiShuConfig.getFeiShuOpenApiHost() + api;
try {
HttpEntity<String> requestEntity = new HttpEntity<>(objectMapper.writeValueAsString(feiShuChatDTO), headers);
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class,feiShuChatDTO.getChatId());
System.out.println(responseEntity.getBody());
Type type = new TypeReference<FeiShuResultDTO>() {
}.getType();
FeiShuResultDTO feiShuResultDTO = JSONObject.parseObject(responseEntity.getBody(), type);
return feiShuResultDTO.getData().getChatId();
} catch (Exception e) {
throw new ServiceException("飞书:" + api + "接口调用失败" + "\n" + e);
}
}
/** /**
* 群发消息 * 群发消息
* https://open.feishu.cn/document/ukTMukTMukTM/ucDO1EjL3gTNx4yN4UTM * https://open.feishu.cn/document/ukTMukTMukTM/ucDO1EjL3gTNx4yN4UTM
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!