discourse-chat-integration 플러그인으로 Microsoft Teams 알림 설정하기

이 가이드는 discourse-chat-integration에 포함된 Microsoft Teams 제공자를 설정하는 방법을 설명합니다.

Microsoft Teams 설정

Microsoft Teams에서:

  1. 왼쪽의 세로 내비게이션 바에서 마침표 버튼()을 클릭하고 메뉴에서 작업 흐름(Workflows)을 선택합니다.

  2. 작업 흐름(Workflows) 페이지의 오른쪽 상단에 있는 + 처음부터 만들기(Build from scratch) 버튼을 클릭합니다.

  3. 사용자 정의 작업 흐름 모달에서 webhook을 검색하고 Teams 웹훅 요청이 수신될 때(When a Teams webhook request is received) 트리거를 선택합니다.

    "webhook"을 검색하고 "Teams 웹훅 요청이 수신될 때"를 선택합니다.|576x499

  4. 작업 흐름을 트리거할 수 있는 사람(Who can trigger the flow) 필드에서 누구나(Anyone)를 선택합니다. [1]

    “작업 흐름을 트리거할 수 있는 사람” 필드에 "누구나"를 입력합니다.|576x499

  5. + 새 단계(New step)를 클릭합니다.

    "+ 새 단계"를 클릭합니다.|576x499

  6. 다음으로, card을 검색하고 채팅 또는 채널에 카드 게시(Post card in a chat or channel) 작업을 선택합니다.

    "card"을 검색하고 "채팅 또는 채널에 카드 게시"를 선택합니다.|576x499

  7. 필드를 다음과 같이 입력합니다:

  • 게시자(Post as): 메시지가 누구로부터 온 것인지 선택합니다. 기본값을 그대로 두거나 사용자(User)를 선택하여 메시지가 나로부터 온 것으로 보이도록 할 수 있습니다.

  • 게시 위치(Post in): 채널(Channel)을 선택하면 더 많은 필드가 표시됩니다:

    • 팀(Team): 원하는 팀을 선택합니다.
    • 채널(Channel): 원하는 채널을 선택합니다.
    • 적응형 카드(Adaptive Card): 입력창을 클릭하면 팝업이 열립니다(다음 단계에서 설명).

    작업 필드를 입력합니다.|576x499

  1. 적응형 카드(Adaptive Card) 필드 안쪽을 클릭하여 동적 콘텐츠 또는 수식을 삽입하는 팝업을 엽니다 [2] 수식(Expression) 탭으로 전환하고 수식 필드에 triggerBody()를 입력합니다.

    수식 필드에 "triggerBody()"를 입력하여 “적응형 카드” 필드를 업데이트합니다.|576x499

  2. 저장(Save)을 클릭합니다.

    "저장"을 클릭합니다.|576x499

  3. 이제 목록에서 수동 → 채팅 또는 채널에 카드 게시(manual → Post card in a chat or channel)라는 이름의 작업 흐름을 볼 수 있어야 합니다. 이 작업 흐름의 세로 점 세 개 버튼을 클릭하고 드롭다운 메뉴에서 세부 정보(Details)를 선택합니다.

    세로 점 세 개 → "세부 정보"를 클릭하여 작업 흐름 세부 정보를 엽니다.|576x499

  4. 이 페이지에서 웹훅 링크 복사(Copy webhook link)를 클릭하여 다음 단계를 위한 링크를 가져옵니다. 여기에 있는 동안 팀원들이 목적을 알 수 있도록 작업 흐름 이름을 선택적으로 편집할 수 있습니다.

    "웹훅 링크 복사"를 클릭합니다.|576x499

Discourse 설정

이제 Discourse로 돌아갑니다:

  1. Discourse 관리자 영역에서 채팅 통합 활성화(Chat integration enabled) 설정을 켜서 채팅 통합 플러그인을 활성화하고, 채팅 통합 Teams 활성화(Chat integration Teams enabled) 설정을 켜서 Microsoft Teams를 지원합니다.

    chat-integration-enabled 설정을 활성화합니다.|690x169

    chat-integration-teams-enabled 설정을 활성화합니다.|690x183

  2. 사이드바에서 플러그인(Plugins) 섹션을 찾아 채팅 통합(Chat Integrations)을 클릭한 다음, + 채널 만들기(Create Channel)를 클릭합니다.

    채팅 통합 플러그인 설정에서 "+ 채널 만들기"를 클릭합니다.|576x499

  3. 채널 편집(Edit Channel) 모달에서 필드를 다음과 같이 입력합니다:

  • 이름(Name): 어떤 Microsoft Teams 채널을 연결하는지 명확하게 나타내는 이름을 입력합니다. 정확한 일치일 필요는 없습니다.
  • 웹훅 URL(Webhook URL): 위의 Teams 설정 섹션 11단계에서 복사한 웹훅 URL을 붙여넣습니다.
  1. 채널 저장(Save Channel)을 클릭합니다.

    이름과 웹훅 URL 필드를 업데이트하고 "채널 저장"을 클릭합니다.|576x500

통합 테스트

이제 모든 것이 예상대로 작동하는지 확인해야 할 때입니다.

  1. Discourse에서 새로 생성된 채널에서 테스트(Test)를 클릭합니다.

    새 채널에서 "테스트"를 클릭합니다.|576x499

  2. ID, 제목 또는 URL로 주제를 검색하고, 원하는 주제를 선택한 다음 테스트 메시지 보내기(Send Test Message)를 클릭합니다.

    주제를 검색하고 "테스트 메시지 보내기"를 클릭합니다.|576x499

  3. Microsoft Teams에서 주제에 대한 정보가 포함된 새 메시지가 채널에 게시되어야 합니다:

    선택한 주제와 함께 메시지가 표시되는지 Microsoft Teams를 확인합니다.|576x499

선택 사항: 채널용 규칙 설정

모든 것이 정상 작동하는지 확인했으므로, Discourse로 돌아가 채널에 추가 규칙을 설정하여 메시지를 사용자 정의할 수 있습니다.

디버깅

Microsoft Teams에서 예상대로 메시지가 표시되지 않으면, 작업 흐름 세부 정보(Workflow Details) 페이지로 이동(위의 Teams 설정 섹션 10단계 참조)하여 실행 이력(Run history) 섹션을 확인합니다. 여기에는 각 메시지 실행에 대한 로그가 표시되어야 합니다.

실패한 실행을 클릭하면 페이지 상단에 오류 메시지가 표시되는 Power Automate 영역으로 이동합니다. (아래 스크린샷에서는 실행이 성공적이었지만, 화살표는 실패한 실행 시 오류가 표시될 위치를 나타냅니다.)

여기에는 문제를 자세히 설명하며, 이를 수정하거나 여기에서 공유하여 도움을 받을 수 있습니다.


    1. Discourse는 현재 Teams에 대한 인증된 웹훅을 지원하지 않으므로 “누구나” 옵션만 작동합니다.
    ↩︎
  1. 팝업이 표시되지 않으면 적응형 카드 필드에 일시적으로 아무 내용이나 입력한 후 작업 흐름을 저장하고 다시 편집을 위해 열면 팝업이 표시됩니다. ↩︎

12개의 좋아요

Just tried it out and it seemed to work at first, but only the first time I clicked on the test button.
Rules are set up as follows:

  • Type: normal
  • Filter: All topics(?) and replies (translating from German here)
  • Category: Sandbox

When I wrote a reply to the test topic in my Sandbox category I got a warning sign when I went to my chat integrations, but when clicking on the warning triangle it says unknown error... with the error message bein null.

When I try to send another test notification it gives me another error 500 internal server error

Any hints on where to start trouble shooting this are welcome. If this should be posted elsewhere (e.g. under the chat integration plugin page), or made a separate topic, feel free to move it accordingly or let me know.

3개의 좋아요

Hi @SHilser - please can you check /logs on your site, and see if there is anything relevant there?

2개의 좋아요

There’s two things that seem relevant.

  • Socket Error
  • Internal Server Error

I copied the logs below (I replaced my domain name with mydomain.tld)

Socket Errror

Message (4 copies reported)

SocketError (Failed to open TCP connection to outlook.office.com:443 (getaddrinfo: Temporary failure in name resolution))
app/controllers/application_controller.rb:340:in `block in with_resolved_locale'
app/controllers/application_controller.rb:340:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:68:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:336:in `call'
config/initializers/100-quiet_logger.rb:19:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:22:in `call'
lib/middleware/request_tracker.rb:176:in `call'

Backtrace

/usr/local/lib/ruby/2.6.0/net/http.rb:949:in `rescue in block in connect'
/usr/local/lib/ruby/2.6.0/net/http.rb:946:in `block in connect'
/usr/local/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/usr/local/lib/ruby/2.6.0/timeout.rb:103:in `timeout'
/usr/local/lib/ruby/2.6.0/net/http.rb:945:in `connect'
/usr/local/lib/ruby/2.6.0/net/http.rb:930:in `do_start'
/usr/local/lib/ruby/2.6.0/net/http.rb:919:in `start'
/usr/local/lib/ruby/2.6.0/net/http.rb:1470:in `request'
rack-mini-profiler (2.0.4) lib/patches/net_patches.rb:19:in `block in request_with_mini_profiler'
rack-mini-profiler (2.0.4) lib/mini_profiler/profiling_methods.rb:33:in `step'

Env

HTTP HOSTS: mysite.tld

Internal Server Error

Message (4 copies reported)

Error: Internal Server Error
Url: https://mysite.tld/assets/ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js
Line: 1
Column: 267890
Window Location: https://mysite.tld/admin/plugins/chat/teams

Backtrace

o/t</<@https://mysite.tld/assets/ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:1:267890
o/t<@https://mysite.tld/assets/ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:1:267993
o@https://mysite.tld/assets/ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:1:268074
trigger@https://mysite.tld/assets/ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:1:545343
A</e._onError/<@https://mysite.tld/assets/ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:1:550189
f</t.invoke@https://mysite.tld/assets/ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:1:490190
f</t.flush@https://mysite.tld/assets/ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:1:489198
p</t.flush@https://mysite.tld/assets/ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:1:491205
t</t._end@https://mysite.tld/assets/ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:1:496596Here
t</t.end@https://mysite.tld/assets/ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:1:493157

Env

HTTP HOSTS: mysite.tld

Thanks for the help :slight_smile:

2개의 좋아요

That suggests that your server is having trouble with DNS resolution. Are you using a standard docker-based installation? Or is this in development?

3개의 좋아요

Just set it up about a week ago on a separate DigitalOcean droplet (one-click installation, now I’m on Version: 2.6.0.beta1 (310952fd6a). I use a subdomain and have the DNS records also on DigitalOcean. I have an A-Record, pointing to the IP, MX-Record pointing to the sub-domain name for reply by email as per these instruction). Only thing there is that I don’t have a DMARC Record published.

That’s all I can think of that I did in relation to DNS stuff. However, so far everything worked as expected. The site is set up, I can reach it via the sub-domain name, log-in, create topics (even via email), etc.

I’m just startled the first message made it through, but subsequent ones didn’t :man_shrugging:

2개의 좋아요

When I say DNS resolution, I mean your server is having trouble contacting outlook.office.com. The setup of your forum’s DNS records shouldn’t affect that.

Can you try connecting to your server via SSH and running

host outlook.office.com

You should get something like

outlook.office.com is an alias for substrate.office.com.
substrate.office.com is an alias for substrate.ms-acdc.office.com.
substrate.ms-acdc.office.com is an alias for afd-k.office.com.
afd-k.office.com is an alias for outlook-office-com.k-0002.k-msedge.net.
outlook-office-com.k-0002.k-msedge.net is an alias for k-0002.k-msedge.net.
k-0002.k-msedge.net has address 13.107.18.11
k-0002.k-msedge.net has IPv6 address 2620:1ec:c::11
3개의 좋아요

When I enter

host -d outlook.office.com

I get the following:

Trying "outlook.office.com"
Host outlook.office.com not found: 2(SERVFAIL)
Received 36 bytes from 127.0.0.53#53 in 43 ms

When adding port :443 I get another error

Trying "outlook.office.com:443"
Host outlook.office.com:443 not found: 3(NXDOMAIN)
Received 40 bytes from 127.0.0.53#53 in 3 ms
Received 40 bytes from 127.0.0.53#53 in 3 ms

For other domains like google.com or the domain of my discourse instance in question (h-da.transformative-praxis.cc), or other sites I get the expected output similar to what you describe.

I did some search for the first error, but I’m still not sure about its source. I’ve read the following, but wasn’t able to judge, if this is actually relevant to my problem:

1개의 좋아요

I kept retrying it and this time I got the results you described when typing

host outlook.office.com

So everything seemed fine at this point. I’ve repeated that many times in a row to make sure (like around 15 times with an interval of around 10 seconds) and at some point I got the same servfail error as before. But mostly it worked.

The opposite is the case when I try to send a test message. It maybe works one out of ten times. The other times I get the same errors as before. And when I post a regular message that fits to the rule I’ve set for the channel, I don’t get a notification, nor an error message in the logs.
It just seems so random to me that I can’t find out what causes it.

I kept suspecting my setup with two droplets for each subdomain and two respective A-Records, plus one set of NS-records for my main domain pointing to ns1.digitalocean.com. So I tried out dnsstuff for my site getting a Fail for the SOA record check and whatsmydns.net for my NS records, but I still couldn’t figure out any possible connections to my problem.

At this point I’m totally confused who’s causing the error, me having made some wrong DNS settings (which shouldn’t affect it according to @david), server settings/issues, or is it just MS-Teams (outlook.office.com) acting up, or blocking me in some way?

Any hints for what I could check/do to find the error are appreciated, including where else to go and ask, if you think this is beyond what you can do to help me here.

Thanks a lot for all the help so far.

1개의 좋아요

Hi, thanks for this. I keep failing at step Discourse 5: The dialogue box says my incoming Webhooks URL is invalid?

Any help appreciated!

Dan

1개의 좋아요

Would you mind sharing what your webhook URL looks like? Either via PM to me or, if you can invalidate it first, here in the topic?

1개의 좋아요

Thanks @Dan_Turner, I just relaxed our validation a little which should help the situation. Please give it a try and let me know if it works better for you

https://github.com/discourse/discourse-chat-integration/commit/00ec1f486a3fd1dc523cdf242cfb1c78baaa407e

2개의 좋아요

Thanks! Will give it a try.

Dan

1개의 좋아요

Sorry to be thick but do I need to update Discourse or edit the file directly as detailed in the fix?
Thanks, Dan

1개의 좋아요

You need to update the plugin. Visit /admin/upgrade, and press the update button next to “Discourse-chat-integration”

2개의 좋아요

Hey - so sorry for being incompetent but - how do I actually try this as I’m on a hosted discourse instance? Thanks. Dan

1개의 좋아요

You will need to ask your hosting provider to update the plugin for you. At discourse.org this change has already gone out to all our customers, so I guess you must be hosted elsewhere?

1개의 좋아요

yeah, discourse hosting for me. which version is it in please and I will ask them to update?

1개의 좋아요

We don’t have version numbers for plugins, but you can share this commit link with them: https://github.com/discourse/discourse-chat-integration/commit/00ec1f486a3fd1dc523cdf242cfb1c78baaa407e

2개의 좋아요

Thanks for this -so useful- plugin.
A great improvement would be : add group mention in the message to generate notifications on Teams side.
It appears that webhook API is (was?) not implementing this feature but some say it has been implemented recently.
Do you think it could be easily implemented?