How to change name of twilio channel -


the twilio documentation page mentions using roles change name of channel (https://www.twilio.com/docs/api/chat/rest/roles), not provide example code. how in below example:

var channel = this.state.channel; var accountsid = 'acxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; var authtoken = 'your_auth_token'; var twilio = require('twilio').twilio;  var client = new twilio(accountsid, authtoken); var service = client.chat.services('isxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');  service.roles.list().then(function(response) {  // insert here change name of channel variable }); 

twilio developer evangelist here.

in twilio programmable chat each user gets default role when created. there default channel role assigned each member joins channel. roles permissions each user/member has. there guide on roles , permissions available in chat documentation recommend take read through.

the default user role has these permissions:

  • create channel
  • get channel list (public, joined , invited)
  • join channel (public or invited to)
  • edit own user info

and default channel member role has these permissions:

  • leave channel
  • get member list
  • get channel messages
  • add message
  • edit own message
  • edit own message attributes
  • remove own message

you can update these roles or create new roles using rest api. if want users able update channel name need give them editchannelname permission. can either on user level or channel level. once have granted permission role, or created new role permission , assigned user, user able call channel.updatefriendlyname sdk.

alternatively, can use channels resource in rest api change friendly name of channel too.

channel.update({   friendlyname: 'channel_name', }) .then(response => {   console.log(response); }); 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -