Post/Contacts
Contacts are the foundation of the inwise platform. Two key fields can be used to create contacts: the email address or/and the mobile number.
Create or update contacts by using email address or/and mobile number.
You may add more additional data field (we call them personal fields) such as firs name, last name, birthdate etc.
You can add contacts to a specific contact group using the add_to_groups_ids object, and the key is the Group ID, you can find it in your inwise account.
Example 1 – Add 1 contact
{
"id": 0,
"email": "contact1@company.com",
"mobile_number": "972541111111",
"fields": [
{
"name": "field1",
"content": "test name"
}
],
"confirmation_status": "confirmed",
"add_to_groups_ids": [
721129
],
"remove_from_groups_ids": [
0
],
"remove_from_all_other_groups": true,
"clear_existing_fields": true,
"external_id": "string"
}
Example 2 – Add contact with personal fields (first name, last name, birthday)
{
"email": "contact1@company.com",
"mobile_number": "972541111111",
"fields": [
{ "name": "field1",
"content": "fname1"
},
{ "name": "field2",
"content": "lname1"
},
{ "name": "field21",
"content": "12/06/1980"
}
],
"confirmation_status": "confirmed",
"add_to_groups_ids": [715983]
}
Example 3 – Add contact with support for local mobile
{
"email": "contact1@company.com",
"mobile_number": "0541111111",
"trim_mobile_number_leading_zero":true,
"add_default_country_to_mobile_number_only_if_not_exists":true,
"mobile_number_default_country_code":"972",
"fields": [
{ "name": "field1",
"content": "fname1"
},
{ "name": "field2",
"content": "lname1"
},
{ "name": "field21",
"content": "12/06/1980"
}
],
"confirmation_status": "confirmed",
"add_to_groups_ids": [715983]
}
POST /contacts/batchInsert
An example of calling the method to import contacts
{
"csv_file":
Email,Mobile,Firstname,Lastname
contact1@company.com,0541111111,fname1 ,lname1
contact2@company.com,0541111112,fname2,lname2
",
"fields_mapping": [
{ "field_name": "[Email]", "file_column_name": "Email" },
{ "field_name": "[MobileNumber]", "file_column_name": "Mobile" },
{ "field_name": "1", "file_column_name": "Firstname" },
{ "field_name": "2", "file_column_name": "Lastname" }
],
"group_id": "XXXXXX",
"updateExistingContacts": true,
"country_code": "972",
"trim_leading_zero": true
}
' 'https://api.inwise.com/rest/v1/contacts/batchInsert'
GET /contacts
This method returns the 1000 most recent contacts from your inwise account. As a result, a list of contacts will be generated with their personal fields.
search_by_updated_or_added_date=false – Don’t refer to the updated contacts, but only the created ones.
limit=1000 – Return up to 1000 rows, which is the maximum possible.
reset=false – Rows returned in previous reads will not be returned in future reads. Each time you make a call, you will only receive new contacts.
{
curl -X GET --header 'Accept: application/json' --header 'X-API-Key: XXXXXXXXXXXXXXXXXXXXXXXXXX' 'https://api.inwise.com/rest/v1/contacts/recently_updated?search_by_updated_or_added_date=false&reset=false&limit=1000'
Response code
If everything goes well, you should get a success response (Response code 200) with a JSON body giving you the id of the contact created.
If you get (Response code 422) – Failed because of a conflict. Its mean that “The email exists for contact ID #439130785.The mobile number exists for contact ID #439134049.”