Trigger Action in SambaPOS via GQL

Hi Guys,

I am working on some custom integrations and need a creative way to pass a variable from a node.js script (using GQL to interact with SambaPOS).

Scenario: Node.js script performs some actions, it then needs to send a value back to SambaPOS and when recieved SambaPOS needs to fire an action with that value.

The logical choice seemed to be, “gql.executeAutomationCommandForTerminalTicket” however this fails because it says no ticket is open on my terminal. On the actual main SambaPOS terminal there is a ticket open but it seems my node.js acts as a “terminal” and doesn’t have an open ticket.

Esentially all I need to do is trigger an automation command / rule / action in SambaPOS and pass a single value from a node.js script to SambaPOS.

Does anybody have any creative ideas on how to do this?

Thanks

Broadcast message doesn’t work?

2 Likes

Sukasem it could but the payload data will change, it’s a number (account balance), if I use broadcast data I am not sure of an easy way to handle this.

I could maybe broadcast: “Balance: 10”

But then when I create a rule to handle this, how do I parse just the “10” to use that in another operation? Thats my main issue with broadcast event.

Just use substr(9) in the rule.

1 Like

All you need to do is register a terminal with GQL and then execute command. There is GQL for registering and using a terminal ticket.

1 Like

Do a Broadcast Message with your payload in JSON string format.

The HUB Rules use Script to parse messages that have a JSON format, by default using eventName and eventData.

HUB Message Received calls the script to parse the JSON, and subsequently HUB Process Message decides what to do with it depending on eventName (and sometimes eventData as well). This can include firing Automation Commands, or whatever else your method requires.

2 Likes

Thank you! Perfect! Your system is beautiful :wink:

FYI: This was the last piece to finish a frequent customer multi-store setup. I am using RestDB (Remote Cloud DB) to store customers “VIP Level”, “Number of Visits” and balance. It then syncs between stores!

2 Likes

Very Nice!
I would love to see you post a Tutorial on this when you get a chance…
Cheers Paul.

Paul did you see my customer sync scripts? They might also be of interest to you if not…

1 Like

Was that with your booking system? Yes I did but I was looking for a GQL solution…

It wasn’t with the booking system, it was via my own rest API using a joomla plugin.
It wasn’t a direct link but just a way to sync entity and their data between sites.
It uses a seperate key/ID to link between sites.
Plan to work on one to sync users at some point.

Crikey, missed that one - edit the post so I see it to book mark it or drop a link here. I will
say no more as not to hijack this thread :smile:
CASE: I using FILEMON to send transactions and balances as it has access to the Samba API but as we know it depends on DRIVES as this can be become unstable.