@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:
$a[tab]
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.