A hook that allows you to create a new direct message (DM).
Imports
import { useCreateDm } from '@towns-protocol/react-sdk'
Definition
function useCreateDm(
config?: ActionConfig<Dms["createDM"]>,
): {
data: {
streamId: string;
} | undefined;
error: Error | undefined;
isPending: boolean;
isSuccess: boolean;
isError: boolean;
createDM: (userId: string, streamSettings?: {
disableMiniblockCreation: boolean;
} | undefined) => Promise<{
streamId: string;
}>;
}
Source: useCreateDm
Parameters
config
- Type:
ActionConfig<Dms["createDM"]>
- Optional
The action config.
Return Type
An object containing the createDM
action and the rest of the action result.
{
data: {
streamId: string;
} | undefined;
error: Error | undefined;
isPending: boolean;
isSuccess: boolean;
isError: boolean;
createDM: (userId: string, streamSettings?: {
disableMiniblockCreation: boolean;
} | undefined) => Promise<{
streamId: string;
}>;
}