'Not able to add friendly name to participants when creating participant with conversation
I am using twilio for creating an chat API using conversion API (Twilio), I was able to create the converstaion and add new participant to the converstion, But when I try to add friendly name to participant, Its not adding.
client.conversations.conversations(conversionsSID)
.participants
.create({
identity: identity,
FriendlyName: name,
attributes: JSON.stringify({
profileImage: profileImage
})
}).then((participant) => {
resolve({ participant: participant, error: null })
}).catch((error) => {
reject({ participant: null, error: error });
});
I have tried with FriendlyName and friendly_name, both of that does't work.
Solution 1:[1]
The participant resource does not have a FriendlyName property. You can see the available properties that you can use in the documentation for creating a conversation participant.
You are already using the attributes property to store a profile image, so you could use this to store your friendly name too. So, you could change your code to:
client.conversations.conversations(conversionsSID)
.participants
.create({
identity: identity,
attributes: JSON.stringify({
name: name,
profileImage: profileImage
})
}).then((participant) => {
resolve({ participant: participant, error: null })
}).catch((error) => {
reject({ participant: null, error: error });
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | philnash |
