Very good question! Mattermost has many different integration points and this page will help you pick the right one(s) for the job.
If you only want to post messages into a Mattermost channel, then all you need is an incoming webhook.
Tracking what gets posted into a channel and receiving real-time events about it can be done using outgoing webhooks. You can also respond to messages with outgoing webhooks.
If you want your users to be able to trigger actions from within Mattermost, adding your own custom slash command will do the trick.
That’s not enough? You can include interactive messages in posts from your slash commands, as well as from incoming and outgoing webhooks.
To build a richer bot integration, you can make full use of the Mattermost REST API. Everything that you see a Mattermost client doing, your integration can do too with this API.
Good news! You can mix and match as many of these integration points you like to suit your needs. The choice is yours.
If these integration points aren’t enough for what you had in mind, then take a look at plugins. They are very powerful and offer the ability to extend Mattermost in ways that integrations can’t.