Edits history of script submission #14697 for ' Create a reply message (clickup)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Clickup = {
      token: string;
    };
    /**
     * Create a reply message
     * This endpoint creates a reply message.
     */
    export async function main(
      auth: Clickup,
      workspace_id: string,
      message_id: string,
      body: {
        assignee?: string;
        group_assignee?: string;
        triaged_action?: 1 | 2;
        triaged_object_id?: string;
        triaged_object_type?: number;
        type: "message" | "post";
        content: string;
        reactions?: { date: number; reaction: string; user_id: string }[];
        followers?: string[];
        content_format?: "text/md" | "text/plain";
        post_data?: { title: string; subtype: { id: string } };
      },
    ) {
      const url = new URL(
        `https://api.clickup.com/api/v3/workspaces/${workspace_id}/chat/messages/${message_id}/replies`,
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: auth.token,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 235 days ago