Using Slash Commands

Slash Commands in Slack are used to trigger an action or interaction directly from the message box. These commands act like shortcuts for specific actions. Leveraging on channel specific features, Luma supports Slash commands to trigger skills through Slack.

In order to use Slash command, one should have Slack Channel Configured for your Tenant.

Once Slack channel is configured, follow the below steps to Create and Configure a Slash Commands:

Add User Phrases in Luma Skills

Slash Commands are linked to Luma skills through special utterances or user phrases. These additional user phrases are used by Slash Commands to identify the skill.

For more info on skill creation, refer article Create a Skill .

Follow the below steps to add the utterance to your skill .

  • On Luma Dashboard, Navigate to Skills. Type the Skill name in Search box and hit enter.

  • Click on the record. Skill opens in Edit mode.

  • On Skill details screen-->under Phrases, add a new utterance for the skill. Below format should be followed for the utterance:

<Skill identifier>{<Attribute Identifier 1>:@<Attribute Identifier 1>} {<Attribute Identifier 2> :@<Attribute Identifier 2>} {<Attribute Identifier 3> :@<Attribute Identifier 3>}

For Example, ‘Create_Ticket_Slash_Command’ to create a ticket. The skill requires three attributes: Username, Comments and Language. Below utterance should be added as user phrase:

Create_Ticket_Slash_Command {username:@username} {comment:@comment} {language:@language}

Points to remember:

  • Attributes should be added in right sequence. This means that the attribute sequence in the utterance should be same as the sequence in the Skill builder-->Conversation Parameter

  • No rules should be added to the attributes in the skill.

  • File type attributes(data type) are not supported.

Add the utterance in Phrases and click on Add (+) button or hit Enter. The new utterance will start appearing in the list of Phrases. Click Save.

This phrase should be added to Usage hint on ‘Create New Command’ screen in slack as described in next section.

Create a Slash Command

  • Log in to https://api.slack.com/ and open Workspace/App.

  • Navigate to the Slack API Settings and click Slash Commands.

 

  • Slash Commands Screen now appears on the screen. Click on Create New Command to create a new Slash command.

  • This opens the Create New command screen. Add Command Name and Short Description (Refer below screenshot).

  • Next step is to add Request URL. In Luma, navigate to Bot Configuration-->Channels and open Slack Channel configuration page.

Copy Slash Command Request URL and paste the same in Request URL box in Slack API-Create New Command screen.

 

  • Add Usage Hint. This represents the user phrase that will be used to invoke Luma skill through the new Slash command. The Usage hint is the special user phrase added to the skill in Luma (detailed in previous section). The utterance should be modified before it is added to the Slash command. Follow the below example:

Application

Location

Text

Application

Location

Text

Luma

User Phrase/Utterance

Create_Ticket_Slash_Command {username:@username} {comment:@comment} {language:@language}

Slack

Usage Hint for Slack API-->New Command

Create_Ticket_Slash_Command [username:username] [comment:comment] [language:language]

 

  • Click Save to create the Slash Command.

Database Update

Once a Slash Command is successfully created in Slack, Luma database should be updated with the skill and the slash command utterance. Contact Serviceaide support team with below details to add the slash command into the database:

  • Tenant ID

  • Skill ID

  • User ID

  • Utterance/User Phrase

Executing a Slash Command

  • Log in to Slack using login credentials (https://slack.com/signin).

  • On your Apps Message box, type usage hint added for the slash command created in above step and update with attribute values to execute the Skill.

For example: To execute Slash Command 'LumaCommand', type the command with attribute values in below format and hit enter:

/LumaCommand Create_Ticket_Slash_Command [username: John] [comment: TestComments] [language:English]

Luma skill will be executed and the response will be displayed on the message box.

Attribute Validation

While executing a skill through Slash commands, attributes are validated by Slack. Below validations are performed before the skill is executed:

  • Attribute Name: Each value should be assigned to correct attribute. If attribute name is incorrect, Slack does not identify and assign the value to the attribute. In such a case, below pop up appears prompting the user to manually provide value for the missed attribute.

 

  • Missing Attribute: Correct number of attributes should be added to the utterance when executing a Slash command. If one or more attributes are missed, below pop up appears prompting the user to manually provide value for the missed attribute.

 

 

 

© 2019 Serviceaide 1-650-206-8988 http://www.serviceaide.com info@serviceaide.com