How do I access Web Widget API commands in my React App? | Community
Skip to main content

How do I access Web Widget API commands in my React App?

  • October 19, 2022
  • 1 reply
  • 0 views

Stupid question - I know. But how do I access commands like zE('messenger', 'open'); straight from my react app?

All of those commands are perfectly accessible via console in dev tools. But when I try to access them in my React app functions. It doesn't work.

I basically need this to work:

<button onClick={() => zE('messenger', 'open')}>Open chat window</button>
 
But it keeps saying i dont have zE defined. Yet it works in the console.. Ahh 
 
Thanks!

1 reply

Tipene
  • October 24, 2022

Hey @jiří15,

Can you try calling the zE method against the window object and see if that works for you? i.e:

<button onClick={() => window.zE('messenger', 'open')}>Open chat window</button>