zulip / python-zulip-api

Python library for the Zulip API.
https://zulip.com/api/
Apache License 2.0
361 stars 362 forks source link

bridge: Initialize bridge_with_slack. #493

Closed rht closed 4 years ago

rht commented 5 years ago

It works when run on a server where websocket connections aren't blocked. check_zulip_message_validity is copied from bridge_with_matrix, so I think there should be a util library to import all common bridge operations.

timabbott commented 5 years ago

What's the status of this in terms of testing etc? I'd be fine with merging to master and iterating from there assuming someone else has successfully run this (@punchagan have you?).

punchagan commented 5 years ago

I haven't run this after the slackclient was updated. I'll give it another spin and report back.

rht commented 4 years ago

@punchagan I know it is super late to ask, but how was the testing going?

timabbott commented 4 years ago

Just figured I'd post a bump on this thread.

rht commented 4 years ago

I have just updated the PR by removing the sender field from msg_data.

timabbott commented 4 years ago

@punchagan do you have time to test this again?

rht commented 4 years ago

I added 2 commits. One is to update members list to the new API, the other is adding documentation. I wasn't able to test the new bridge because I can't connect using websocket. @timabbott should I not use Slack's websocket feature so that the bridge is more robust?

rht commented 4 years ago

Update: Mirroring messages sent in Zulip into Slack works. But the reverse is hard to do because according to https://github.com/slackapi/python-slackclient#basic-usage-of-the-rtm-client,

Please note that the default way of creating Slack apps no longer supports RTM API. Events using the RTM API must use a classic Slack app (with a plain bot scope).

I am now experimenting with the classic bot. Things surely have change in the past 2 years since this bridge was first written.

rht commented 4 years ago

Now the bridge works with classic bot app, as of July 2020. I have updated the documentation!!

timabbott commented 4 years ago

Posted one comment on the docs; @rht can you also think about which commits should be squashed here?

I'm leaning towards merging this and iterating on it post-master since it's been hard to get someone else to test, and you've put a lot of work into this. Does the bridge work bidirectionally with the current version? Wanted to make sure I understand the remarks above.

rht commented 4 years ago

Does the bridge work bidirectionally with the current version?

Yes, it works bidirectionally.

rht commented 4 years ago

@timabbott I have squashed some of the commits.

maneeshsethi commented 4 years ago

Hey guys! I'm really interested in this feature. I tried to set it up and I couldn't figure out what was going wrong. Do you have any loom/gif/describer to help me install this?

rht commented 4 years ago

@maneeshsethi let's talk at https://chat.zulip.org/#narrow/stream/127-integrations/topic/slack. I'm Rein Zustand if you can catch me online there. To me, the hardest part is in creating the Slack classic bot account. Not even Matterbridge describes how to do this.

Let me know which part of https://github.com/zulip/python-zulip-api/pull/493/files#diff-539431824ef0be4c6375957e3fba57b5R18 is unclear so that I can improve the documentation.

rht commented 4 years ago

@maneeshsethi the more you can provide detail for the trouble, the more I can help debug.

maneeshsethi commented 4 years ago

Hey all. I got it working. No problems on our end. Using now. Anything I can do to help @rht in getting it merged?

I'd love to see a version that lets us map multiple slack channels to multiple zulip streams. A thread in a slack channel, could create a Topic in zulip -- that would be cool.

Possibly can contribute my developer if wanted/necessary. Let me know.

timabbott commented 4 years ago

Merged, thanks @rht! Can you submit a PR for zulip/zulip to add documentation for this? We'll probably want to give this the token slack_bridge for the docs and add cross-links with https://zulip.com/integrations/doc/slack and https://zulip.com/integrations/doc/slack_incoming.

timabbott commented 4 years ago

@eeshangarg can you prepare a python-zulip-api release? There's a bunch of nice changes since the last release.

rht commented 4 years ago

@timabbott I made https://github.com/zulip/zulip/pull/16201. Not sure how to make the documentation to be discoverable though.