Skip to main content
Glama

nworks_message_send

Send messages to users or channels in NAVER WORKS using Service Account authentication. Supports text, button, and list message types for automated communication.

Instructions

NAVER WORKS 메시지를 전송합니다 (봇이 사용자 또는 채널에 발송). Service Account 인증 사용 (nworks_setup에서 serviceAccount, botId 설정 + 환경변수 NWORKS_PRIVATE_KEY_PATH 필요. User OAuth 불필요)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toNo수신자 userId (channel과 택 1). nworks_directory_members로 userId 조회 가능
channelNo채널 channelId (to와 택 1). nworks_message_members로 채널 구성원 확인 가능
textYes메시지 본문
typeNo메시지 타입 (기본: text)
actionsNo버튼 액션 JSON (type=button일 때)
elementsNo리스트 항목 JSON (type=list일 때)

Implementation Reference

  • MCP tool handler for "nworks_message_send".
    async ({ to, channel, text, type, actions, elements }) => {
      try {
        const result = await messageApi.send({
          to,
          channel,
          text,
          type,
          actions,
          elements,
        });
        return {
          content: [{ type: "text" as const, text: JSON.stringify(result) }],
        };
      } catch (err) {
        return {
          content: [{ type: "text" as const, text: mcpErrorHint(err) }],
          isError: true,
        };
      }
    }
  • Actual implementation logic for sending messages via NAVER WORKS API.
    export async function send(opts: SendOptions): Promise<SendResult> {
      const profile = opts.profile ?? "default";
      const creds = await loadCredentials(profile);
    
      if (!creds.botId) {
        throw new Error(
          "Bot ID is required for sending messages.\n" +
          "Run `nworks login` with --bot-id flag to set up bot credentials."
        );
      }
    
      const content = buildContent(opts);
      const body = { content };
    
      if (opts.to) {
        const result = await request<{ messageId?: string }>({
          method: "POST",
          path: `/bots/${sanitizePathSegment(creds.botId)}/users/${sanitizePathSegment(opts.to)}/messages`,
          body,
          profile,
        });
        return { success: true, messageId: result?.messageId };
      }
      if (opts.channel) {
        const result = await request<{ messageId?: string }>({
          method: "POST",
          path: `/bots/${sanitizePathSegment(creds.botId)}/channels/${sanitizePathSegment(opts.channel)}/messages`,
          body,
          profile,
        });
        return { success: true, messageId: result?.messageId };
      }
    
      throw new Error("Either --to (userId) or --channel (channelId) is required.");
    }
  • Registration and schema definition of "nworks_message_send" tool.
    server.tool(
      "nworks_message_send",
      "NAVER WORKS 메시지를 전송합니다 (봇이 사용자 또는 채널에 발송). Service Account 인증 사용 (nworks_setup에서 serviceAccount, botId 설정 + 환경변수 NWORKS_PRIVATE_KEY_PATH 필요. User OAuth 불필요)",
      {
        to: z.string().optional().describe("수신자 userId (channel과 택 1). nworks_directory_members로 userId 조회 가능"),
        channel: z.string().optional().describe("채널 channelId (to와 택 1). nworks_message_members로 채널 구성원 확인 가능"),
        text: z.string().describe("메시지 본문"),
        type: z
          .enum(["text", "button", "list"])
          .optional()
          .describe("메시지 타입 (기본: text)"),
        actions: z
          .string()
          .optional()
          .describe("버튼 액션 JSON (type=button일 때)"),
        elements: z
          .string()
          .optional()
          .describe("리스트 항목 JSON (type=list일 때)"),
      },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yjcho9317/nworks'

If you have feedback or need assistance with the MCP directory API, please join our Discord server