Blog/

Competitive Flash: Shortest ‘Major Release’ Ever

16 × 9

When I was much younger I used to do a lot of systems administration work and I had a t-shirt (popular in the day) that read ‘go away or I will replace you with a very small shell script’.

Yesterday one of our competitors made a ‘new major version release’ of their software.  Never mind that this version was a x.5 release. That’s not important.  The press release touted two major features: one was something that sounds a lot like our Supercharger feature (updating of their architecture to handle heavily multi-core machines).  We did that two years ago and the results have been phenomenal.

The other was allowing users to ‘hold’ individual messages until a specific time.  This is often known as ‘send time optimization’ and is also very useful.  We first implemented it about 4 years ago, and for customers that can optimize their user engagement by sending to users at specific times it’s really useful.

I wanted to take a second to showcase not only this feature, but how ridiculously powerful our embedded Lua support is.

Here, in it’s complete and full glory, is how you implement that within Momentum.  Don’t blink, it’s only 36 lines (including whitespace), so you’ll want to pay attention.

require 'msys.core' require 'msys.extended.message' require 'posix'

local mod = {};

function mod:validate_data_spool_each_rcpt(msg, ac, vctx) local h = table.concat(msg:header("X-MSYS-Hold-Until")) if h != '' then msg:context_set(msys.core.ECMESS_CTX_MESS, 'X-Hold-Until', h) end end

function mod:core_ec_message_enqueue(msg, now) local t = msg:context_get(msys.core.ECMESS_CTX_MESS, 'X-Hold-Until') if tonumber(t) ~= nil then msys.core.set_time(msg.next_attempt, tonumber(t), 0) msg:set_next_attempt(msg.next_attempt) end return 0 end

function mod:core_mailq_insert_active(mq, msg) local t = msg:context_get(msys.core.ECMESS_CTX_MESS, 'X-Hold-Until') if tonumber(t) ~= nil then local sec, usec = posix.gettimeofday(); if tonumber(t) > sec then local now = msys.cast(msys.alloc("msys.core:_ec_timeval_serialized"), "msys.core:timeval") msys.core.get_now(now); msys.core.ec_message_enqueue(msg, now) return 0 end end end

msys.registerModule("v4_5", mod);

And that’s it. Shortest ‘major release’ ever.

Start with one channel.
Add the others when you're ready.

A test API key is yours immediately. Production unlocks when you add a payment method and verify a sender.

Get startedRead docsor

Using Claude Code, Cursor, or Codex? Point it at our MCP server — tools for every channel we expose, with scoped agent keys.

Cursor