An adapter for Slack’s Events API.
Constructs a new instance of the SlackEventAdapter
class
Parameters:
Name | Type | Required | Description |
---|---|---|---|
signingSecret | string |
✓ | The token used to authenticate signed requests from Slack's Events API. |
opts | EventAdapterOptions |
✗ | See options. |
Options:
Name | Type | |
---|---|---|
includeBody | boolean |
|
includeHeaders | boolean |
|
waitForResponse | boolean |
Name | Type | Description |
---|---|---|
includeBody | boolean |
Whether to include the API event bodies in adapter event listeners. |
includeHeaders | boolean |
Whether to include request headers in adapter event listeners. |
signingSecret | string |
The token used to authenticate signed requests from Slack's Events API. |
waitForResponse | boolean |
When |
Creates an HTTP server to listen for event payloads.
Returns Promise<http.Server>
Returns a middleware-compatible adapter.
Returns RequestHandler
Creates a request listener.
Returns RequestListener
Starts a server on the specified port.
Parameters:
Name | Type | Required | Description |
---|---|---|---|
port | number |
✓ | The port number to listen on. |
Returns Promise<http.Server>
Stops the server started by SlackEventAdapter
.
Returns Promise<void>
Creates a new SlackEventAdapter
.
Parameters:
Name | Type | Required | |
---|---|---|---|
signingSecret | string |
✓ | |
options | EventAdapterOptions |
✗ |
Returns SlackEventAdapter
Verifies the signature of a request. Throws a CodedError
if the signature is invalid.
See Verifying requests from Slack for more information.
Parameters:
Name | Type | Required | |
---|---|---|---|
opts | VerifyRequestSignatureParams |
✓ |
Options:
Name | Type | Description |
---|---|---|
body | string |
Full, raw body string. |
requestSignature | string |
Signature from the |
requestTimestamp | number |
Timestamp from the |
signingSecret | string |
The signing secret used to verify request signature. |
Returns true
:
true
when the signature is valid.
A dictionary of codes for errors produced by this package.
All errors produced by this package are regular Error objects with an extra CodedError
field.
Name | Type | Description |
---|---|---|
code | ErrorCode |
What kind of error occurred. |
Options when constructing SlackEventAdapter
. See SlackEventAdapter
’s fields for more information on what each option does.
Name | Type | |
---|---|---|
includeBody | boolean |
|
includeHeaders | boolean |
|
waitForResponse | boolean |
Parameters for calling verifyRequestSignature
.
Name | Type | Description |
---|---|---|
body | string |
Full, raw body string. |
requestSignature | string |
Signature from the |
requestTimestamp | number |
Timestamp from the |
signingSecret | string |
The signing secret used to verify request signature. |