Se você tem um aplicativo React Native, pode adicionar o widget de chat ao vivo do Chatwoot e conversar com seus visitantes em tempo real. Isso pode ser feito em 3 passos simples usando o plugin Chatwoot.

## Passo 1. Crie uma caixa de entrada de site no Chatwoot​

Consulte este [guia](https://app.chatwoot.com/hc/chatwoot-user-guide-cloud-version/en/website-live-chat/474) para instruções detalhadas sobre como configurar uma caixa de entrada de site no Chatwoot.

## Passo 2. Adicione o plugin ao seu projeto[​](https://www.chatwoot.com/docs/product/channels/live-chat/integrations/react-native-widget#2-add-the-plugin-to-your-project "Direct link to heading")

Adicione um dos seguintes plugins ao seu projeto.

```
yarn add @chatwoot/react-native-widget
```

ou

```
npm install --save @chatwoot/react-native-widget --save
```

Esta biblioteca depende de [react-native-webview](https://www.npmjs.com/package/react-native-webview) e [async-storage](https://github.com/react-native-async-storage/async-storage). Por favor, siga as instruções fornecidas na documentação.

**Instalação no iOS**[**​**](https://www.chatwoot.com/docs/product/channels/live-chat/integrations/react-native-widget#ios-installation "Direct link to heading")

Se você estiver usando versões do React Native > 60.0, é relativamente simples.

```
cd ios && pod install
```

## Passo 3. Utilize assim[​](https://www.chatwoot.com/docs/product/channels/live-chat/integrations/react-native-widget#3-use-it-like-this "Direct link to heading")

Substitua `websiteToken` e `baseUrl` por valores apropriados.

```
import React, { useState } from 'react';
import { StyleSheet, View, SafeAreaView, TouchableOpacity, Text } from 'react-native';
import ChatWootWidget from '@chatwoot/react-native-widget';

const App = () => {
  const [showWidget, toggleWidget] = useState(false);
  const user = {
    identifier: 'john@gmail.com',
    name: 'John Samuel',
    avatar_url: '',
    email: 'john@gmail.com',
    identifier_hash: '',
  };
  const customAttributes = { accountId: 1, pricingPlan: 'paid', status: 'active' };
  const websiteToken = 'WEBSITE_TOKEN';
  const baseUrl = 'CHATWOOT_INSTALLATION_URL';
  const locale = 'en';

  return (
    <SafeAreaView style={styles.container}>
      <View>
        <TouchableOpacity style={styles.button} onPress={() => toggleWidget(true)}>
          <Text style={styles.buttonText}>Abrir widget</Text>
        </TouchableOpacity>
      </View>
      {
        showWidget&&
          <ChatWootWidget
            websiteToken={websiteToken}
            locale={locale}
            baseUrl={baseUrl}
            closeModal={() => toggleWidget(false)}
            isModalVisible={showWidget}
            user={user}
            customAttributes={customAttributes}
          />
      }

    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },

  button: {
    height: 48,
    marginTop: 32,
    paddingTop: 8,
    paddingBottom: 8,
    backgroundColor: '#1F93FF',
    borderRadius: 8,
    borderWidth: 1,
    borderColor: '#fff',
    justifyContent: 'center',
  },
  buttonText: {
    color: '#fff',
    textAlign: 'center',
    paddingLeft: 10,
    fontWeight: '600',
    fontSize: 16,
    paddingRight: 10,
  },
});

export default App;
```

E... pronto. Veja o exemplo completo [aqui](https://github.com/chatwoot/chatwoot-react-native-widget/tree/develop/examples).