Discourse to Discord Webhook

:discourse: :information_source: Before trying this, check out the official chat integration plugin for Discord

Discourse to Discord Webhook

This PHP script acts an intermediary between Discourse and Discord, receiving webhooks from Discourse and parsing them into an optimal format before relaying them to Discord.

Demo

See it in action and test it out for yourself on Crit Cola’s Discourse and Discord.

Installation

Just clone it!

git clone https://github.com/critcola/discourse-to-discord-webhook.git

This has been tested with and is supported on PHP 7.1, but should work fine on older versions of PHP.

Configuration

Copy config-template.php to config.php and populate all non-optional variables after configuring webhooks in both Discourse and Discord.

License

The Discourse to Discord Webhook script is released under the MIT License.

9개의 좋아요

where is the “congif.php” located

Rename config-template.php to config.php.

2개의 좋아요

Still don’t know where it is found

https://github.com/critcola/discourse-to-discord-webhook

1개의 좋아요

I am getting this error when sending a ping or a new post is created. Any help with what is happening here?

I tried both a public and private channel; same response.

Status: 400

{"code": 50006, "message": "Cannot send an empty message"}

config.php

$discord_webhook_url = 'WEBHOOK_FROM_DISCORD';

$discord_embed_color = '#HEX_VALUE';

$discord_embed_thumbnail_url ='https://DOMAIN_NAME';

$discord_embed_footer_icon_url = $discord_embed_thumbnail_url;
$discord_embed_footer_text = 'CUSTOM_STRING';

$discord_embed_timestamp = true;

$discourse_payload_secret = 'RANDOMLY_GENERATED_STRING';

$discourse_url_protocol = 'https';

$discourse_url_domain = 'forums.domain.com';

$discourse_path = '/';

Discourse Settings

Payload URL = DISCORD_APP_WEBOOK_URL

Content Type = application/json

Secret = RANDOMLY_GENERATED_STRING #same as above

Events = All events, or, all individual events checked

Check TLS certificate of payload url = checked

Active = checked

네, 저 같은 경우도요. 저는 도커화된 디스코스를 사용 중인데, launcher가 빌드할 때 git 저장소를 가져오기 위한 app.yml 파일에 많은 줄이 있습니다. 그래서 저는 app.yml 파일에 다음을 추가하고 다시 빌드합니다.

- git clone https://github.com/critcola/discourse-to-discord-webhook.git

하지만 launcher 빌드 프로세스가 자동화되어 있어 config-template.php 파일을 어떻게 편집하고 그 업데이트를 config.php에 저장해야 하는지 이제 막막합니다.

왜 이러한 설정들을 php 파일 편집이 아닌 관리자 섹션의 설정 인터페이스 일부로 만들지 않는 걸까요? 만약 그것이 비현실적이라면, 저와 같은 사람은 config.php 파일을 어떻게 수정해야 하는지 궁금합니다. 도커 컨테이너 환경에 들어가서 config.php 파일을 수동으로 만들어야 하는 건가요? 그렇게 하면 업데이트와 도커 재빌드 후에도 그 파일이 유지되는 건가요?