RegisterService.ts 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. import { WebClient, LogLevel } from '@slack/web-api';
  2. import { generateInputSectionBlock } from '@growi/slack/src/utils/block-creater';
  3. export const openRegisterModal = async(body:{[key:string]:string}) : Promise<void> => {
  4. const client = new WebClient('', { logLevel: LogLevel.DEBUG });
  5. await client.views.open({
  6. trigger_id: body.trigger_id,
  7. view: {
  8. type: 'modal',
  9. title: {
  10. type: 'plain_text',
  11. text: 'Register Credentials',
  12. },
  13. submit: {
  14. type: 'plain_text',
  15. text: 'Submit',
  16. },
  17. close: {
  18. type: 'plain_text',
  19. text: 'Close',
  20. },
  21. blocks: [
  22. generateInputSectionBlock('growiDomain', 'GROWI domain', 'contents_input', true, 'https://example.com'),
  23. generateInputSectionBlock('growiAccessToken', 'GROWI ACCESS_TOKEN', 'contents_input', true, 'jBMZvpk0buKsZy9wSYJF6ZVefaedzh5Q883q+yoBrea='),
  24. generateInputSectionBlock('proxyToken', 'PROXY ACCESS_TOKEM', 'contents_input', true, 'IOKufkjs0buKsZy9wSYWE6ZVS5Jdzh5Q883q+yoB4F0='),
  25. ],
  26. },
  27. });
  28. };