Add suggestion / autocompletion webhook setting

Sorry, I’m kind of lost on deciding which tool to use, so I posted my idea here and here

Here is the description:

I’ve set a outgoing webhooks triggered by “$”, then sended text is parsed by my bot, and runs according command.
ie: “$start 1234” runs “start” command with “1234” args.

Autocomplete hook could work like this:
I enter “$st” and press tab, the hook is triggered, sends current text to the bot and the response populates the autocomplete list with something like [{command: […], description: […]}, […]] and whatever needed by the list.

What do you think ?

If nobody is interested by this feature, maybe someone can give me hints on how to do this ?
I’ll be glad to submit a pull request, but I dont know golang or react…

1 Like

Hi @kernicPanel, highly appreciate the idea!

It’s an interesting use case and I expect it will garners some upvotes and discussion among the community,

You’ve also illustrated that our process for requesting features was ambiguous among the feature idea forum, GitHub issues and, so we’ve updated our community process for this.

So for a feature of this complexity (design of an API), the feature ideas forum for upvotes coupled with here on the for discussion, under feature ideas, is the right combination: Add suggestion / autocompletion webhook setting

In terms of feedback on the feature itself, some thoughts:

  1. You can look at the auto-complete code for adding “in:” and “from:” modifiers in search.

  2. You can look at /loadtests slash command for some of the logic around auto-complete–but the warning here is that code pre-dates Mattermost (it was from our original game portal written in Django, and is due to be refactored at some point).

In terms of the API support, propose we start by hearing from the community on their thoughts,

Help me understand this idea of yours fully. Is this feature primarily for talking to bots? Seems like with all the auto-complete and the tabbing you’ll be a human talking only in templates.

@sanchit I don’t get what you mean with “Seems like with all the auto-complete and the tabbing you’ll be a human talking only in templates.”, but I’ll try to explain what I have in mind.

At work, we use a bot connected to slack (through custom slashcommands and incoming hooks) and redmine (through custom api)
In our commmads we have one for quickly assign issues: /assign <issueId> <slackuser>
For now /assign and <slackuser> are completed with tab, but <issueId> has to be copy/pasted or typed.
But I wanted a more flexible and user friendly solution.
So This idea came up.

What I want to describe is more a bot command line builder, and by “autocomplete”, I mean suggestion + completion.
I will call it SC for brevity.

Let’s say you added an SC webhook triggered by $ and an url for your bot.
The bot has (at bare minimum) your mattermost nickname, and your github api key.
If your message input begins with $, and tab key is pressed, a request to the SC webhook is send with all data contained in a regular outgoing one (username, channel, etc).

The assign command could look like this:
$assign <issueId> <githubUserName>
Without SC, this command is painful, because you have to know the issue number, and the user name.
With SC, the following sequence may happen:

user message:


Your bot receive this, recognizes you, and sends you back all the commands you are allowed to and begining with a.
Something like:

  {command: 'assign', description: 'Assign <issue> to <user>'},
  {command: 'addComment', description: 'Add comment to <issue>'},

Of course, ‘assign’ will only show up if you have permission.
By selecting assign, and press enter, the whole message input is replaced by the value of ‘command’ key.

All that follows is only bot logic, but it illustrates the point of this idea.
user message:

$assign [tab]

The bot calls github (or uses internal cache system) and sends you back all issues with the form

  {command: 'assign 1207', description: 'Assign Idea/Proposal to change channel layout'},
  {command: 'assign 1185', description: 'Assign [Help wanted]: testing Debian Jessie deployment instructions'},

Once again, selecting a command replaces user input.

user message:

$assign 1207 [tab]

Shows all contributors:

  {command: 'assign 1207 it33', description: 'Assign Idea/Proposal to change channel layout to it33'},
  {command: 'assign 1207 coreyhulen', description: 'Assign Idea/Proposal to change channel layout to Corey Hulen'},

Selecting and pressing enter triggers the outgoing hook, and your user had assigned issue 1207 to it33.

Just one last to show more powerful application with multiple suggestions at once (again, it’s “only” bot logic)

$assign layout h[tab]
  {command: 'assign 1207 hmhealey', description: 'Assign Idea/Proposal to change channel layout to Harrison Healey'},
  {command: 'assign 1208 hmhealey', description: 'Assign proposal/demo different layout to Harrison Healey'},
  {command: 'assign 1207 coreyhulen', description: 'Assign Idea/Proposal to change channel layout to Corey Hulen'},
  {command: 'assign 1208 coreyhulen', description: 'Assign proposal/demo different layout to Corey Hulen'},

One simple implementation I have in mind, is a checkbox setting on outgoing hook.
If this box is checked, pressing tab with the matching hook trigger, sends request to the hook url with an aditional param (like {suggest: true}).
If the bot sends back an array of multiple objects, they are showed in the list.
If the response is an array with a single object, message input is replaced.

Sorry for this long post, and my english, but I hope I make it more clear on what SC will make possible.

This makes perfect sense to me now. The long post was extremely helpful. Thanks!

WIP here, comments and ideas are welcome.

I tried another approach here.
Feedbacks welcome :slightly_smiling: