Skip to main content
8x8 Support

Creating an API Token for ContactNow

Objective

To create an API Token. API access tokens are used to authenticate individual calls to read or write ContactNow contact center data, from outside the standard ContactNow agent or admin interface.

To create access tokens for the ContactNow API, you will first need ContactNow API key credentials for your specific contact center. To obtain an API username and key, Create a Case with 8x8 Technical Support. Once you've obtained the username and key, you can follow the instructions below to create your token and use the API functionality.

Applies To

  • ContactNow
  • ContactNow API
  • API Token

Procedure

Access the ContactNow API URL

To access any ContactNow API interface, requests need to have an access token. The token will authorize requests for a particular account for a fixed period of time. By default, these requests are restricted to the internet address that requests the token.

API URL to manipulate tokens

https://api.contactnow.8x8.com/token.php?action=get&username=[insert your username here]&password=[insert your password here]

The Token API has a number of available functions. The request arguments can all be passed as HTTP Post or Get variables. The response from the API can be formatted in either JSON or XML format. The default is JSON but this can be modified by the format argument below:

Format: XML or JSON

The API will output a number of optional values depending on the request made.

Success: This shows whether the request succeeded. It will contain a true or false value for JSON or a 1 or 0 for XML.
Error: If the request failed, this field will contain a description of the fault.

Example of JSON Return:

{"success":true,"token":"bd932b769fc7263316345627d0a9ef3b8f8d1f8d","expire":1307975676}

Example of XML Return:

<result>
    <success>1</success> <token>bd932b769fc7263316345627d0a9ef3b8f8d1f8d</token>
    <expire>1307975676</expire>
</result>

Obtain a Token

This will return a new token if none exists or a previous token has expired. If a valid token already exists it will return the current details. Currently, all tokens are valid for a 12 hour period but this is subject to change. By default, the get request authorizes the IP address that sends the authentication request. This can be modified by sending the optional address argument set to the required IP address. This is typically used when a central application server needs to generate tokens for client end-point machines, e.g. ajax code.

Action: get
Arguments: username, password, address (optional)

token.php?action=get&username=...&password=...

This will return the following:

Token: The token id value.
Expire: The timestamp of when the token expires. This is in Unix timestamp format, the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

Validate a Token

Check to see if the specified token is still valid or not.

Action: validate
Arguments: token

Example:

token.php?action=validate&token=...

This will return the following:

Expire: The timestamp of when the token expires.

Delete a Token

Unauthorize an existing token.

Action: delete
Arguments: token

Example:

token.php?action=delete&token=...

Change a Password

Change the password for the given account by entering in it in the token API.

Action: newpass
Arguments: Enter your password and the token ID value.

Example:

token.php?action=newpass&password=...&token=...

Additional Information

The following 8x8 ContactNow API reference material is available to the public. Each link will open a new browser tab:

 

  • Was this article helpful?