-
Notifications
You must be signed in to change notification settings - Fork 417
Open
Labels
discussionM-T: An issue where more input is needed to reach a decisionM-T: An issue where more input is needed to reach a decisionenhancementM-T: A feature request for new functionalityM-T: A feature request for new functionality
Milestone
Description
Description
I would like to log all interactions with Slack so that I can see what gets sent across the wire.
What type of issue is this? (place an x in one of the [ ])
- bug
- enhancement (feature request)
- question
- documentation related
- testing related
- discussion
Requirements (place an x in each of the [ ])
- I've read and understood the Contributing guidelines and have done my best effort to follow them.
- I've read and agree to the Code of Conduct.
- I've searched for any related issues and avoided creating a duplicate issue.
Bug Report
Getting the Request information is fairly easy by doing the following:
// Show Received payload
app.use(async ({ next, payload, body, client, context }) => {
util.prettyJSON(payload, 'RECEIVED (payload): ');
await next();
});However, getting the Response information has been more challenging. So far, I am doing the following, which works, but probably isn't the best way:
const logSent = config => {
util.prettyJSON(config, 'SENT: ')
return config;
}
// Show sent payload
app.client.axios.interceptors.request.use(logSent, error => Promise.reject(error));
app.use(async ({ next, client }) => {
if (client.fixed !== true) {
client.axios.interceptors.request.use(logSent, error => Promise.reject(error));
client.fixed = true;
}
await next();
});I would prefer to do this at a framework level in one place, rather than in each individual listener. Is there a better way?
Reproducible in:
package version: 2.0.1
node version: v13.12.0
OS version(s): Mac 10.15.3
Steps to reproduce:
- Send a request to bot
- Send a response via .say()
- Send a response via api.client.[]
- Send a response via listener's client.[]
Expected result:
- Send a request to bot and log the request
- Send a response via .say() and log the response
- Send a response via api.client.[] and log the response
- Send a response via listener's client.[] and log the response
Metadata
Metadata
Assignees
Labels
discussionM-T: An issue where more input is needed to reach a decisionM-T: An issue where more input is needed to reach a decisionenhancementM-T: A feature request for new functionalityM-T: A feature request for new functionality