Skip to content

Plaude/plaude-react-native

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plaude logo

Plaude for React Native

Plaude
AI-powered tools for your company


Getting started

First, install the Plaude SDK.

npm install @plaude/react-native

Then, add the following environment variable from your Plaude dashboard.

PLAUDE_APP_ID="This is an example"

Then, wrap your application with the PlaudeProvider component.

import { PlaudeProvider } from '@plaude/react-native';

export default function RootLayout({ children }: React.PropsWithChildren) {
  return <PlaudeProvider>{children}</PlaudeProvider>;
}

Although Plaude automatically gets the App ID from your environment, you can opt for manually setting it in the PlaudeProvider component.

import { PlaudeProvider } from '@plaude/react-native';

export default function RootLayout({ children }: React.PropsWithChildren) {
  return <PlaudeProvider appId="Your App ID">{children}</PlaudeProvider>;
}

At this point the installation is completed, you can make use of the Plaude messenger by calling the openMessenger() method from the usePlaude() hook.

import { Pressable, Text, View } from 'react-native';
import { usePlaude } from '@plaude/react-native';

export default function Page() {
  const { openMessenger } = usePlaude();

  return (
    <View>
      <Pressable onPress={openMessenger}>
        <Text>Open Plaude</Text>
      </Pressable>
    </View>
  );
}