Audience
Campaigns, automations and analytics all resolve to a contact. Transactional sends can also address a raw email or phone number.
Contacts and identifiers
A contact needs at least one of three identifiers, and you may set any combination:
| Identifier | What it is |
|---|---|
email | Email address |
phone_number | E.164 format, e.g. +966512345678 |
external_id | Your own user ID from your own database. Max 255 characters, unique per organization. |
Prefer external_id
external_id outranks email and phone_number everywhere in Arsel:
- History survives contact changes. When someone changes their email address,
external_idkeeps their history on the same contact. Without it you get a broken match or a duplicate. - Events resolve deterministically. Every event carrying an
external_idlands on the right contact, including people whose email you have never collected. - Migrations line up. Set it during import from your previous platform so every later write matches.
Reusing an external_id another contact already holds returns 409. To check whether you have already imported someone, filter on it via List contacts rather than searching by email.
curl -X POST "https://api.arsel.sa/v1/contacts" \
-H "Authorization: Bearer $ARSEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"external_id": "user_8821",
"email": "customer@example.com",
"phone_number": "+966512345678",
"first_name": "Sara",
"properties": { "lifetime_value": 2400, "is_vip": true },
"list_ids": ["0192a1b2-c3d4-7e5f-9000-abcdef123456"]
}'
Lists vs tags
Both group contacts by hand, and campaigns accept list_ids, tag_ids, or both.
| Lists | Tags | |
|---|---|---|
| Model it as | Where someone subscribed — "Newsletter", "Product updates" | An attribute someone has — "VIP", "churned", "webinar-attendee" |
| Typical count | A handful | Many |
| Membership | A contact can be on several | A contact can carry several |
| Set at creation | Yes, via list_ids on Create Contact | No — apply afterwards via Tag Contacts |
Segments
A segment is a rule: the contacts that currently match a filter, such as "opened three emails in the last 90 days" or "on the pro plan and subscribed to SMS". Membership updates as contacts change.
Create one through the API or in the dashboard under Audience > Segments, wait for its status to become ready, then pass its id in a campaign's segment_ids. To see who is in it, call GET /contacts?segment_id=.
Custom properties
Custom properties store your own data on contacts and are what {{variable}} merge tags read from in campaigns. A property with the key city fills {{city}}; the contact's own fields are {{firstName}}, {{lastName}}, {{email}} and {{phone}}. See Merge tags.
Properties are schema-first: define the property before writing values to it. Create a property with a field_key (lowercase letters, digits and underscores, starting with a letter), a human-readable display_name, and a data_type of string, number, boolean or date.
{
"field_key": "lifetime_value",
"display_name": "Lifetime Value",
"data_type": "number",
"fallback_value": "0"
}
Neither of these can be changed after creation:
field_keyis immutable. Renaming means creating a new property and migrating values.data_typeis immutable. A property created asstringcannot later becomenumber.
Set a fallback_value on anything you merge into a subject line or message body. It renders for contacts with no value, who otherwise see a blank.
id, email and unsubscribed collide with built-in contact columns and are rejected. Any other key is allowed; custom properties live in their own contact.properties namespace.
A workable order of operations
- Define your custom properties before importing, or their values are rejected.
- Create the lists people will subscribe to.
- Import or create contacts with
external_idset, properties filled, andlist_idsattached. - Apply tags for attributes that change over time.
- Send events as people act, which keeps behavioural history attached to the same contacts.
Reference
| Contacts | Create, list, update, delete |
| Lists | Create, list, update, delete, list members |
| Tags | Create, list, update, delete, tag and untag contacts |
| Segments | Create, list, update, delete, and the filter reference |
| Properties | Define and manage the custom property schema |