Programmatically open chat window (Web version)

(Evan McDaniel) #1

Hi, wondering if there is a way to open the chat window programmatically, e.g. with JavaScript.

Does the FlowXO widget expose it’s API to the containing page?

Thanks for any help.

(John Jackson) #2

Not just yet unfortunately but we have got this implemented in development, just need to polish up and document it. Look out for it soon!

(Evan McDaniel) #3

OK, that’s good news. That’s for the quick reply!

(Benjamin Intal) #4

I’d be interested with this as well

(Evan McDaniel) #5

Hi John, any word on this? I thought I saw something about this feature being announced. Is that right? Where could I find out about it?

Thanks.

(John Jackson) #6

Yes we do have an API for it now, details here:

https://support.flowxo.com/article/167-web-messenger-api

(Evan McDaniel) #7

Hi John,

Thanks for the quick response.

I have looked at that article previously, but am not clear how to set it up to show the bot on page load, eliminating the need to click to open it.

I’ve got my script tag with the source to the flowxo widget code, with the callback and async defer set.

However, in my callback I’m not seeing the stateChanged event until after I click the button.

Is there a way for me to pop the messenger open without the user needing to click the button?

Thanks.

Evan McDaniel
Director of Technology
PJA Advertising + Marketing
Cambridge • San Francisco

emcdaniel@agencypja.com
617.234.7368 cambridge office
617.230.7614 mobile

PJA is proud to be named an Ad Age Top B2B Agency of the Year

(John Jackson) #8

This should open the messenger on page load, you need to use create():

<script>
  function messengerReady() {
    FxoMessenger.create();
  }
</script>
<script src="https://widget.flowxo.com/embed.js?callback=messengerReady" async defer data-fxo-widget="my-own-widget-code"></script>

Hope that works for you!

(Evan McDaniel) #9

Hi John,

When I do that I get “FxoMessenger is not defined” error pointing to the line with the call to the create() function.

My code matches yours exactly (with the exception of the data-fxo-widget value of course).

Thanks.

Evan McDaniel
Director of Technology
PJA Advertising + Marketing
Cambridge • San Francisco

emcdaniel@agencypja.com
617.234.7368 cambridge office
617.230.7614 mobile

PJA is proud to be named an Ad Age Top B2B Agency of the Year

(John Jackson) #10

Sorry I’ve done this wrong, I missed out the callback. Will edit shortly.

(John Jackson) #11

I edited the above code, it should be this:

<script>
  function messengerReady() {
    FxoMessenger.create();
  }
</script>
<script src="https://widget.flowxo.com/embed.js?callback=messengerReady" async defer data-fxo-widget="my-own-widget-code"></script>

Sorry for the confusion!

(Evan McDaniel) #12

Hi John,

Right, that makes sense. Working for me now.

Thanks so much for your help - this is just what I wanted it to do.

:blush:

Evan McDaniel
Director of Technology
PJA Advertising + Marketing
Cambridge • San Francisco

emcdaniel@agencypja.com
617.234.7368 cambridge office
617.230.7614 mobile

PJA is proud to be named an Ad Age Top B2B Agency of the Year

(Faisal Ahmed) #13

How set timing for open chat window ?? like i want .open chat window when page is full loaded.

(Karen Barker) #14

Hi @fftfaisal

If you have an event that occurs when the web page is fully loaded you could use the API to toggle the state of the Web Messenger and open it.

(Helio Freitas) #15

Dears,

Is there a way to click a link and make the same call from button? I have some links in my page and would like to click from them and open the widget as same way from the button.

(Daniel Beckett) #16

Hi @Helio_Freitas

You could use the API to open the Web Messenger on a button being clicked. You may also want to use the bot’s shortlink or iFrame code with your button. You can get this by creating a new Web Messenger bot or by editing an existing one.

(John King) #17

Hi Daniel @DanielBeckett would you be able to provide code for a button that would sit on a website that when clicked would open the web messenger. I’m using the web messenger bot as a registration for one of my classes so the button on my site would be great. Thanks!

(Karen Barker) #18

Hi John,

When you create a Web Messenger bot you’ll be given 3 ways of integrating this with your website. The third option is by widget, which will automatically add a button on your website which when clicked will open the Web Messenger. You’ll just need to copy and paste the script code for the widget into your website before the closing body tag. :slight_smile:

(John King) #19

Hi @KarenBarker, thanks for the information. I was thinking more along the lines of what you see on this website https://convopanda.com/. I’d like to create a button like the “SEND ME LESSON 1” which triggers the website widget bot to open up. Make sense? Thanks!

(Daniel Beckett) #20

Hi @John_King

That would take some development on your website. You’d need to add in the button to your site and then have that link to your bot’s URL (easier) or use the Web Messenger API to open up the widget.