Getting "incoming_webhook" Configuration for Terraforming Slack Extension

I’m working on Terraforming Slack Extension as seen in


and

And I’m unsure of how to get the values for incoming_webhook block of the configuration (other than using the UI to authorize the slack integration and pulling those from Chrome developer console, or from Terraform plan after the UI change).

Anybody has managed to programmatically get those values, using Terraform or otherwise?

Just an example from one of those posts, this is how the whole config looks like:

 ~ resource "pagerduty_extension" "slack_nbh" {
      ~ config            = jsonencode(
          ~ {
              ~ access_token     = "redacted" -> "xoxp-******-******-******-******"
                bot              = {
                    bot_user_id = "U******1"
                }
                enterprise_id    = null
                incoming_webhook = {
                    channel           = "#fr-******-pagerduty"
                    channel_id        = "C******X"
                    configuration_url = "https://******.slack.com/services/******"
                    url               = "https://hooks.slack.com/services/******/******/******"
                }
                notify_types     = {
                    acknowledge = false
                    annotate    = true
                    assignments = false
                    escalate    = true
                    resolve     = false
                    trigger     = true
                }
                ok               = true
                referer          = "https://******.pagerduty.com/services/******/integrations"
                scope            = "identify,bot,commands,incoming-webhook,channels:read,groups:read,im:read,team:read,users:read,users:read.email,channels:write,chat:write:user,chat:write:bot,groups:write"
                team_id          = "T******Y"
                team_name        = "******"
                urgency          = {
                    high = true
                    low  = true
                }
                user_id          = "U******6"
            }
        )
        extension_objects = [
            "P******7",
        ]
        extension_schema  = "P******R"
        id                = "P******P"
        name              = "MyService103 - #fr-******-pagerduty in ******.slack.com"
    }

In the incoming_webhook block, how do I get channel_id , url and configuration_url

Hi there,

You can get the values for the incoming_webhook block by making a REST API request to the Get an extension endpoint. If you do not know the ID of the Slack extension, you can use the List extensions endpoint to list all of the extensions on your account and locate the ID for the Slack extension as well as the incoming_webhook data.

I hope this helps! Please let me know if you have any questions.

Cheers,

Cassie Champagne
Technical Support Specialist
PagerDuty Support
Be ready for anything in a world of digital everything:
Register now to join us for free at PagerDuty Summit 2021, June 22-25!

Hi Cassie,

If I understand correctly, the Get extension API will allow me to pull channel_id , url and configuration_url after I create and “authorize” the extension to interact with Slack.
I’m looking for a way to create and authorize them with Terraform, so those values wouldn’t be available via the extension API.

Oded

Hello Oded,

You are right. You would need to create the extension in order to pull the ID.

At this time, there isn’t a resource that would enable you authorise the Slack extension with Terraform. However, I have added your voice to a Feature Request round this.

Kind regards,