Select Customer Entity via GQL while ticket open in sambapos

I am trying to figure out how to create a module for customer to put his phone number in Tablet touch screen for rewards. So while ticket is pulled up before cashing customer out employee will ask if they would like to enter rewards phone number in tablet.

My assumtions/realizations:

  1. So I came under the conclusion that there is no GQL mutation that will magically take in a ticket id and allow us to select a customer entity for it.

  2. I tested using a “Change Ticket Entity” action to select customer when i manually click AC and it works great the customer automatically shows up at the top and is selected fine. So now i tested using graphql to broadcast message and setup rule when message recieved to execute the same actions that worked before when done locally but this time for some reason the customer does not get selected. So my assumtption is in order to select customer in opened ticket on terminal, you must manually do it yourself?

  3. At last I tested, closing ticket in samba terminal, firing broadcast message, and then… Load Ticket with id, execute “Change Ticket Entity” and it worked perfectly. I would like the customer to obviously be able to add phone number while they are being cashed out or before their ticket is closed so this unfortunately wont be a solution.

Any ideas?

Thanks

Can you open the same ticket at the same time on two terminals?

No you cant. I guess I was kind of hoping we could somehow have the functionality to add a customer to an active ticket though. Would be really powerful to have a rewards system built in.

So i was just confused why the action “Change Ticket Entity” is not working when its being fired by message received rule but working just fine when automation command button is manually pressed inside sambapos terminal

It will not act on message received if ticket is open. That could cause al kinds of havok. Same reason it won’t act on a trigger if open ticket.

Could you use broadcast message to pass the number through to the terminal and do rest of the automation on the terminal with the open ticket?

Thats what im trying to do. So I have phone number coming in through broadcast message. From there i have a rule setup when Message received try to run “Change Ticket Entity” action with the phone number that came in the message. Ticket is open in sambapos terminal the whole time while this action is trying to fire. It fires as verified by rule debugger but entity does not change. It works when i create a AC button that is manually pressed and make it fire “Change Ticket Entity” though.

Are you sure it’s not being set but not visually shown? If you close and reopen is it set?
You might need to make the message show a pop-up that you select which triggers the automation.

No its not. I verified by refreshing ticket and even closing and reopening it.

Whats really confusing me is the “Change Ticket Entity” action is running under the same exact conditions but when executed by message received rule its not working. When i setup a test AC button it works just fine. How is that execution any different.

Read what I said. If ticket is open triggers or broadcast message will not fire an action that is by design.

Okay thanks for clarifying that. Do you think there is any way I could possibly select a customer on an open ticket? @QMcKay any ideas on developing a full rewards system through your modules?

You won’t be able to access a ticket that’s open unless it’s from the terminal that has the ticket open.

You need to explain more what you want with rewards. There are lots of rewards points tutorials already. Are you trying to develop a system like five-stars has?

Well the only challenge is getting the ticket linked to a customer via phone number Input through graphql. Ideally what I am trying to accomplish is a way to pass a phone number via graphql and link customer to active ticket on sambapos register as customer is getting cashed out. My plan b is to just have employee type in phone number but I’m trying to avoid that in hopes that I can just somehow use the api.

Can you please clarify something, isn’t the action being run from the terminal that has the open ticket? All that I’m doing from an external source is grabbing the information to run the action with and then the station with the open ticket is running the action. My logic was that since the action was running in the same terminal it wouldn’t be an issue.

Hmm I’m stumped though I guess I’ll just accept that the my ideal flow setup isn’t possible for now. Maybe in v6

And yeah the five stars rewards system is so ideal, I love it. If we can get something like that it would be awesome

1 Like

If you can get the data from the GraphQL on the terminal, why not use jscript and from that run updating entity data?

Because the open ticket in terminal cannot be changed unless its closed.

I figured out how im going to do it tho. I am going to use a 3rd party rewards api and just manage customers on there. When samba selects a customer ill also select it in the loyalty system.

There are three ways to get the data with GraphQL

  1. open a terminal via graphql and manipulate a ticket in that terminal.
  2. use message server to send a broadcast message and message received rule event to execute some actions.
  3. use internal graphql via jscript from inside the SambaPOS software.

The message server broadcast message method will NOT work if a ticket is open on a physical terminal. The internal method would not work with an external source of input because its internal only. So your left with 2 methods. Message server via broadcast message or virtual terminal method neither of them will allow you to have an open ticket to manipulate via an external source while the ticket is open on physical terminal.

1 Like

Im sorry so just to clarify, can we manipulate an open active ticket on terminal via graphql with method #1? From my understanding you said no right?

I was thinking using sql to update it, if it was disabled.

That is not what I said… when you open a terminal with graphql its a virtual terminal… not a physical one. And no you cant open the ticket thats already open on a physical terminal.

That can be very dangerous if you have an open ticket. You should avoid direct SQL editing as much possible.

1 Like

Okay thats what I thought. Im thinking the only option we have is to manage customers externally in some loyalty rewards system. Thats probably better anyways. The platform is very well built with some cool rules for promotions and stuff.

To be honest I personally would never want to put a card for a restaurant in my pocket. So we are trying to stick with typing phone number in.