https://github.com/malaa-tech/react-native-intercom-expo-config-plugin
Expo plugin for react-native-intercom
https://github.com/malaa-tech/react-native-intercom-expo-config-plugin
Last synced: 7 months ago
JSON representation
Expo plugin for react-native-intercom
- Host: GitHub
- URL: https://github.com/malaa-tech/react-native-intercom-expo-config-plugin
- Owner: Malaa-tech
- Created: 2023-07-12T17:06:18.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-14T08:20:29.000Z (over 1 year ago)
- Last Synced: 2024-05-14T15:22:01.310Z (about 1 year ago)
- Language: JavaScript
- Size: 3.62 MB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This repo is a continuation on the work of https://github.com/expo/config-plugins since it is not updated frequently
# Expo Config Plugin `@intercom/intercom-react-native`
An unofficial [Expo config plugin](https://docs.expo.io/guides/config-plugins) for easily setting up [React Native Intercom](https://github.com/intercom/intercom-react-native) with expo dev clients
## Installation
### Prerequisites
#### Versions >= 1.10
- App project using Expo SDK 49.
- Installed `[email protected]` or later.
- Installed `@intercom/[email protected]`
- For Android it Intercom requires `compileSdkVersion` and `targetSdkVersion` to be set on 33 or higher. [expo-build-properties](https://docs.expo.dev/versions/latest/sdk/build-properties/) is used to set it#### Versions < 1.10
- App project using Expo SDK 45.
- Installed `[email protected]` or later.
- Installed `@intercom/[email protected]`
- For Android it Intercom requires `compileSdkVersion` and `targetSdkVersion` to be set on 33 or higher. [expo-build-properties](https://docs.expo.dev/versions/latest/sdk/build-properties/) is used to set it#### Versions < 1.3
- App project using Expo SDK 44.
- Installed `[email protected]` or later.
- Installed `@intercom/intercom-react-native`#### With `expo install`
```
expo install react-native-intercom-expo-config-plugin expo-build-properties
```#### Without `expo install`
```sh
# using yarn
yarn add react-native-intercom-expo-config-plugin expo-build-properties# using npm
npm install react-native-intercom-expo-config-plugin expo-build-properties
```Open your `app.json` and update your `plugins` section:
```json
{
"plugins": [
[
"expo-build-properties",
{ "android": { "compileSdkVersion": 33, "targetSdkVersion": 33 } }
],
"react-native-intercom-expo-config-plugin"
]
}
```## Configuration
The plugin needs your intercom api key so that it can communicate with the intercom application.
```json
{
"plugins": [
[
"creact-native-intercom-expo-config-plugin",
{
"iosApiKey": "",
"androidApiKey": "",
"appId": ""
}
]
]
}
```### Other configuration options
Add a custom photo usage description
```json
{
"plugins": [
[
"react-native-intercom-expo-config-plugin",
{
//...
"iosPhotoUsageDescription": "Upload to support center"
}
]
]
}
```Add EU Region support
### On iOS Add to `app.json`
```json
{
"ios": {
"infoPlist:":{
"IntercomRegion": "EU"
}
}
}```
### On Android
```json
{
"plugins": [
[
"react-native-intercom-expo-config-plugin",
{
//...
"intercomEURegion": "true"
}
]
]
}
```Enable push notifications
### On iOS
```json
{
"plugins": [
[
"react-native-intercom-expo-config-plugin",
{
//...
"isPushNotificationsEnabledIOS": true
}
]
]
}
```
### On Android```json
{
"plugins": [
[
"react-native-intercom-expo-config-plugin",
{
//...
"isPushNotificationsEnabledAndroid": true,
"androidIcon": "" //Customize the icon for intercom push notifications from the intercom default
}
]
]
}
```## Android push notifications
If you want push notifications to fire when new messages are sent in a conversation, it is necesssary
to create a push notification channel for these. Push notifications for new conversations require no additoonal setup.
```jsx
useEffect(() => {
if (Platform.OS === 'android') {
Notifications.setNotificationChannelAsync('intercom_chat_replies_channel', {
name: 'Intercom Replies Channel',
description: 'Channel for intercom replies',
importance: Notifications.AndroidImportance.MAX,
})
}
}, [])
```## Building and running
You can either:
- use `expo prebuild` or `expo run:android`/`expo run:ios` to update your native projects,
- use _[EAS Build](https://docs.expo.io/build/introduction/)_ to build your development client.
- Keep in mind that if you are using environment variables for `androidApiKey`, `iosApiKey` and `appId` in your `app.config.js`, you need to configure these secrets with `eas secret:create` or at _[Expo](https://expo.dev)_.## Contributing
Contributions are very welcome! The package uses `expo-module-scripts` for most tasks. You can find detailed information [at this link](https://github.com/expo/expo/tree/master/packages/expo-module-scripts#-config-plugin).
Please make sure to run `yarn build`/`yarn rebuild` to update the `build` directory before pushing. The CI will fail otherwise.
## Credits
- _the Expo team_
-
## License
MIT