zulip / python-zulip-api

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

Add integration with Confluence. #514

Open mayankmadan opened 5 years ago

mayankmadan commented 5 years ago

Fixes: 5142

Made some changes to the original PR by @paras112 Also made the script executable since its a cronjob.

@eeshangarg Can you have a look at it? Confluence

mayankmadan commented 5 years ago

@eeshangarg I have made some changes to the content of the message that will be posted when a new page is created. I wanted to get your opinion on it. I was thinking of further formatting 'created_at'. But before doing that I wanted to ask you if the extra information is worth the extra request sent

timabbott commented 5 years ago

Can you provide more details on the question about created_at, maybe with an example + screenshot? Not sure what the product question is.

mayankmadan commented 5 years ago

Can you provide more details on the question about created_at, maybe with an example + screenshot? Not sure what the product question is.

@timabbott I'm sorry about that question. At first I somehow missed the 'expand' GET parameter mentioned in the Confluence API's documentation and thought I needed to send a separate request to another endpoint to fetch the author name and 'created_at'. I changed that in the latest commit.

eeshangarg commented 5 years ago

@mayankmadan: This looks good to me. I would recommend addressing my latest comments and once we get a thumbs up from @timabbott, I think we can merge this.

But before we merge it, could you please open a PR that documents this integration in the main repo? That would be great! Thanks! :)

mayankmadan commented 5 years ago

@eeshangarg @timabbott, Right now, the bot needs to be a generic bot as it needs to get the list of streams to which the bot is subscribed to so the updates are sent on those streams. But since the permissions system for bots isnt great right now (on which I really want to work on) I was wondering if this could be made into an incoming webhook bot and the list of streams can be provided in config file

timabbott commented 5 years ago

@mayankmadan can you explain precisely why it needs that list? I would imagine there would need to be configuration somewhere determining where in Zulip to send messages from Confluence, but I would imagine we'd just want that to be e.g. a small function in the configuration file that the user writes, not something that involves pulling data from the Zulip server. (A list of subscribed streams, which is what one would get from Zulip, wouldn't encode the mapping the user wants of (Confluence article -> Zulip stream+topic).

mayankmadan commented 5 years ago

Right now, for the bot to function, the user must subscribe it to a stream so the bot knows in which stream to post the updates. The topic inside the stream is just the title of the new page created. Thats why it needs the list of subscribed streams. Also, the stream wouldn't change depending on the Confluence article; only the topic would. So I was thinking to maybe change that so it doesn't have to pull the list of subscribed stream from Zulip API and just provide it the list through the config file.

PIG208 commented 3 years ago

I think the whole concept of this bot makes it more suitable to be an incoming webhook that can be integrated into the server. It appears that confluence has added support to it in https://jira.atlassian.com/browse/CONFSERVER-52487. But I can't find any relevant documentation for it.

It might be unnecessary to stick with the "subscribe and send messages to subscribed streams" model. I think it should be totally sufficient to have the user hardcode the desired stream to receive notifications for in the config file. We should be able to merge this after tweaking the configuration a little bit and make sure it works with the current version of their REST API.