Inconsistent email messaging system

Hi there

I have been trying to get to the bottom of some reliability issues so I decided to put some messaging at the beginning and end of a sequence so I could tell when they ran. Here is the sequence.

The issue is that the email only comes through some of the time. I have sometimes received the start message, the end message, both or none.

The log files show success but the messages are not coming through. In this case, no messages came through, but an earlier run sent through the end message only.

Messages sent to the email channel should get batched and sent as a digest I believe every 10 minutes. Are you not receiving the messages at all, or were you just expecting them to always come through one by one immediately?

I am aware of the batching which is fine. I am finding that sometimes I get the first message, or the second, of both or sometimes - none. I can see the sequence ran (scheduled) from the log file but no email arrived. It is a bit random.

Here is a sequence that I have run once a day.

It sends an email at the start and end of the sequence.

Sometimes I get an email. Sometimes, I do not get an email.

When the email arrives, sometimes it has the first message only, sometimes the second message only, and sometimes I get both messages.

There appears to be no pattern to the event.

What is a typical elapsed time (end - start) ?
Are you seeing any internet comm dropouts over the period this sequence runs ?

edit

Disappointingly my bot concurs with your bot.

Are you going to open a FarmBot Inc. Support Issue ?

Edit: Somewhere in the WebApp code I think I saw a limit of 20 email-digest-sends per hour (?)
Did you see that ?

Sequence takes about 7 minutes.
No drop out that I can detect.

When you are saying you submit a ticket. Are you referring to sending an email to support or is there a better way? I have had more success in getting attention and resolution in this forum, with interacting with your good self and Rory then sending email to support.

Send an email ( and hope FarmBot Inc. in-bound emails still work reliably :slight_smile: )
I don’t know how often Rory Aronson visits this Forum.

P.s. Seems like the Web App LogDeliveryMailer worker has collapsed a.t.m.

Hi @mvillion

I’ve never used email widely, since email in its nature is not very fast / reliable. Have you testet the Teamswebhook yet? Thanks to the blog post over here Microsoft Teams Webhook I was able to modify it slightly to use it in all my sequences.

My code

looks like this and consists out of three variables:

→ EDIT: Decided to directly publish it, so you can easily clone it from here: The FarmBot Web App :partying_face:

The code:

title = variable("Title")
subtitle = variable("Subtitle")
message = variable("Message")

local sections = {
{
["activityTitle"] = title,
["activitySubtitle"] = subtitle,
["activityImage"] = "https://forum.farmbot.org/uploads/default/original/2X/3/3644d5941650ef4a0e9b91eb44d46c7d05faea05.png",
["facts"] = {
{
["name"] = "Local time",
["value"] = tostring(local_time("hour")) .. ":" .. tostring(local_time("minute"))
},
{
["name"] = "Message",
["value"] = message
},
},
["markdown"] = true
}
}

-- Create the message payload for Msft Teams
local payload = json.encode({
["@type"] = "MessageCard",
["@context"] = "http://schema.org/extensions",
["summary"] = "Farmbot Status Update",
["themeColor"] = "8EA604",
["sections"] = sections
})

-- enter your webhook url here
local url = "https://<mytenant>.webhook.office.com/webhookb2/xyz"

local res, err = http({ url = url, method = "POST", headers = {}, body = payload })

if err then
send_message("error", "ERROR: " .. inspect(err), {"toast"})
else
send_message("debug", "REQUEST SENT: " .. inspect(res))
end

Sample on how to use it in a sequence:

Just use it where ever you need it…

Result:

How to get a webhook URL

Follow the instructions over here: Create an Incoming Webhook - Teams | Microsoft Learn

2 Likes

Hi @mvillion Are any log emails arriving at the moment ? (nil for me)

Edit: I am receiving logs on the email channel now . . was user error : debug-level logs are not sent to email channel.