We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

Child pages
  • WHM API 1 Functions - verify_slack_access
Skip to end of metadata
Go to start of metadata

Description

This function verifies the connection to a Slack® WebHook.

You can specify Slack accounts in the Contact Information section of WHM's Basic WebHost Manager Setup interface (Home >> Server Configuration >> Basic WebHost Manager Setup).

Examples 

 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/verify_slack_access?api.version=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/verify_slack_access?api.version=1
 Command Line
whmapi1 verify_slack_access


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
	"metadata": {
		"command": "verify_slack_access",
		"reason": "OK",
		"result": 1,
		"version": 1
	},
	"data": {
		"results": [{
			"result": {
				"payload": {
					"content": "ok",
					"success": "1",
					"url": "https://hooks.slack.com/services/ABCDEFGHIJ/ABCDEFGHIJ/ABCDEFGHIJKLMNOPQRSTUVWXYZ",
					"protocol": "HTTP/1.1",
					"reason": "OK",
					"headers": {
						"x-slack-backend": "h",
						"referrer-policy": "no-referrer",
						"content-type": "text/html",
						"x-via": "haproxy-www-xccr",
						"strict-transport-security": "max-age=31536000; includeSubDomains; preload",
						"vary": "Accept-Encoding",
						"access-control-allow-origin": "*",
						"x-frame-options": "SAMEORIGIN",
						"date": "Fri, 22 May 2020 15:15:47 GMT",
						"server": "Apache",
						"transfer-encoding": "chunked"
					},
					"status": "200"
				},
				"message_id": "Z6I2"
			},
			"url": "https://hooks.slack.com/services/ABCDEFGHIJ/ABCDEFGHIJ/ABCDEFGHIJKLMNOPQRSTUVWXYZ"
		}]
	}
}


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
resultsarray of hashes

The payload from the Slack server.

For more information, visit Slack's WebHooks documentation.



Slack will return

Note:

If the Contact Information section of WHM's Basic WebHost Manager Setup interface (Home >> Server Configuration >> Basic WebHost Manager Setup) contains multiple Slack WebHooks, the function will return an array that contains the results for each WebHook.