diff --git a/Common/Server/Utils/Workspace/Slack/Slack.ts b/Common/Server/Utils/Workspace/Slack/Slack.ts index 6f08c85839..31c4feacf8 100644 --- a/Common/Server/Utils/Workspace/Slack/Slack.ts +++ b/Common/Server/Utils/Workspace/Slack/Slack.ts @@ -60,6 +60,10 @@ export default class SlackUtil extends WorkspaceBase { Authorization: `Bearer ${data.authToken}`, ["Content-Type"]: "application/x-www-form-urlencoded", }, + { + retries: 3, + exponentialBackoff: true, + }, ); logger.debug("Response from Slack API for getting user info:"); @@ -122,6 +126,10 @@ export default class SlackUtil extends WorkspaceBase { Authorization: `Bearer ${data.authToken}`, ["Content-Type"]: "application/json", }, + { + retries: 3, + exponentialBackoff: true, + }, ); if (result instanceof HTTPErrorResponse) { @@ -202,6 +210,10 @@ export default class SlackUtil extends WorkspaceBase { Authorization: `Bearer ${data.authToken}`, ["Content-Type"]: "application/x-www-form-urlencoded", }, + { + retries: 3, + exponentialBackoff: true, + }, ); logger.debug("Response from Slack API for archiving channel:"); @@ -245,6 +257,10 @@ export default class SlackUtil extends WorkspaceBase { Authorization: `Bearer ${data.authToken}`, ["Content-Type"]: "application/x-www-form-urlencoded", }, + { + retries: 3, + exponentialBackoff: true, + }, ); logger.debug("Response from Slack API for joining channel:"); @@ -301,6 +317,10 @@ export default class SlackUtil extends WorkspaceBase { Authorization: `Bearer ${data.authToken}`, ["Content-Type"]: "application/x-www-form-urlencoded", }, + { + retries: 3, + exponentialBackoff: true, + }, ); logger.debug("Response from Slack API for inviting user:"); @@ -449,6 +469,10 @@ export default class SlackUtil extends WorkspaceBase { Authorization: `Bearer ${data.authToken}`, ["Content-Type"]: "application/x-www-form-urlencoded", }, + { + retries: 3, + exponentialBackoff: true, + }, ); logger.debug("Response from Slack API for getting channel info:"); @@ -519,6 +543,10 @@ export default class SlackUtil extends WorkspaceBase { Authorization: `Bearer ${data.authToken}`, ["Content-Type"]: "application/x-www-form-urlencoded", }, + { + retries: 3, + exponentialBackoff: true, + }, ); logger.debug("Response from Slack API for getting all channels:"); @@ -779,6 +807,10 @@ export default class SlackUtil extends WorkspaceBase { Authorization: `Bearer ${data.authToken}`, ["Content-Type"]: "application/json", }, + { + retries: 3, + exponentialBackoff: true, + }, ); logger.debug("Response from Slack API for sending message:"); @@ -853,6 +885,10 @@ export default class SlackUtil extends WorkspaceBase { Authorization: `Bearer ${data.authToken}`, ["Content-Type"]: "application/x-www-form-urlencoded", }, + { + retries: 3, + exponentialBackoff: true, + }, ); logger.debug("Response from Slack API for creating channel:"); @@ -1233,6 +1269,10 @@ export default class SlackUtil extends WorkspaceBase { Authorization: `Bearer ${data.authToken}`, ["Content-Type"]: "application/x-www-form-urlencoded", }, + { + retries: 3, + exponentialBackoff: true, + }, ); if (response instanceof HTTPErrorResponse) { @@ -1297,6 +1337,10 @@ export default class SlackUtil extends WorkspaceBase { Authorization: `Bearer ${data.authToken}`, ["Content-Type"]: "application/x-www-form-urlencoded", }, + { + retries: 3, + exponentialBackoff: true, + }, ); logger.debug("Response from Slack API for getting channel members:"); @@ -1373,17 +1417,25 @@ export default class SlackUtil extends WorkspaceBase { logger.debug(data); const apiResult: HTTPResponse | HTTPErrorResponse | null = - await API.post(data.url, { - blocks: [ - { - type: "section", - text: { - type: "mrkdwn", - text: `${data.text}`, + await API.post( + data.url, + { + blocks: [ + { + type: "section", + text: { + type: "mrkdwn", + text: `${data.text}`, + }, }, - }, - ], - }); + ], + }, + undefined, + { + retries: 3, + exponentialBackoff: true, + }, + ); logger.debug("Response from Slack API for sending message via webhook:"); logger.debug(apiResult);