grimoirelab-perceval
grimoirelab-perceval copied to clipboard
[mattermost] Required parameter should be channel Id
The help text of Mattermost backend mentions the required parameter as Channel name. https://github.com/chaoss/grimoirelab-perceval/blob/5b4f848989967a51a4e21be1a3f6277f009f16ad/perceval/backends/core/mattermost.py#L466
However, going through the source code and mentioned example in the Perceval documentation I think the required parameter is channel id
.
I would also like to suggest an alternative. We can use the following API to get a list of channels and match the channel name to retrieve the channel id(as done in groups.io and gitter): https://api.mattermost.com/#tag/channels/paths/~1channels/get
I would also like to suggest an alternative. We can use the following API to get a list of channels and match the channel name to retrieve the channel id(as done in groups.io and gitter): https://api.mattermost.com/#tag/channels/paths/~1channels/get
That's an option but when we created this backend it was based on the slack backend, so they have the same parameters to execute them. I understand that to get the id of the channel is an extra step, though.
Also, I'm not sure if the name of a channel can change. I guess they can so not sure how the other parts of the GrimoireLab stack would work if this is the case. It's something to take into account.
Thank you for the reply @sduenas
The identifier for the channel is visible in the URL itself hence it is easy for anyone to setup up Perceval backend of Slack. On the other hand, to get ID of a channel in Mattermost I had to go to {channel_name} -> view info
, which gave me the below details.
Also, I'm not sure if the name of a channel can change. I guess they can so not sure how the other parts of the GrimoireLab stack would work if this is the case. It's something to take into account.
You can rename the channel as well as the URL where the channel lies, going to {channel_name}-> rename channel
. Doing this, however, does not change the channel ID.
NOTE:
-
Even slack has an API to get the list of channels:https://api.slack.com/methods/conversations.list. However, since the channel ID is itself very visible I don't think it's necessary to use this extra step.
-
The required parameter for Slack is
channel identifier
. In case we do not go for the above alternative we should align the parameter help text in Mattermost backend with Slack backend. https://github.com/chaoss/grimoirelab-perceval/blob/5b4f848989967a51a4e21be1a3f6277f009f16ad/perceval/backends/core/slack.py#L487.