Jump to content

UniSession.AddJS erro ao enviar multiplas requisicoes


nogueira

Recommended Posts

Bom dia, amigos,

to com um problema simples:

 

quando coloco um certo codigo no unigui com UniSession.AddJS, e executo por vez, funciona. quando envio varios, as instrucoes se repetem.

 if H2 = 'SIM' then
                                  BEGIN
                                  if (length(Z2) >= 9)   then
                                        begin
                                        varbody :=  unimemo5.text;
                                        super_string :=  'var settings = {'+
                                          '"url": "https://app.whatsgw.com.br/api/WhatsGw/Send",'+
                                          '"method": "POST",'+
                                          '"timeout": 0,'+
                                          '"headers": {'+
                                          '  "Content-Type": "application/x-www-form-urlencoded"'+
                                          '},'+
                                          '"data": {'+
                                          ' "apikey": "xxxyyyxxxy  yyxyxyxyxyx ",'+
                                          '   "phone_number": "55xxx xxxxx",'+
                                          '  "contact_phone_number":'+'"'+'55'+Z2+'",'+
                                          '  "message_custom_id": "yowsoftwareid",'+
                                          '  "message_type": "image",'+
                                          '  "message_caption": "comunicado importante",'+
                                          '  "message_body":'+'"'+varbody+'",'+
                                          '  "message_body_mimetype": "application/pdf",'+
                                          '  "message_body_filename": "comunicado.pdf",'+
                                          '  "download": "1"'+
                                          '}'+
                                        '};'+

                                        '$.ajax(settings).done(function (response) {'+
                                        '  console.log(response);'+
                                        '});';


                                        UniSession.AddJS(RetiraEnter(super_string));

                                        end;

                                  END;

 

com este codigo acima envio mensagens atraves de uma plataforma de whatssap.

 

situacao 1: quando envio um por vez da certo

situacao 2: se enviar varios, as mensagens do corpo ficam repetidas.

 

ja limpei as variaves, fiz de tudo. so funciona se eu der um tempo pra enviar outra.

 

isso é um bug ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...