register.ts 899 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { WebClient, LogLevel } from '@slack/web-api';
  2. import { parse } from '../utils/slash-command-parser';
  3. export const openModal = async(body) => {
  4. const client = new WebClient('xoxb-1399660543842-1848670292404-huKeykaKhdyLyBqTiVlMxqY8', { 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: 'My App',
  12. },
  13. close: {
  14. type: 'plain_text',
  15. text: 'Close',
  16. },
  17. blocks: [
  18. {
  19. type: 'section',
  20. text: {
  21. type: 'mrkdwn',
  22. text: 'About',
  23. },
  24. },
  25. {
  26. type: 'context',
  27. elements: [
  28. {
  29. type: 'mrkdwn',
  30. text: 'Psssst',
  31. },
  32. ],
  33. },
  34. ],
  35. },
  36. });
  37. console.log('openModal');
  38. };