I have a questionnn.
I have a scenario that is triggered when a new email is received from a specific client, a message is then sent to slack letting us know that - that client has sent us an email. What it does right now is when that specific client sends an email it sends one message to slack then when that client emails again after the first email it sends another message to slack.
What I want to happen is to wait until the client is done sending emails (a wait time of 2 minutes since last email) and sends only one message in Slack containing the number of emails that client has sent.
So instead of sending 4 slack messages after 4 emails, there would be just one message sent to Slack letting us know that the client has sent us 4 emails.
is this possible?
Thankss so muchh!
Hello,
Welcome to the community.
Yes, it is possible.
If you are on the “Pro” plan or higher, you can use custom variables.
On any other plan, you should set up a database to store the timestamp of the last email and then use simple logic to check if the next email is sent within the desired timeframe.
Have a nice day!
Thank youu! I have the idea now! I guess I do have a follow-up question.
How do I make it so that after 2 minutes of not receiving emails anymore it would then send the message to Slack?
Because what I imagine from what I want is, when an email comes in, it saves the timestamp to a database then it “waits” for 2 minutes for incoming emails (referencing the timestamp in the database), if a new email comes in within the 2 minutes, that 2 minutes reset, but if I don’t receive any other emails within that 2 minutes it should send a message to slack that we received one email after the 2 minute “wait”.
You need to create the entire logic.
What I suggest:
- First email – check the database:
- If the last email was sent more than an hour ago, assume the sequence should start from the beginning.
- Log the timestamp in the database.
- Set a 120-second timer.
- Send a Slack message.
- If the last email was sent within the last 5-10 minutes, ignore it.
Does this make sense?