What would Rest API workflow to integrate third party Live Support Script


Can anyone advance what would be rest api workfow to integrate third party live support script.
Basic idea is

  1. I provide logins details in third party script live support script.
  2. I choose in what team a new channel should be created
  3. I choose what users to invite once channel is created
    1,2,3 items are clear what api calls to use.
  4. Questions is how do I make/what call I have to make, than once operators writes a message in mattermost channel live suport chat get’s a Rest API call so Live support script knows there is a new message.

Of course I can just while chat is going issue check for a new messages every few seconds. But ideally it should be just rest api call on new message in a chat channel.

Or i just should create a new webhook for every new channel from live support script?