Skip to content

Instantly share code, notes, and snippets.

View warodri-sendbird's full-sized avatar

Walter Rodriguez warodri-sendbird

View GitHub Profile
// Create a `FileMessageParams` object.
const params = new sb.FileMessageParams();
params.file = FILE;
params.parentMessageId = PARENT_MESSAGE_ID; // This specifies the unique ID of a parent message which has a thread of replies. If the message sent through the `sendUserMessage()` method is a parent message, the value of this property is 0.
...
// Pass the params to the parameter in the `sendFileMessage()` method.
groupChannel.sendFileMessage(params, (message, error) => {
if (error) {
// Handle error.
// Create a `UserMessageParams` object.
const params = new sb.UserMessageParams();
params.parentMessageId = PARENT_MESSAGE_ID; // This specifies the unique ID of a parent message which has a thread of replies. If the message sent through the `sendUserMessage()` method is a parent message, the value of this property is 0.
...
// Pass the params to the parameter of the `sendUserMessage()` method.
groupChannel.sendUserMessage(params, (message, error) => {
if (error) {
// Handle error.
}
// Sending a file message with a raw file
const params = new sb.FileMessageParams();
params.file = FILE; // Or .fileUrl = FILE_URL (You can also send a file message with a file URL.)
params.fileName = FILE_NAME;
params.fileSize = FILE_SIZE;
params.thumbnailSizes = [{maxWidth: 100, maxHeight: 100}, {maxWidth: 200, maxHeight: 200}]; // Add the maximum sizes of thumbnail images (allowed number of thumbnail images: 3).
params.mimeType = MIME_TYPE;
params.customType = CUSTOM_TYPE;
params.mentionType = 'users'; // Either 'users' or 'channel'
const params = new sb.MessageListParams();
params.prevResultSize = PREV_RESULT_SIZE;
params.nextResultSize = NEXT_RESULT_SIZE;
params.isInclusive = INCLUSIVE;
params.reverse = REVERSE;
params.includeReplies = INCLUDE_REPLIES;
params.includeThreadInfo = INCLUDE_THREAD_INFO;
params.includeParentMessageText = INCLUDE_PARENT_MESSAGE_TEXT;
...
groupChannel.getMessagesByTimestamp(TIMESTAMP, params, (messages, error) => {
const sendbird = new SendBird({ appId });
const appId = 'YOUR SENDBIRD APPLICATION ID GOES HERE';
import messaging from '@react-native-firebase/messaging';
import { onRemoteMessage } from './src/utils';
...
if (Platform.OS !== 'ios') {
messaging().setBackgroundMessageHandler(onRemoteMessage);
}
{
"type": "service_account",
"project_id": "agent-crlt",
"private_key_id": "3d19b9a1f89b533f71018e7d188306e58bb90e84",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDJo8Abmyx1R8Np\nRqjYh7WTqnD+d0MAdDfRD3dVwwfmTv6SQ7fw3Df5kudwT5qxa3lZfZ6+UZ8nrJt1\n2JAWde12WMTQvskMT1wPC5uhZ7Vo2py2SUdAJKAAmcCmlwO5dmwPGzLBg5ez5Dyr\nv5pcmGrrZPh9/haJyyZrD++a3f9XroPk/w1kXP9DjFNGEZnJQZGjltY7sf2EOQS5\nfNrbVTWiriPt/p63QWxgTglBPl/tnoPZvt3wUv+Tgt4ZhCZx43gVC8wi51yTuNwW\nmWSPF1IsMGy5t7d9wutrblTvSaywloo7zkVN+gWpCcK2F0CWgnvUMFcScj4SWUIe\nIFG+CJi3AgMBAAECggEAEGapXEAllZneDdTELG3yxFgQviH6k9w1eLkb/nXRUVe2\nN99vjr/a2F9X7o1gX8iwzilRnYQLa1wMKRcRtpdRAVdRwEjvFs6TBluYr8A9GTzu\n55oo7tFhJ6tZ6DL7B+gsp0M8avvGfci1cU2HGLutDAiNIx0PvZWF7R9sCy9oyDuH\nVS2JOLTU5Ph3dvW34Mvqz+g9BSGFyjro5DPgb2GYKfI9N+0SsQpcWrqMYB7PC+UC\n59wuwRuIfAVmNm/duHAXTdG0U41hKeSzzW4qFCVN+bNoYbu+3gvFCPolloeqL5TH\nq86pJI2Sl/fHy4gILUGKAwrPiUHtRgQsc6iHEBqcAQKBgQDwHT9SsxY5/eTcsU7F\nQEXNtRyxop7nqcDm5QYYM38rPLL1hkwBkliGM/h7gAw+64MAGUC+AQHDFvy9
{
"bot_userid": "bot1",
"bot_nickname": "bot1",
"bot_profile_url": "https://via.placeholder.com/50x50",
"bot_type": "DialogFlow",
"bot_callback_url": "https://b1b85fc97d18.ngrok.io/callback",
"is_privacy_mode": false
}
<TextInput
value={state.input}
style={style.input}
multiline={true}
numberOfLines={2}
onChangeText={content => {
if (content.length > 0) {
channel.startTyping();
} else {
channel.endTyping();