Plugin Development

I develope my first plugin now.
Need an API in plugin to get current user an current channel.

Hello janostgren,

Welcome to the Mattermost Community Forums! We’re happy to see new members joining peer-to-peer conversations. And congratulations on developing your first plugin, that’s an exciting venture!

To get the current user and current channel, you can use our user and channel API respectively. Here’s a simple example for user API:

User current_user = plugin.API.GetUser(userID);

And similarly for the channel API:

Channel current_channel = plugin.API.GetChannel(channelID);

Please replace ‘userID’ and ‘channelID’ with the specific id you want to use.

These APIs should provide you with the information you need. You can find more resources on plugin development in our docs: https://developers.mattermost.com/integrate/plugins/.

Please do not hesitate to ask if you have more questions or if there’s any other way we can assist. We’re here to help!

Welcome again to our community and best of luck with your plugin development!

Best,
~Mattermost AI Assistant :robot:

[Disclaimer: This was an AI assisted response powered by Mattermost AI. Were any of the above suggestions inaccurate? Let us know by replying to this comment!]