Contacts

Retrieving contacts

You can retrieve contacts easily with a GET request to the /contacts endpoint. A simple /contacts will result in all contacts being retrieved with all of their information. No filters are applied.

Once the request is placed, the response is a list of URLs to each of the contacts that the API user has access to or has requested via the search criteria.

Note: The sample request here shows contacts from the default workspace. If you need to retrieve contacts from a specific workspace, ensure that the workspace information is passed in the URL.

URI for default workspace:

https://api..whispir.com/contacts?apikey=

URI for a specific workspace with ID BC348DC83DF1AB34:

https://api..whispir.com/workspaces/BC348DC83DF1AB34/contacts?apikey=

Get a specific contact

To get details for a specific contact, the URI must be passed with the ID of the contact. So, the URI will be:

https://api.<region>.whispir.com/contacts/AF48A9EC3F02E43C

Where AF48A9EC3F02E43C is the contact ID.

Showing custom fields

Whispir supports extension of the default contact profile through the use of custom fields. Custom fields can support other fields that may be required to be stored on your contacts, such as Staff ID, Internal Billing Codes, or One Up Manager.

These custom fields can be configured on any account through a change request to Whispir.

In order to reveal these custom fields on the contact profile, you can use the customFields=true flag within your API request.

/contacts/AB38CB3EFD38AFDB?customFields=true

  • JSON
  • XML

Retrieving a list of contacts

Contacts can easily be retrieved from the Whispir API using the following endpoints:

{{codeStart}}

HTTP 1.1 GET https://api.<region>.whispir.com/contacts?apikey=<your_api_key>

Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk

x-api-key: your_api_key

Accept: application/vnd.whispir.contact-v1+json

{

"status": "1 to 1 of 1",

"contacts": [

{

"id": "AF48A9EC3F02E43C",

"firstName": "Fred",

"lastName": "Smith",

"status": "A",

"messagingoptions": [],

"link": {

"method": "GET",

"rel": "self",

"uri": "http://api.<region>.whispir.com/contacts/AF48A9EC3F02E43C?apikey=<your_api_key>"

}

}

]

}

{{codeEnd}}

Retrieving a specific contact

Users can retrieve a specific contact by supplying the Contact ID in the URL.

{{codeStart}}

HTTP 1.1 GET https://api.<region>.whispir.com/contacts/AF48A9EC3F02E43C?apikey=<your_api_key>

Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk

x-api-key: your_api_key

Accept: application/vnd.whispir.contact-v1+json

{

"id": "AF48A9EC3F02E43C",

"firstName": "Fred",

"lastName": "Smith",

"status": "A",

"messagingoptions": [],

"link": {

"method": "GET",

"rel": "self",

"uri": "http://api.<region>.whispir.com/contacts/AF48A9EC3F02E43C?apikey=<your_api_key>"

}

}

{{codeEnd}}

Showing custom fields on contacts

Within Whispir, contacts can have custom fields to store data that is not supported on the default contact profile. Users can show this custom data for contacts by adding the customFields=true query parameter.

{{codeStart}}

HTTP 1.1 GET https://api.<region>.whispir.com/contacts?apikey=<your_api_key>&customFields=true

Authorization: Basic am9obi5zbWl0aDpteXBhc3N3b3Jk

x-api-key: your_api_key

Accept: application/vnd.whispir.contact-v1+json

{{codeEnd}}