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 channel specific features, Luma supports Slash commands to trigger your skills through Slack.
To use Slash command to trigger Luma skills via Slack, you should have Slack Channel Configured for your Tenant.
Once Slack Configuration is done, follow the below step by step process to Create and Configure a Slash Command:
Create a Skill in Luma
Before creating a Slash command, we create a Skill in Luma to be executed through Slash Commands in Slack. This skill is same as any other skill created in Luma but with an additional utterance or user phrase to identify a call using Slash commands. Refer article to Create a Skill .
Follow the below steps to add the utterance for Slash command.
On Luma Dashboard, Navigate to Skills and search for the skill you would like to execute using slash command. Type the skill name in Search box and hit enter.
On Skill details screen, add a new utterance for the skill under Phrases. Below is the format 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, let us add the below utterance to a sample Luma skill (Create_Ticket_Slash_Command) built to create a ticket.
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 to save changes.
This phrase should be added to Usage hint on Create New Command screen as described in next section.
Create a Slash Command
Log in to https://api.slack.com/ and open your 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 open 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.
Next step is to 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 |
---|---|---|
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 your account (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 luma 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.
Add Comment