nogueira Posted November 22, 2022 Share Posted November 22, 2022 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 ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.