I am trying to play with sendbird. I am getting this error . I am trying to make sendbird api work in react.js app. I have read the documentation and it wasnt clear to me. I have looked at stackoverflow earlier replies and Thats why , i tried to create channel after i get connected to sendbird.
VM2257:1 POST https://api.sendbird.com/v3/group_channels 400 (BAD
REQUEST)
error is here p {name: "SendBirdException", code: 400201, message: "User not found."}
I am trying to implement it in react.js . Here's my code. Can someone help me out with how to rectify this error.
import React, { Component } from 'react';
import * as SendBird from 'sendbird';
import './App.css';
var sb = new SendBird({'appId': '59BEEA34-BDC7-461B-B10B-63705C8B57C2'});
class App extends Component {
componentWillMount(){
sb.connect("ankur1", function(user, error) {
if(user){
console.log("looks like connected",user)
var userIds = ['unique_user_id1', 'unique_user_id2','ankur1'];
var name = "amazing1";
sb.GroupChannel.createChannelWithUserIds(userIds, false, name, function(createdChannel, error) {
if (error) {
console.error("error is here",error);
return;
}
console.log("success",createdChannel);
});
}
else{
console.log("looks like error")
}
})
}
sm(){
console.log("button clicked",sb)
var channel = "amazing"
/*
sb.channel.sendUserMessage("that is cool", '', function(message, error){
if (error) {
console.error(error);
return;
}
console.log(message);
});
*/
}
componentDidMount(){
}
render() {
var sm = this.sm.bind(this)
return (
<div>
<h1>ankur is here </h1>
<button onClick={sm}>click here</button>
</div>
);
}
}
export default App;