Slack slash command — i'd like to pass values with the command

slack
incidents

(Keith Dixon) #1

Hi community — i’m trying to create the ability to create pagerduty incidents in Slack with a slash command, and have succeeded in that.

But I’m reaching for something much more specific — I need to be able to pass values with that command to do one of the following:

  1. pass “/page [team name]” to kick off a pagerduty incident with a specific team, or
  2. pass “/page [@person name]” to kick off a pagerduty incident assigned to a specific pd user

can anyone guide me on how to pass those values correctly to pagerduty and have pd initiate the incident in kind?

thanks so much!


(Simon Fiddaman) #2

I think the slash command is bound to a specific Integration and therefore service. I don’t think that you can specify it as a keyword. The bit after the slash command is sent as the Incident description.


(Nick) #3

Hey Keith,

The slash command can only trigger incidents and will only take the input after the command as part of the incident’s description at this time.

You can read more about it here:

But I’d be happy to put in a feature request for you to see if we can build a change on our side!

Let me know!


(Keith Dixon) #4

thank you for your reply, nick — i deeply appreciate.

i would like to make a use-case for passing either team values or direct-user values along with the page-initiate action.

if i could only get one, i’d ask for the team value.

here’s how i’m hoping you can convince product to build this: if you give any large-user-base company this tool, you will be giving them the ability to initiate a specific-team pagerduty incident with no context-switching. this will allow user support teams to initiate and route incidents in one action without leaving their support channels.

this tooling will allow organizations to adopt pagerduty as their escalation tool. now, because context switching is required, there is no incentive to move away from their current approach (which may be jira, service desk, etc.)

please consider building this! thanks!


(Nick) #5

No problem Keith! Always happy to help.

Out of curiosity, is there another example you could give that I could point our engineers to as a baseline? Can you do something similar with Slack with another integration?


(Keith Dixon) #6

sure! i mean, it’s not a terrific “work” example, but try

/giphy soccer goal

or something…you’re passing a variable/parameter that slack and giphy work together to honor. giphy and slack will even offer to “try again” if you don’t like what it supplies.


(Nick) #7

Oo, yes, we use the giphy command a lot here too, haha.

I’ll bring this to engineering/product and we’ll see what we can do! Thanks again!


(Keith Dixon) #8

wonderful, thanks!


(Simon Fiddaman) #9

I don’t think “Team” is going to be a useful addition as that’s just a group of Users with visibility rules, not an assignable Service, Escalation Policy or Schedule.

The only thing that makes sense is “Service” or “User” and that would mean you have to know what the Service is called, it couldn’t have spaces in the name, etc.

Unless it’s going to be implemented as an auto-complete thing (like selecting a Slack Member or Channel when you @ or #), which isn’t possible with Slack Slash Commands, I don’t personally see this as even being possible.

Maybe a button-based response tree using https://api.slack.com/docs/message-buttons would work, where it responds with similarly named Services and you keep pressing buttons until you find the right one.

Otherwise you’re probably looking at implementing your own Slack bot which understands formatted messages and proxies the request to PagerDuty given enough information.

Cheers,
Simon


(Chris Lloyd) #10

I think a first version of this could just fail if it can’t find the service / username.

I just wanted to +1 how useful this would be.


(Keith Dixon) #11

well, no, each team can have its own on-call schedule (configuration > schedules), so pagerduty would simply kick off a new incident which would naturally kick off notification for the person identify as being on call for that particular team. so with one command from slack ("/page autheam") you are kicking off an incident for the on-call person identified in the authteam schedule.


(Simon Fiddaman) #12

My Teams each have multiple Schedules and Escalation Policies, and Incidents have to belong to a Service. Sounds like what you actually want is a Slackbot which implements very specific logic for your situation.

We have a Slackbot who will tell you who is on call based on our internal code words which we maintain our own mapping for, and it could be extended to eg include buttons which would create Incidents against a specific Service which that individual is On-call for.

Cheers,

Simon


(Simon Fiddaman) #13

Did you know RigD has a Slackbot with a tight PagerDuty integration?

I suspect this gives you the functionality you want and it works because it’s a two-way integration with a logic engine in the middle, whereas Slack Slash Commands are one-way (and don’t convert the following message to variables because how could it?).


(Justin Griffin) #14

Hey there quick update on our RigD Get on call.
Based on some user feedback we added support for getting on call for both a service and a team. It’s an NLP based interface so it will handle services with spaces and such, of course there’s no auto complete so you still need to know the correct service or team name.
RigD is free for basic PagerDuty activities like acknowledge, assign, resolve incidents, run response plays, add notes and status, as well as get on call. Would love to get more feedback to continue to improve this function if you can spare 5 minutes to deploy it and give it a try.
RigD is available from the Slack App Directory


(Simon Fiddaman) #15

@KeithDixon - maybe the RigD bot will work for you? Looks pretty close to what you were asking for.


(Keith Dixon) #16

@JustinGriffin @simonfiddaman yes! sounds like this is what i need.

but can you help me clarify the process of install?

i get that i need to go into my slack workspace and enable rigd.

but can you please tell me how i then notify the rigd bot in that slack workspace which pagerduty account it is querying? sounds like we are close, i just need to close the loop on that last step.

thank you!!


(Keith Dixon) #17

in my test environment right now i’m getting this response:


(Justin Griffin) #18

Were you able to get it setup Keith?


(Keith Dixon) #19

i’ve completed the rigd integration via API key, and “add new.”

now my challenge is getting it to recognize my stated pagerduty on-calls – i have a team called “scoop” but the bot if failing to see the team/person i’ve slated as on-call for that team:


(Justin Griffin) #20

So there is an even easier way to do test this. try “list pagerduty teams” and you should see a list of all your teams. For each team there will also be a button to get the on call schedules. Hopefully that works, please let me know.