Skip to main content

slack.slack.leaveconversation

Home > @runlightyear/slack > Slack > leaveConversation

Slack.leaveConversation() method

Leave a conversation

Signature:
leaveConversation(props: LeaveConversationProps): Promise<LeaveConversationResponse>;

Parameters

ParameterTypeDescription
propsLeaveConversationProps
Returns:

Promise<LeaveConversationResponse>

Example

Leave a channel

import { defineAction } from "@runlightyear/lightyear";
import { Slack } from "@runlightyear/slack";

defineAction({
name: "leaveChannel",
title: "Leave Channel",
apps: ["slack"],
variables: [
{
name: "channel",
description: "ID of conversation to leave. Example: C1234567890",
},
],
run: async ({ auths, variables }) => {
const slack = new Slack({
auth: auths.slack,
});
const response = await slack.leaveConversation({
channel: variables.channel!,
});
console.log("Response data: ", response.data);
},
});