[GH-ISSUE #138] Cant find the Discord integration #95

Closed
opened 2026-02-25 23:41:09 +03:00 by kerem · 16 comments
Owner

Originally created by @TheFonix on GitHub (Oct 17, 2017).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/138

So ive built the HealthCheck app locally but cant seems to find the Discord integration option? Am i missing something here?

Thanks!

Originally created by @TheFonix on GitHub (Oct 17, 2017). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/138 So ive built the HealthCheck app locally but cant seems to find the Discord integration option? Am i missing something here? Thanks!
kerem closed this issue 2026-02-25 23:41:09 +03:00
Author
Owner

@cuu508 commented on GitHub (Oct 17, 2017):

Hi @TheFonix,

have you set DISCORD_CLIENT_ID and DISCORD_CLIENT_SECRET settings in the local_settings.py file?

You can create your Discord API credentials here: https://discordapp.com/developers/applications/me

<!-- gh-comment-id:337205849 --> @cuu508 commented on GitHub (Oct 17, 2017): Hi @TheFonix, have you set `DISCORD_CLIENT_ID` and `DISCORD_CLIENT_SECRET` settings in the `local_settings.py` file? You can create your Discord API credentials here: https://discordapp.com/developers/applications/me
Author
Owner

@TheFonix commented on GitHub (Oct 17, 2017):

Ah perfect! Thank you!

<!-- gh-comment-id:337252146 --> @TheFonix commented on GitHub (Oct 17, 2017): Ah perfect! Thank you!
Author
Owner

@TheFonix commented on GitHub (Oct 17, 2017):

So i added them all in & Woo, the integration button pops up, but when i click the Connect discord button it directs me to the discord page & tells me there was an unknown error? :(

as seen here
https://imgur.com/CZAWBEQ

<!-- gh-comment-id:337257909 --> @TheFonix commented on GitHub (Oct 17, 2017): So i added them all in & Woo, the integration button pops up, but when i click the `Connect discord` button it directs me to the discord page & tells me there was an unknown error? :( as seen here https://imgur.com/CZAWBEQ
Author
Owner

@cuu508 commented on GitHub (Oct 18, 2017):

When setting up the Discord app, did you specify a redirect URI?

If you're experimenting locally, and your server is running on localhost:8000 then the correct redirect URI would be http://localhost:8000/integrations/add_discord/

<!-- gh-comment-id:337559056 --> @cuu508 commented on GitHub (Oct 18, 2017): When setting up the Discord app, did you specify a redirect URI? If you're experimenting locally, and your server is running on localhost:8000 then the correct redirect URI would be `http://localhost:8000/integrations/add_discord/`
Author
Owner

@TheFonix commented on GitHub (Oct 18, 2017):

I still seem to get the same issue, im running it globally now, which can be accessed through https://sanity.corinthmc.com Its running through a reverse proxy on Nginx

<!-- gh-comment-id:337727854 --> @TheFonix commented on GitHub (Oct 18, 2017): I still seem to get the same issue, im running it globally now, which can be accessed through https://sanity.corinthmc.com Its running through a reverse proxy on Nginx
Author
Owner

@TheFonix commented on GitHub (Oct 18, 2017):

in the redirects i currently have https://sanity.corinthmc.com/integrations/add_discord/ just for reference

<!-- gh-comment-id:337728116 --> @TheFonix commented on GitHub (Oct 18, 2017): in the redirects i currently have `https://sanity.corinthmc.com/integrations/add_discord/` just for reference
Author
Owner

@cuu508 commented on GitHub (Oct 19, 2017):

The redirect URL looks fine. Can you show the URL of the page with "UNKNOWN_ERROR"?

<!-- gh-comment-id:338027785 --> @cuu508 commented on GitHub (Oct 19, 2017): The redirect URL looks fine. Can you show the URL of the page with "UNKNOWN_ERROR"?
Author
Owner

@TheFonix commented on GitHub (Oct 20, 2017):

The URL is directs me to is:
https://discordapp.com/oauth2/authorize?response_type=code&redirect_uri=https%3A%2F%2Fsanity.corinthmc.com%2Fintegrations%2Fadd_discord%2F&client_id=369875152080470016&scope=webhook.incoming&state=lumeMSbI9KHM

<!-- gh-comment-id:338128607 --> @TheFonix commented on GitHub (Oct 20, 2017): The URL is directs me to is: ```https://discordapp.com/oauth2/authorize?response_type=code&redirect_uri=https%3A%2F%2Fsanity.corinthmc.com%2Fintegrations%2Fadd_discord%2F&client_id=369875152080470016&scope=webhook.incoming&state=lumeMSbI9KHM```
Author
Owner

@cuu508 commented on GitHub (Oct 20, 2017):

The discordapp.com URL looks good too...

Another thing to check: when you are on the UNKNOWN_ERROR page, open developer tools and in the Network tab look for a authorize call and see what status code and response body it returns.

As an example, here's what I get if I change redirect_uri slightly:

image

<!-- gh-comment-id:338141388 --> @cuu508 commented on GitHub (Oct 20, 2017): The discordapp.com URL looks good too... Another thing to check: when you are on the UNKNOWN_ERROR page, open developer tools and in the Network tab look for a `authorize` call and see what status code and response body it returns. As an example, here's what I get if I change redirect_uri slightly: ![image](https://user-images.githubusercontent.com/661859/31811793-8c1930b6-b589-11e7-99c8-7eb4e75436f5.png)
Author
Owner

@cuu508 commented on GitHub (Oct 20, 2017):

Realized I can take the URL you posted and check this myself.

The error message for your URL is Invalid OAuth2 redirect_uri also.

Can you double check that the redirect URL in the Discord app is indeed https://sanity.corinthmc.com/integrations/add_discord/? The http / https in the protocol matters. If you had created several Discord apps, make sure you're ussing the correct client_id value.

<!-- gh-comment-id:338143185 --> @cuu508 commented on GitHub (Oct 20, 2017): Realized I can take the URL you posted and check this myself. The error message for your URL is `Invalid OAuth2 redirect_uri` also. Can you double check that the redirect URL in the Discord app is indeed `https://sanity.corinthmc.com/integrations/add_discord/`? The http / https in the protocol matters. If you had created several Discord apps, make sure you're ussing the correct `client_id` value.
Author
Owner

@TheFonix commented on GitHub (Oct 20, 2017):

Oh my goodness! After far too many hours of working on this it was down to the reverse proxy i was using not correctly applying SSL to the URL, Thank you so much for all of your help!

<!-- gh-comment-id:338156281 --> @TheFonix commented on GitHub (Oct 20, 2017): Oh my goodness! After far too many hours of working on this it was down to the reverse proxy i was using not correctly applying SSL to the URL, Thank you so much for all of your help!
Author
Owner

@TheFonix commented on GitHub (Oct 20, 2017):

So, just to keep you on your toes, i got the bot to join discord & i deleted the channel for it to post to but sadly it doesn't send any messages to the discord when something goes down or comes up, ive check through all the settings in the online page, but they are all set to alert when the service goes down, & ive double checked the bot has read & write permissions to the channel its using, anything else im missing here? Not sure if this is related but the bot shows as being offline in the discord server

Sorry to be a pain

<!-- gh-comment-id:338158388 --> @TheFonix commented on GitHub (Oct 20, 2017): So, just to keep you on your toes, i got the bot to join discord & i deleted the channel for it to post to but sadly it doesn't send any messages to the discord when something goes down or comes up, ive check through all the settings in the online page, but they are all set to alert when the service goes down, & ive double checked the bot has read & write permissions to the channel its using, anything else im missing here? Not sure if this is related but the bot shows as being `offline` in the discord server Sorry to be a pain
Author
Owner

@cuu508 commented on GitHub (Oct 20, 2017):

No worries, just means there's more work to do on documentation side here ;-)

First thing to check: do you have manage.py sendalerts command running? It's the command responsible for monitoring check states and sending alerts. In a server environment I would use either supervisor or systemd to start it up and keep it running. For testing purposes you can just run it in a shell or a screen session.

https://github.com/healthchecks/healthchecks#sending-status-notifications

<!-- gh-comment-id:338159592 --> @cuu508 commented on GitHub (Oct 20, 2017): No worries, just means there's more work to do on documentation side here ;-) First thing to check: do you have `manage.py sendalerts` command running? It's the command responsible for monitoring check states and sending alerts. In a server environment I would use either supervisor or systemd to start it up and keep it running. For testing purposes you can just run it in a shell or a screen session. https://github.com/healthchecks/healthchecks#sending-status-notifications
Author
Owner

@TheFonix commented on GitHub (Oct 20, 2017):

So, im not able to see it running & doing /manage.py sendalerts Returns this:

root@SANITY-CHECKER ~/webapps/healthchecks # ./manage.py sendalerts
Traceback (most recent call last):
  File "./manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
ImportError: No module named django.core.management
<!-- gh-comment-id:338172406 --> @TheFonix commented on GitHub (Oct 20, 2017): So, im not able to see it running & doing `/manage.py sendalerts` Returns this: ``` root@SANITY-CHECKER ~/webapps/healthchecks # ./manage.py sendalerts Traceback (most recent call last): File "./manage.py", line 8, in <module> from django.core.management import execute_from_command_line ImportError: No module named django.core.management ```
Author
Owner

@cuu508 commented on GitHub (Oct 20, 2017):

Looks like the virtualenv is not activated. Try this:

$ cd ~/webapps
$ source hc-venv/bin/activate
$ ./manage.py sendalerts

For supervisor & systemd you would use a command like this:

/root/webapps/healthchecks/hc-venv/bin/python /root/webapps/healthchecks/manage.py sendalerts

The above command is using virtualenv's python executable, instead of the system-global python.

<!-- gh-comment-id:338175530 --> @cuu508 commented on GitHub (Oct 20, 2017): Looks like the virtualenv is not activated. Try this: $ cd ~/webapps $ source hc-venv/bin/activate $ ./manage.py sendalerts For supervisor & systemd you would use a command like this: /root/webapps/healthchecks/hc-venv/bin/python /root/webapps/healthchecks/manage.py sendalerts The above command is using virtualenv's python executable, instead of the system-global python.
Author
Owner

@TheFonix commented on GitHub (Oct 21, 2017):

Yep that fixed it! Can confirm updates are now being sent through discord and email! Thanks man :)

<!-- gh-comment-id:338438449 --> @TheFonix commented on GitHub (Oct 21, 2017): Yep that fixed it! Can confirm updates are now being sent through discord and email! Thanks man :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/healthchecks#95
No description provided.