-
-
+ formikHelpers.setSubmitting(false);
+ if (response.ok) {
+ if (refreshSlackBot) {
+ refreshSlackBot();
+ }
+ const responseJson = await response.json();
+ const botId = isUpdate ? existingSlackBotId : responseJson.id;
+ setPopup({
+ message: isUpdate
+ ? "Successfully updated Slack Bot!"
+ : "Successfully created Slack Bot!",
+ type: "success",
+ });
+ router.push(`/admin/bots/${encodeURIComponent(botId)}`);
+ } else {
+ const responseJson = await response.json();
+ const errorMsg = responseJson.detail || responseJson.message;
+ setPopup({
+ message: isUpdate
+ ? `Error updating Slack Bot - ${errorMsg}`
+ : `Error creating Slack Bot - ${errorMsg}`,
+ type: "error",
+ });
+ }
+ }}
+ enableReinitialize={true}
+ >
+ {({ isSubmitting, setFieldValue, values }) => (
+
- )}
+ )}
- {!isUpdate && (
-
- Please enter your Slack Bot Token and Slack App Token to give
- Danswerbot access to your Slack!
+ {!isUpdate && (
+
+
+ Please refer to our{" "}
+
+ guide
+ {" "}
+ if you are not sure how to get these tokens!
+
+ )}
+
+
+
+
- )}
-
-
-
-
-
-
- )}
-
-);
+
+ )}
+
+ );
+};
diff --git a/web/src/app/admin/bots/[bot-id]/channels/SlackChannelConfigCreationForm.tsx b/web/src/app/admin/bots/[bot-id]/channels/SlackChannelConfigCreationForm.tsx
index 811bad4081af..9a8caad2ad5c 100644
--- a/web/src/app/admin/bots/[bot-id]/channels/SlackChannelConfigCreationForm.tsx
+++ b/web/src/app/admin/bots/[bot-id]/channels/SlackChannelConfigCreationForm.tsx
@@ -261,10 +261,12 @@ export const SlackChannelConfigCreationForm = ({
-
+
{showAdvancedOptions && (
@@ -369,7 +371,7 @@ export const SlackChannelConfigCreationForm = ({