I'm new in Mathematica. So I'm unable to settle a matter. When I insert an if block into the ScheduledTask, I'm entering the password and the program is closing. What is my mistake? Can you help me please?

obj = SessionSubmit[
     "https://api.archis.company/welcome", {"StatusCode", 
     "Body"}] == 
     <|"StatusCode" -> 200, "Body" -> "\"Welcome To ArchisAcademy API!\""|>, 
      SendMail["[email protected]", 
      "Here is the body of the message."]],
      {Quantity[1, "Seconds"], 30}]]
  • $\begingroup$ Did you try just If[URLRead... to see how your condition works? Also === would be more appropriate, and even more MatchQ[ KeyValuePattern["StatusCode"->_] ]. $\endgroup$
    – Kuba
    Dec 30, 2020 at 12:24
  • $\begingroup$ Yes I have already tried and it's working. Could the problem be on the schedule? $\endgroup$
    – seher
    Dec 30, 2020 at 14:22
  • $\begingroup$ Why and where are you entering a password? Is a password dialog popping up when the scheduled task runs? Is that for the email? If so, I think you will need to eliminate the need of that interactive password dialog, I am quite sure that this will create problems within the scheduled task... $\endgroup$ Dec 30, 2020 at 16:12
  • $\begingroup$ It's email's password for authentication. So how can I log in without opening the password dialog? $\endgroup$
    – seher
    Dec 30, 2020 at 17:23
  • $\begingroup$ How come it shows you the dialog, I am getting "AuthenticationDialog is not currently supported within preemptive evaluations." - message. Which can be worked around with: mathematica.stackexchange.com/a/206416/5478 $\endgroup$
    – Kuba
    Dec 31, 2020 at 7:38


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.