I'm setting up our system to match up contacts with the geographical regions covered by our different chapters. I've gotten to the point of using the built in geocoding, along with polygon coordinates stored in a custom field for each chapter, to be able to create a relationship showing a contact "in the territory of" a chapter. I'll use hooks to create or remove the relationship if a contact address or chapter region changes.
I envisioned having multiple smart groups for each chapter - contacts who are "in the territory of" and members, or volunteers, or on the national mailing list, etc.
Is there a way to create smart groups via the API or DAO calls? It'd be ideal to create desired smart groups via a hook if a new chapter is added, rather than having to manually search on the desired parameters and create each group.
If not, maybe I'll create static groups from hooks, then have a cron job that syncs contacts to those groups. Basically implementing my own smart groups. Thoughts?