Follow some activities (new user, payment, etc.) from your app via Slack and this webhook lib
npm install react-native-slack-webhook
The best Slack bot for React Native.

bash
$ npm i react-native-slack-webhook --save
`
$3
- Install react-native first`bash
$ npm i react-native -g
`- Initialization of a react-native project
`bash
$ react-native init myproject
`- Then, edit
myproject/index.ios.js, like this:`jsx
/**
* @flow
*/import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity
} from 'react-native';
import Slack from 'react-native-slack-webhook';
import { webhookURL } from './env';
class example extends Component {
render() {
return (
Welcome to react-native-slack-webhook!
new Slack(webhookURL).post('Test', '#test')}>
Press it to send message
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('example', () => example);
`Setup
$3
This lib need a webhook url, details here : https://api.slack.com/incoming-webhooks.
`JavaScript
const webhookURL = ''
const Slack = new Slack(webhookURL)
``Just provide a file name env.js at root of the example project, see the example/env.example.js file.
| Key | Type | Default | Description |
| --- | --- | --- | --- |
| channel | string | '#general' | The channel where you will post a message |
| username | string | 'bot' | The username you will use to post the message |
| text | string | 'text is empty' | The most important part, the message you will send |
| 'icon_emoji' | string | ':iphone:' | The icon emoji with your message |
- @xcapentier The main author.
PRs are welcome !
Feel free to contact me or create an issue
> made with ♥