Feedback
Answered

How to Launch a chat with a button

  • 23 February 2022
  • 3 replies
  • 53 views

Userlevel 1

Hello,

Is there a good way to launch a popup chat with a button - this is what I mean: 

 

icon

Best answer by mathio 24 February 2022, 19:24

View original

3 replies

Userlevel 7
Badge +5

Hi @AdamMktgTy Welcome to the community! You would need to use some custom code to do this, but @mathio or @picsoung might have an example of this for you!

Userlevel 7
Badge +5

In your share page you can get embed snippet for popup:

Then add data-tf-chat to your embed code like this (part of the code truncated):

<button data-tf-chat data-tf-popup="<form-id>" ...>Launch me</button>
<script src="//embed.typeform.com/next/embed.js"></script>

 

 

If you want to build your own button from scratch you can use our Embed SDK. If you want full control over your embed you can build it in JavaScript. The code would look something like this:

<button id="my-awesome-button" class="my-awesome-class">open form</button>
<script src="//embed.typeform.com/next/embed.js"></script>
<link rel="stylesheet" href="//embed.typeform.com/next/css/popup.css" />
<script>
const { toggle } = window.tf.createPopup('<form-id>')
document.querySelector('#my-awesome-button').onclick = toggle
</script>

 

Userlevel 7
Badge +5

@AdamMktgTy let us know if @mathio ‘s solution worked for you!

Reply