dmitrizzle / chat-bubble

Simple chatbot UI for the Web with JSON scripting 👋🤖🤙
MIT License
579 stars 171 forks source link

Tweets can not be embedded in chatbot. #88

Closed maansisrivastava closed 1 year ago

maansisrivastava commented 3 years ago

Bug or feature request?

Feature request

If it's a bug, please provide the full method to reproduce.

How did you end up seeing the bug? What steps did you take to see it?

Can Tweets be embedded in the chat bot?

This is how an Embedded Tweet looks like: https://publish.twitter.com/?query=https%3A%2F%2Ftwitter.com%2FForbes%2Fstatus%2F1390758382529884164&widget=Tweet

Can I do show me a Tweet from Forbes and show it in the chat bot response? Can you guide me on how to embed this in the UI?

dmitrizzle commented 3 years ago

Hey @maansisrivastava, you should be able to paste an embed code for a tweet directly as a string value to says keys:

chatWindow.talk(
  {
    ice: {
      says: ["This is a tweet:", `<blockquote class="twitter-tweet"><p lang="en" dir="ltr">This important new iPhone feature is a blockbuster success: <a href="https://t.co/a7ZAAA12wz">https://t.co/a7ZAAA12wz</a> <a href="https://t.co/OOxutujKkE">pic.twitter.com/OOxutujKkE</a></p>&mdash; Forbes (@Forbes) <a href="https://twitter.com/Forbes/status/1390758382529884164?ref_src=twsrc%5Etfw">May 7, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>`],
  }
});

Let me know if that doesn't work for you or on clear and I'll do my best to explain.

maansisrivastava commented 3 years ago

Didn't work.

dmitrizzle commented 3 years ago

Didn't work.

What's the error? I need to be able to replicate.

dmitrizzle commented 3 years ago

I looked into this on the weekend. Seems that the embed code Twitter is using isn't playing well with chat-bubble. I haven't got a definitive answer as to why, Partially because Twitter isn't announcing how exactly its code is interacting with the host page. But once that's known we should be able to understand how to solve this.

dmitrizzle commented 1 year ago

Since I no longer use Twitter actively, I decided not to build this. However, I'll keep this bug in mind as it may affect various <iframe /> embeddings. I don't think it's safe to use at the moment. Instead, you should generate valid HTML that you have full control over in the app that's delivering the chat UI.