One of the most requested uses cases is "how can I create contacts in my MoonMail account programmatically?" This is very easy to do with MoonMail GraphQL API.
In this guide we will create a dynamic segment that will include all contacts that have attribute
Type equal to
Customer, but you can choose any attribute that you want.
1. Creating a dynamic segment for your contacts.
If you don't know how to do a mutation, please check GraphQL API section first.
In this mutation we create a segment with name "My customers" and specify Dimensions to include all contacts that have attribute Type equal to Customer.
2. Adding your contacts to the created segment.
To add contacts to this segment you need to specify attribute Type with value Customer. You can also provide additional attributes and metrics when you add new contacts. Contacts can be included in multiple dynamic segments at once based on different attribute filters.
Provide the following GraphQL variables:
Now you can use your new segment to send a campaign to those contacts.