.message {
white-space: normal;
overflow: hidden;
border-radius: 0.75rem;
border-width: 1px;
border-style: solid;
word-wrap: break-word;
position: relative;
display: inline-block;
max-width: calc(100% - 6rem - 0.25rem - 0.25rem);
border-color: #F2F2F2;
background-color: #F2F2F2;
color: #171717;
}
.has-avatar-spacer .message {
max-width: calc(100% - 3rem - 0.25rem - 0.25rem);
}
.by-me .message {
border-color: #171717;
background-color: #171717;
color: #fff;
margin-right: 0.50rem;
}
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def render_talkjs():
user = { # Create a user, or fetch user data from your database
"id": "123456",
"name": "Alice",
"email": "alice@example.com",
"photoUrl": "https://talkjs.com/images/avatar-7.jpg",
"welcomeMessage": "Hey there! How are you? :-)",
}
app_id = "abcdef123" # Replace with your own app ID
conversation_id = "conversation_1"
other = { # Create a user, or fetch user data from your database
"id": "654321",
"name": "Sebastian",
"email": "sebastian@example.com",
"photoUrl": "https://talkjs.com/images/avatar-4.jpg",
"welcomeMessage": "Hey there! How can I help?",
}
return render_template(
"talkjs.html", user=user, app_id=app_id, conversation_id=conversation_id, other=other
)
We were able to offload all messaging to TalkJS — hugely simplifying our development of an otherwise complex stack.