# API 그룹 메시지: 오류에서 존재하지 않는 사용자 가져오기

**URL:** https://meta.discourse.org/t/api-group-messages-get-non-existing-users-from-error/190291
**Category:** Support
**Created:** [5월 13, 2021, 8:42오전 UTC](https://meta.discourse.org/t/api-group-messages-get-non-existing-users-from-error/190291 "2021-05-13T08:42:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![vagosduke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vagosduke/32/196991_2.png) [@vagosduke](https://meta.discourse.org/u/vagosduke)
#### Post date: [5월 13, 2021, 8:42오전 UTC](https://meta.discourse.org/t/api-group-messages-get-non-existing-users-from-error/190291/1 "2021-05-13T08:42:51Z")

</div>

안녕하세요. pydiscourse 클라이언트를 확장하여 개인 메시지를 전송할 수 있는 Python 유틸리티를 만들었습니다.

```python
    def send_private_message(self, content_html, title, target_usernames):
        """ 이 인스턴스가 생성된 API 사용자로 개인 메시지를 보냅니다 """
        if type(target_usernames) is list:
            target_usernames = ",".join(target_usernames)
        return self.create_post(content_html, title=title, target_usernames=target_usernames,
                                archetype="private_message")

```

이 유틸리티를 외부 수신자 목록이 포함된 스크립트에서 사용하여 그룹 메시지를 보내고 있습니다. 그러나 수신자 목록이 항상 최신으로 유지되지 않아 일부 사용자가 누락될 수 있습니다.

그래서 약 100명의 사용자에게 메시지를 보내려고 했더니 다음과 같은 메시지와 함께 422 에러가 발생했습니다:  
`One of the users you are sending this message to could not be found discourse`

누가 문제의 사용자인지 찾으려 할 때 이 메시지는 도움이 되지 않습니다. 더 자세한 에러 메시지를 받을 방법이 있거나, 이 호출을 수행하기 전에 해당 사용자가 누구인지 확인할 방법이 있을까요? 물론 전송 전에 한 명씩 쿼리할 수는 있지만, 특히 긴 목록의 경우 이는 상당한 성능 저하를 초래합니다.

감사합니다.
