Integrating better with third party app

Hi Guys,

I’m going about modifying Mattermost to work within my web app and I’m currently considering ways by which I can do this.

The first question is regarding interacting between the application and mattermost. I can see there’s an API which I’ve already started playing around with, but this doesn’t seem to be intended to be used as a link between a server and Mattermost. Is there some way of interacting without having to deal with auth tokens and the 10 APIs per second limit? Or am I going to have to work around this (remove the limit altogether) etc. etc. etc?

Next up is user management. From what I’ve seen the most obvious way I can do this is is by manually creating a new user in Mattermost, via the endpoint, whenever someone creates/updates/deletes an account in the app. Again, this seems a little improper, so I’m wondering if there’s a better way of using the users from my web app? I’ve considered merging the databases of my site and Mattermost but this will open a huge can of worms.

I’ve been trawling through the documentation to see what the best method for completing this will be, but the project is moving so fast and I’ve never actually used either Go or React so I may well be missing lots.

Any help will be greatly appreciated.

Warm regards,
Mike

Hey Mike

Not a Mattermost developer here, but one that has integrated the APIs to another application. I probably didn’t have the needs that you have (about the limits per second) but trust me, the APIs is the way to go.
You don’t have to use React or Go to use the APIs. Use your programming of choice (in my case that was c#) to make the HTTP requests with the proper method and the proper end point. Once you have it working, it will work every single time.
Because in c# I can use classes, I created classes resembling the objects mattermosts returns in the API. Then it was as simple as using NewtownSoft.Json parser to turn the output into my objects.

For the authentication, there’s no other way around it It’s not that complicated once you put it in some function that you can quickly call at the beginning of your session or when the session expires (to renew the token. Actually I have never experienced a session expiration with the token, so not sure if that’s a thing)

In my case I didn’t create users, but I did create webhooks and slash commands as well as other elements, and again, once you have it in a function, there should be no problem for your app to use as many times as needed.

Thank you very much for the reply. I’ve been playing around with the API all day today and I think you’re absolutely spot on with regards to it being the best way to go about doing what I want to achieve. I can stick to my PHP backend and call the relevant functions as I need to.

I’m still not 100% sure if manually creating/updating/deleting user accounts is the way forward, and I don’t think I can do so with web hooks or slash commands, but we shall see.

Once again thank you kindly for the reply, it’s certainly helped me realise what needs to be done.
Mike

You’ll be able to create users just fine if you need:
https://api.mattermost.com/#tag/users%2Fpaths%2F~1users~1create%2Fpost

One good thing of mattermost is that everything that is done in the user interface (from creating channels to creating users, sending messages, getting notifications, etc) it is all via APIs, so you can build your own UI if you wanted to.

Good luck!

Thank you once again. You’re right, the API seems very comprehensive. I’m going to be running some tests today to see the best way forward for user management.

Thank you again.
Mike