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.
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.
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.
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.
Mark
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.
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 = 'https://api.telegram.org/'+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;
}
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.