Hi Anthony,
Note: The config object explored below is an undocumented part of PagerDuty API, so unfortunately it is not fully supported.
You are using the correct endpoint to create extensions, but the config parameter for Slack doesn’t seem to be included in the Request Schema of the developer documentation. I’m guessing it’s because the Request Schema doesn’t include specific extension parameters.
Since you want to re-use the config information, I recommend the following:
- Find the extension ID of the existing Slack extension using the GET /extension endpoint, documented here.
- Retrieve the config object and information by using the GET /extensions/{extension-id} endpoint, documented here.
- Once you have the config object with the Slack information, use the POST /extensions endpoint, documented here, to create the Slack extension.
Below is an object skeleton of the config object which I used to create a Slack extension using the steps above:
"config": {
"restrict": "any",
"notify_types": {
"resolve": true,
"acknowledge": true,
"assignments": true
},
"ok": true,
"scope": "identify,bot,incoming-webhook,channels:read,groups:read,im:read,users:read,users:read.email,chat:write:bot,groups:write",
"user_id": "<SLACK-INFO>",
"team_name": "<SLACK-INFO>",
"team_id": "<SLACK-INFO>",
"incoming_webhook": {
"channel": "#<SLACK-INFO>",
"channel_id": "<SLACK-INFO>",
"configuration_url": "<SLACK-INFO>",
"url": "<SLACK-INFO>"
},
"bot": {
"bot_user_id": "<SLACK-INFO>"
},
"access_token": "<SLACK-ACCESS-TOKEN>"
}
This config object should be a value within the extension
object.
Note that I recommend to copy and paste the config object of an already existing Slack extension to find the Slack information.
I hope this helps, but let me know if you’d benefit from receiving the full request body to create a Slack extension via the API.
Thanks,
Jay