Commit Graph

7 Commits

Author SHA1 Message Date
Alex Vandiver eb3674362a slack_incoming: Verify that keys exist before checking their value. 2022-11-29 16:34:16 -08:00
Hari Prashant Bhimaraju fd0b013bcd slack_incoming: Handle optional attachment fields aptly.
This commit checks for null values for keys within "attachment" in
the Slack integration's incoming payloads. These keys were expected
to exist optionally previously, and the existence of null values for
these wasn't anticipated. Due to an issue report for such null
values in the payload, their handling is updated appropriately.

The checks for these values are truthiness checks since the strategy
for these values being null or falsy ("", 0) is the same; we don't
process that key-value pair. This is consistent with how Slack handles
this scenario.

For the case where all the attachment fields have null values, Slack
displays this as an empty block with no content, and therefore our
strategy for this is a no-op.

Tests updated.
2022-08-22 16:40:13 -07:00
Alex Vandiver bc25f016fc slack_incoming: Support more syntax.
This significantly extends the accepted support for Slack "blocks"[1], as
well as their legacy "attachments"[2] syntax.

Fixes: #21944.

See also #22228, which this does not solve, but assuming we can decide
which compromises to make, becomes a reasonably uncomplicated follow-up.

[1]: https://api.slack.com/reference/block-kit/blocks
[2]: https://api.slack.com/reference/messaging/attachments
2022-06-28 17:04:53 -07:00
Alex Vandiver 0511400d73 slack_incoming: Handle null blocks and attachments.
This is not accepted according to Slack's block-builder, but is
attested in the wild.
2022-06-28 17:04:53 -07:00
Alex Vandiver 43f3f9221d slack_incoming: Handle explicit None text payload in webhook. 2021-07-15 09:37:39 -07:00
akshatdalton 8d158852fd webhooks/slack_incoming: Update regex to correctly convert emphasis.
This was a bug where we were converting _text_ to **text**.
For emphasis we use the *text* format.
2021-06-24 09:43:32 -07:00
Chris Heald c80e913c7a webhooks: Add a webhook capable of parsing Slack payloads.
This adds a webhook that can be used to interpret standard Slack
payloads. Since there are a ton of existing Slack integrations out
there, having a webhook which can accept standard Slack payloads can
significantly ease transition pains. Obviously this can't do everything
that Slack payloads can (particularly WRT their widgets/interactions),
but we can ingest text and parse out multi-block payloads into a message
relatively reasonably.
2020-05-11 00:07:28 -07:00