Function useMessage

This hook wraps helper functions to include the client, DB instance, and other values for easier consumption.

  • Returns {
        deleteMessage: ((...args: [message: CachedMessage<any, ContentTypeMetadata>]) => Promise<void>);
        getMessageByXmtpID: ((...args: [id: string]) => Promise<undefined | CachedMessage<any, ContentTypeMetadata>>);
        processMessage: ((conversation: CachedConversation, message: CachedMessage<any, ContentTypeMetadata>) => Promise<{
            message: CachedMessage<any, ContentTypeMetadata>;
            status: ProcessStatus;
        }>);
        resendMessage: ((message: CachedMessage) => Promise<DecodedMessage<any>>);
        sendMessage: ((conversation: CachedConversation, content: any, contentType?: ContentTypeId, options?: SendMessageOptions) => Promise<{
            cachedMessage: CachedMessage<any, ContentTypeMetadata>;
            sentMessage: DecodedMessage<any>;
        } | {
            cachedMessage: CachedMessage<any, ContentTypeMetadata>;
            sentMessage: undefined;
        }>);
        updateMessage: ((...args: [message: CachedMessage<any, ContentTypeMetadata>, update: Partial<Pick<CachedMessage<any, ContentTypeMetadata>,
            | "metadata"
            | "id"
            | "status"
            | "isSending"
            | "sentAt"
            | "hasLoadError"
            | "hasSendError"
            | "sendOptions">>]) => Promise<{
            content: any;
            contentBytes?: Uint8Array;
            contentFallback?: string;
            contentType: string;
            conversationTopic: string;
            hasLoadError: boolean;
            hasSendError: boolean;
            id: string;
            isSending: boolean;
            metadata?: ContentTypeMetadata;
            sendOptions?: SendOptions;
            senderAddress: string;
            sentAt: Date;
            status: "unprocessed" | "processed";
            uuid: string;
            walletAddress: string;
        }>);
    }

    • deleteMessage: ((...args: [message: CachedMessage<any, ContentTypeMetadata>]) => Promise<void>)
    • getMessageByXmtpID: ((...args: [id: string]) => Promise<undefined | CachedMessage<any, ContentTypeMetadata>>)
    • processMessage: ((conversation: CachedConversation, message: CachedMessage<any, ContentTypeMetadata>) => Promise<{
          message: CachedMessage<any, ContentTypeMetadata>;
          status: ProcessStatus;
      }>)
    • resendMessage: ((message: CachedMessage) => Promise<DecodedMessage<any>>)
        • (message): Promise<DecodedMessage<any>>
        • Parameters

          Returns Promise<DecodedMessage<any>>

    • sendMessage: ((conversation: CachedConversation, content: any, contentType?: ContentTypeId, options?: SendMessageOptions) => Promise<{
          cachedMessage: CachedMessage<any, ContentTypeMetadata>;
          sentMessage: DecodedMessage<any>;
      } | {
          cachedMessage: CachedMessage<any, ContentTypeMetadata>;
          sentMessage: undefined;
      }>)
    • updateMessage: ((...args: [message: CachedMessage<any, ContentTypeMetadata>, update: Partial<Pick<CachedMessage<any, ContentTypeMetadata>,
          | "metadata"
          | "id"
          | "status"
          | "isSending"
          | "sentAt"
          | "hasLoadError"
          | "hasSendError"
          | "sendOptions">>]) => Promise<{
          content: any;
          contentBytes?: Uint8Array;
          contentFallback?: string;
          contentType: string;
          conversationTopic: string;
          hasLoadError: boolean;
          hasSendError: boolean;
          id: string;
          isSending: boolean;
          metadata?: ContentTypeMetadata;
          sendOptions?: SendOptions;
          senderAddress: string;
          sentAt: Date;
          status: "unprocessed" | "processed";
          uuid: string;
          walletAddress: string;
      }>)
        • (...args): Promise<{
              content: any;
              contentBytes?: Uint8Array;
              contentFallback?: string;
              contentType: string;
              conversationTopic: string;
              hasLoadError: boolean;
              hasSendError: boolean;
              id: string;
              isSending: boolean;
              metadata?: ContentTypeMetadata;
              sendOptions?: SendOptions;
              senderAddress: string;
              sentAt: Date;
              status: "unprocessed" | "processed";
              uuid: string;
              walletAddress: string;
          }>
        • Parameters

          Returns Promise<{
              content: any;
              contentBytes?: Uint8Array;
              contentFallback?: string;
              contentType: string;
              conversationTopic: string;
              hasLoadError: boolean;
              hasSendError: boolean;
              id: string;
              isSending: boolean;
              metadata?: ContentTypeMetadata;
              sendOptions?: SendOptions;
              senderAddress: string;
              sentAt: Date;
              status: "unprocessed" | "processed";
              uuid: string;
              walletAddress: string;
          }>