# Discourse to Discord Webhook

**URL:** https://meta.discourse.org/t/discourse-to-discord-webhook/55273
**Category:** Extras
**Created:** [1월 6, 2017, 10:02오전 UTC](https://meta.discourse.org/t/discourse-to-discord-webhook/55273 "2017-01-06T10:02:45Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![DanielMarquard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danielmarquard/32/74010_2.png) [@DanielMarquard](https://meta.discourse.org/u/DanielMarquard)
#### Post date: [1월 6, 2017, 10:02오전 UTC](https://meta.discourse.org/t/discourse-to-discord-webhook/55273/1 "2017-01-06T10:02:46Z")

</div>

> :discourse: ℹ Before trying this, check out the [official chat integration plugin for Discord](https://meta.discourse.org/t/set-up-discord-notifications-using-the-discourse-chat-integration-plugin/66600)

# [Discourse to Discord Webhook](https://github.com/critcola/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](https://critcola.com/community/?utm_source=meta.discourse.org&utm_medium=extras-topic&utm_term=demo&utm_content=discourse-to-discord-webhook&utm_campaign=development) and [Discord](https://discord.critcola.com).

## Installation

Just clone it!

```sh
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.

---

<div class="post-metadata">

### Author: ![kyle\_boyce](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kyle_boyce/32/75951_2.png) [@kyle\_boyce](https://meta.discourse.org/u/kyle_boyce)
#### Post date: [7월 28, 2017, 12:07오전 UTC](https://meta.discourse.org/t/discourse-to-discord-webhook/55273/2 "2017-07-28T00:07:40Z")

</div>

where is the “congif.php” located

---

<div class="post-metadata">

### Author: ![DanielMarquard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danielmarquard/32/74010_2.png) [@DanielMarquard](https://meta.discourse.org/u/DanielMarquard)
#### Post date: [7월 31, 2017, 5:34오전 UTC](https://meta.discourse.org/t/discourse-to-discord-webhook/55273/3 "2017-07-31T05:34:06Z")

</div>

> [@kyle\_boyce](#):
>
> where is the “congif.php” located

Rename config-template.php to config.php.

---

<div class="post-metadata">

### Author: ![kyle\_boyce](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kyle_boyce/32/75951_2.png) [@kyle\_boyce](https://meta.discourse.org/u/kyle_boyce)
#### Post date: [7월 31, 2017, 1:43오후 UTC](https://meta.discourse.org/t/discourse-to-discord-webhook/55273/4 "2017-07-31T13:43:43Z")

</div>

Still don’t know where it is found

---

<div class="post-metadata">

### Author: ![DanielMarquard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danielmarquard/32/74010_2.png) [@DanielMarquard](https://meta.discourse.org/u/DanielMarquard)
#### Post date: [7월 31, 2017, 2:01오후 UTC](https://meta.discourse.org/t/discourse-to-discord-webhook/55273/5 "2017-07-31T14:01:25Z")

</div>

> [@kyle\_boyce](#):
>
> Still don’t know where it is found

[https://github.com/critcola/discourse-to-discord-webhook](https://github.com/critcola/discourse-to-discord-webhook)

> <https://github.com/critcola/discourse-to-discord-webhook/blob/master/config-template.php>

---

<div class="post-metadata">

### Author: ![thwright](https://avatars.discourse-cdn.com/v4/letter/t/e19b73/32.png) [@thwright](https://meta.discourse.org/u/thwright)
#### Post date: [12월 12, 2017, 2:33오후 UTC](https://meta.discourse.org/t/discourse-to-discord-webhook/55273/7 "2017-12-12T14:33:16Z")

</div>

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.

```plaintext
Status: 400

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

```

config.php

```plaintext
$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

```plaintext
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

```

---

<div class="post-metadata">

### Author: ![amalg](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@amalg](https://meta.discourse.org/u/amalg)
#### Post date: [2월 24, 2021, 12:20오전 UTC](https://meta.discourse.org/t/discourse-to-discord-webhook/55273/8 "2021-02-24T00:20:13Z")

</div>

> [@kyle\_boyce](#):
>
> “congif.php” 파일은 어디에 있나요?

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

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

```

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

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