-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate Actions with Slack #105
Comments
In reality, I think this is a ticket to "call any integration if a certain action is triggered". This is going to require a couple of things:
|
Hi everyone! After having a look at this task, there are a few things we can do here. I'll list the options here along with my suggestions. 1. How to integrate with Slack.At the end of the day, PostHog should get an "incoming webhook url" from Slack (something like https://hooks.slack.com/services/TTTTT/BBBBBB/gibberishcode) and just POST the messages there. To get this URL there are two options: Option 1: Every man for himself (same for every woman) - incoming webhooks For each instance of posthog that you manage, you go to https://api.slack.com/apps?new_app=1 and create a new app. You will probably call the app "PostHog" or "HogBot" or "PostBot" or "Sonic the HedgeHapp" and then upload a cute logo to go with it. Then you open the page "incoming webhooks" and click the "add a new webhook" button. In the dialog that opens you select the channel the webhook will be post to: You then get a webhook URL that you copy to the /setup page on PostHog. This will then be stored on the Option 2: OAuth and magic - slack buttons The second option has more steps, but looks best for the end user... if the end user is using the hosted app. It gets tricky if we factor in self-hosting. What we need in this case is to 1) make a new slack app like above, 2) give posthog the client ID and the client secret. These client ID and secret should then be stored per app, not per team. Then you go to /setup and click on a "Add to Slack" button. This will open a modal similar to the one from the step above that will ask you to choose the channel. Selecting it will send a response pack to the app, which will get a token.. and using that will get the webhook url. This webhook url should then again be stored on the ... For now I implemented option 1 (PR #460), as at the end of the day we will anyway need to store the webhook url on the team. However for the hosted app.posthog.com instance, this will require the end user to jump through more hoops than they should and we should think of what to do with option 2. For now I implemented a very naïve approach that just posts everything without any rate limiting or background workers. The steps implemented:
... Any questions regarding the implementation so far? I have some myself:
Things still to do:
|
Thanks for getting the quick version live! Re option 2, I'd have thought we could create a 'global' slack service, that users' self-hosted versions could post to, to run as its own service. That way we could make it feel like a one click button. The downsides I'd see would be:
The advantages:
|
Let's just get this out as is and see if people use this. I'll comment a few small tweaks in the PR. |
Hi all, this is starting to take shape. @timgl and @jamesefhawkins , if you have and feedback please let me know! What's implemented now.
At the end of the day, every integration will require a webhook of some sort, so it's the obvious starting point. We can make finding and fetching this webhook more automatic in the future.
(The checkbox is also there when you don't have slack integrated, just grayed out)
Currently it only shows the distinct ID of the user... not even the name or anything. This is still to come! Questions
I was thinking of automatically doing it if Slack returns with "invalid_token", "team_disabled" or any of the other permanent errors. However should be somehow inform the user/admin about this? Either via SMTP or should we have somewhere a "system log" where the user/admin gets messages, alerts, etc?
We can't expect all users to want to do this. If you're self-hosting, you might want to do it for privacy reasons, but I'm sure even some self-hosted people would prefer a nicer interface. What we can do are: |
This is very cool! To answer your questions:
|
Great! PR #460 should be done then. I also added the documentation here: PostHog/docs#6 |
Done! |
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: