If you try to page a non-existent schedule, or the schedule is marked
'#nopage', or something - the callback spaghetti actually generates a
decent error here. Rather than just spitting out to haystack, we could
send it to the user, and this PR does just that.
Other places in the script do not explicitly construct `new Error()`s,
so I didn't bother working on that. This script is difficult to follow
and I'm hesitant to make broader changes on a whim.
Since user matching is done fuzzily, we might get multiple results for
certain emails. Instead of immediately bailing it, let's check for an
exact match before giving up.
Entries always returns as an array (just sometimes empty) here, so
we'd otherwise never see the response. People might think hubot was
having struggles.
There should be a mostly 1:1 mapping between PD emails and slack handles,
except for one notable, legacy exception that I learned about.
The thought is that this will be more useful to people than just a pagerduty link.
Slack truncates messages around the 8000 character boundary, so we
should take care never to send a message longer than that length.
To do this, we add a chunking function, and send each chunk as a separate
message.
We could alternatively get around this by creating snippets or by using
"Posts" (which I think is relatively new), but this preserves the behavior
of the current integration a little bit better in my opinion.
We can take advantage of Slack's message formatting to make this output
easier to read. Specifically, we can remove the visual noise of the expanded
URLs (and instead linkifiy the name of the schedule), and we can also
easily include a link to the name of the person on-call (which may be useful
when trying to contact that person).
I was going to push this to a branch, but I'm bad at git.
This reverts commit 3b91a1ac0c.
This reverts commit 427e144b6e.
This reverts commit df1ba44188.
Slack truncates messages around the 8000 character boundary, so we
should take care never to send a message longer than that length.
To do this, we add a chunking function, and send each chunk as a separate
message.
We could alternatively get around this by creating snippets or by using
"Posts" (which I think is relatively new), but this preserves the behavior
of the current integration a little bit better in my opinion.
We can take advantage of Slack's message formatting to make this output
easier to read. Specifically, we can remove the visual noise of the expanded
URLs (and instead linkifiy the name of the schedule), and we can also
easily include a link to the name of the person on-call (which may be useful
when trying to contact that person).