Building Segments Based on Contact ID

Does anyone know if there is anyway to build a segment based on contact id.

We need to build certain size segments and would like to be able to build them with filters like contact_id > 1 and contact_id < 100.

I have checked out the SQL plugin, however from what I can see this only works inside a campaign.

Our main issue with using this is we are running a client with close to 1M contacts, so if we were to use this inside a number of campaigns this would still take a very long time to update each campaign and then to even trigger these events in each campaign

You want to create contact ID based segments because you want to run multi thread campaigns or paralell execute things?

if I understand my needs correctly parallel execute things.

My main issue to be more specific is we have a limitation of sending out around 10K SMS per hour, however if I split this into separate campaigns with separate sms messages, then I am able to send out 10K multiplied by the number of campaigns I have set up for that specific hour

I think you are better off multi-threading.

mautic:campaigns:trigger [options]

-i, --campaign-id[=CAMPAIGN-ID]
Trigger events for a specific campaign. Otherwise, all campaigns will be triggered.
Limit number of contacts on a per campaign basis
Trigger events for a specific contact.
CSV of contact IDs to evaluate.
Trigger events starting at a specific contact ID.
Trigger events starting up to a specific contact ID.
The number of this current process if running multiple in parallel.
The maximum number of processes you intend to run in parallel.
Just kickoff the campaign
Just execute scheduled events
Just execute scheduled events
-l, --batch-limit[=BATCH-LIMIT]
Set batch size of contacts to process per round. Defaults to 100. [default: 100]
-f, --force
Force execution even if another process is assumed running.
Bypass locking.
-t, --timeout=TIMEOUT

You can divide the ids into ranges and execute accordingly.
I have a proof of concept of this already working, but haven’t got time to do a nicer version.
It works similar to the smart segment script I wrote.

1 Like

Hello @mikew,

You can solve this point with what @joeyk proposes or you can see with your SMS provider to make this limit evolve :wink:

For my part, I have a provider to whom I send the volume I need AND he will then smooth this volume over time. Everyone has a role to play.


Hi, thank you formyour imput.
This is not about the sms limits.
Its about Mautic capability to process campaigns fast enough.
If Mautic can process 2500 steps / min, then 1 mill contact takes 400 minutes = over 6,5 hours.
But if you process in 6 threads by limiting each thread to a certain id range, then u can do it in over 1 hour.