Write a contact

How to store a contact to Airship

Endpoint

https://api.airship.co.uk/v1/contact

Configuration

Basic contact payload

{
  "account_id": 3,
  "full_contact_object": false,
  "first_name": "John",
  "last_name": "Smith",
  "mobile_number": "07780704261",
  "gender": "M",
  "email": "johnsmith@airship.co.uk",
  "dob": "1982-01-16",
  "source_id": 125795,
  "allow_sms": true,
  "allow_email": true,
  "units": [
    {
      "id": 8775,
      "groups": [
        {
          "name": "My First Group",
          "folder_name": "Web signups"
        }
      ]
    }
  ]
}

Using rules

When creating a contact, you can also opt to use one of our "rules". These have been created to allow you to control how your contact will be stored in Airship, and can help take away the strain of dealing with extra logic to handle these scenarios within your app.

Example using "rules":

"account_id": 3,
"email": "johnsmith@airship.co.uk",
//...etc...

"rules": [
    {
      "rule_name": "preserve_consent"
    },
    {
      "rule_name": "discard_invalid_data"
    }
]

Contact notes

Contact notes are optional, and can be appended to a contact record. A note cannot be amended once added, and we will add a new note for every request we receive with a notes field

"account_id": 3,
"email": "johnsmith@gmail.com",
//...etc...

    "notes": [
        {
            "text": "I liked the cocktails!",
            "created_at": "2024-02-10 15:10:00"
        }
    ]

Custom fields

As well as the standard fields documented on our API Reference, we can also store custom values to User Defined Fields (UDFs). These have to be pre-created in the Airship dashboard and you will need to know the UDFID of the field you wish to write data to.

UDFs can be passed in as an array as part of your payload.

"account_id": 3,
"email: "johnsmith@gmail.com",
//...etc...

"udfs": [
    {
      "id": 1234,
      "data": "some text"
    },
    {
      "id": 5678,
      "data": "2021-05-01"
    }
  ]

Mobile number validation

Mobile numbers are validated for an accepted prefix, which can be any of the following:

4471, 4472, 4473, 4474, 4475, 4476, 4477, 4478, 4479, 071, 072, 073, 074, 075, 076, 077, 078, 079

Email validation

Emails are validated to contain a @ and a . and are also checked against a list of domains with valid MX records, to protect against commonly mistyped or fake domains.

Last updated