SambaPOS terminates abruptly on URLPrinter execution

I have followed an example on this tutorial to print a ticket to a Telegram bot

Everything seems to be working until I click on the printer setting Live checkmark. SambaPOS terminates without a message.
I am referring to Manage/Printing/Printers/Telegram Ticket/Settings Live checkmark
With unchecked checkmark I get a correct URL. The termination appears when it actually submits the URL. Developer team, please feel free to contact for additional information in order to recreate the problem.

This forum is for SambaPOS V5 but the guide you linked is for V3 which is very old and no longer supported.

We cannot provide you with support for SambaPOS V3 on this forum.

1 Like

I am running SambaPOS 5, the tutorial is still applicable as the functionality is there

Since you raised the issue maybe it is time to update the tutorial to Version 5, it would be only minor adjustments site is only kept live for users of V3. That is not relevant to V5.

There are plenty of V5 resources including tutorials for better setups on this forum and the knowledge base

There is actually exactly the V3 tutorial upgraded for V5 done back in 2015 - a quick search of this forum would have brought that up…

This tutorial can be automatically implemented using a configuration task as follows:

The same setup can be found on the V5 knowledge base:

So actually it is not that the content did not exist, it is just you were looking in the wrong place for it.

Can you please share a screenshot of your URL printer settings? The tutorial doesn’t seem that far off from how a SMS Url printer is currently setup.

Personally I use Clicksend and instead of using the URL printer I use scripts to pass to their API. That way I can get response info.

1 Like

Mark, with all due respect, I feel you are missing a point. The point I am raising is that the application is crashing. Whether I followed V3 tutorial or V5 tutorial is an interesting subject to explore, however, not the main aspect of the post.

Anyway, thank you for the links, I will read them.

I have the screenshots, but can’t see a way to attach pictures. Please advise.

You can paste it in the post, drag and drop, or use the upload button.

We need to see more of your setup. Also can you check your documents folder for a log and see if it recorded anything.

Finally did you enable the URL printer module in samba market.

Not really…

It is the main point actually - you followed a V3 tutorial made for a product that is now outdated and no longer supported. Not everything made for V3 works exactly on V5 without modification, hence the reason the new V5 tutorials were made. Yes most things should work, but some things require modifications, that is why my first point has always been that you follow a guide for V5 and not for V3.

Your “main aspect of the post” actually was - you followed an outdated V3 tutorial on V5, it does not work as expected and crashes. Maybe you made a mistake in setup, or maybe there is an issue with that tutorial on V5. So it is right my first point to say is this, and if you checked over the newer V5 tutorials may resolve your issue (actually you can just delete the whole setup you did and use the auto configuration task to set up 99% of it for you). It doesn’t make a lot of sense to debug an old V3 instruction for V5 when there already exists a new version of the tutorial.

Maybe you think I’m wrong, but the fact is you followed a V3 tutorial, how you came across that considering you have been a forum user since July 2020 I am not really sure but nevertheless that is fact. SambaPOS do not support V3 or V4, and that includes tutorials made for those versions.

Also as Jesse said, you did not share enough details for us to assist with your issue, so if you could please share that - but I suggest you redo the setup with the auto configuration task or V5 tutorial as it will work better with the latest features that were not available in V3.

1 Like

Printer Setup

Printer Template

Print Job

The URL to be sent

That should get you started in reproducing the problem and fixing the code.
Using the same URL in browser produces following reply
{“ok”:true,“result”:{“message_id”:95,“sender_chat”:{“id”:-1001470452735,“title”:“SlrPosTickets”,“username”:“SlrPosTickets”,“type”:“channel”},“chat”:{“id”:-1001470452735,“title”:“SlrPosTickets”,“username”:“SlrPosTickets”,“type”:“channel”},“date”:1619665139,“text”:“Ticket 74574 ready for print”}}

IMO there is a good chance that the reply is the reason application terminates abruptly.

If this is Date stored in Miliseconds its pointing at year 1970 which could very well be the issue.

EDIT: Nevermind I miss copied the number

I think we have a bit different approach to this situation. I agree with you that to solve my specific problem the easiest path might be to do exactly what you propose. However, that would leave the bug in the SambPOS software. This bug can surface again and cause havoc. Right now I am not in the hurry to deploy the Telegram tickets yet, although will be in few days (all the shops nearby which sell printer paper are in lockdown as non-essential businesses). Kitchen and bar need the tickets to prepare food. In conclusion, right now I would prefer the developers to fix and patch the application or at least trace down the code which breaks.

Is SambaPOS actually doing something with the reply or simply discards it?
I did another test with Live enabled and realized the message is not sent to Telegram Bot. That would lead me to deduce there is something wrong about the URL submission. The text contains spaces which need to be encoded as %20, maybe something to look at.

Yes, the URL printer is installed. Otherwise I wouldn’t be able to create a printer as URL printer.

There is nothing in the Documents folder.

Your request is regarding a custom integration. SambaPOS doesn’t have official integration with Telegram and hence they cant support this request.

As @josephrussell mentioned is what you are trying is similar to his but he uses script to pass the API key.

Its much easier to make a simple send message request via Scripts then trying to use Telegram API endpoints using URL Printers.

Here is an example of passing a ticket number in test. You can call this script in Ticket Closing Rule and pass on {TICKET NO} and voila.

Just change your botId, APIKey and whatever message you want to send.

function test(ticket)
	var chat_id 	= '@PosFlowTickets';
	var message		= 'Is ready for print';
	var botId		= 'bot1324328701';
	var apiKey		= 'AAGio8rCqJB8fpgwPMTT2bOCuuA5-afRhaA';
	var url 		= ''+botId+':'+apiKey+'/sendMessage?chat_id='+chat_id+'&text=Ticket '+ticket+' '+message;
	var request_json = '';
	var response_json = web.PostJson(url,request_json);
	return response_json;

1 Like

That seems to be another way to achieve the same result, I might go that route if the URLPrinter not working out. The issue with this implementation is that it requires fair amount of testing and coding as I need all the info from the Kitchen and Bar ticket to send to the Telegram Bot.

About official integration with Telegram - I am at loss how this is relevant. SambaPOS has a feature called URLPrinter which in essence allows to compile any URL and submit it. Right now we have a demonstration how this feature of SambaPOS breaks. If I were the programmer I would be very keen to fix it.

URL Printer should be fine for this usage. The only reason why I went with scripts is to receive response text and to handle multiple values from a properties editor. Honestly, there is no reason the URL printer should be closing Samba (IMO). Its not receiving a response and handling any specific data. Now I’m curious and have to play with it.