Using ecnow_records API ecnow.php endpoint for Live Records in ContactNow
API ecnow_records are used to create, read and update live records, from outside the standard ContactNow agent or admin interface.
To create access tokens for the ContactNow API, you will need to create a case with 8x8 Technical Support to obtain an API username and key. Once you have the username and key, you can use the instructions on the following link to create a token for using the API functionality. ContactNow API Access
NOTE: 8x8 does not provide programming support for the ContactNow API. However, further API reference material is linked in the Documentation section at the bottom of this article.
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.
The API url to manage these records is
US Platform --> https://api.contactnow.8x8.com/ecnow.php?token=[Token]&method=ecnow_records&action=[Action]&format=[Format]&id[Record_id]&raw=1 UK Platform --> https://api-106.dxi.eu/ecnow.php?token=[Token]&method=ecnow_records&action=[Action]&format=[Format]&id[Record_id]&raw=1
The ecnow_data API has a number of available functions. The request arguments should be passed as HTTP Post or Get variables. The payload / 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.
- Account ID: This shows the authenticated account that ran the API call.
- Total: Number of records affected.
- Bad: Number of records that failed.
- Key: the uniqueue ID that is returned when creating a new record.
- Error: If the request failed, this field will contain a description of the fault.
- Info : returns the information from the response.
Example of JSON Response:
{"success":true,"account_id":"1234","total":1,"bad":0,"info":"Record is NOT live on the dialer due having a complete outcome."}
Example of XML Response:
<result> <success>1</success> <account_id>1234</account_id> <total>1</total> <bad>0</bad> <info>Record is NOT live on the dialer due having a complete outcome.</info> </result>
To create a record using ecnow.php endpoint
This will create a new record and return its success state and a unique key or any errors in the request. If the record already exists it will add a new record with the current details resulting in duplicate records.
- HTTP Request: POST
- Method: ecnow_records
- Action: create
- Arguments: raw, format
- Payload: dataset, homephone (optional), mobilephone (optional), workphone (optional) (note: at least one ddi should be entered), address1 (2)(3)(4) (optional) postcode (optional), firstname (optional), lastname (optional), title (optional), <custom_fields> (optional)
POST API call with json:
ecnow.php?token=[Token]&format=json&method=ecnow_records&action=create&raw=1
json Pay Load:
[{"title":"Mr","firstname":"Joe","lastname":"Blogs","mobilephone":"07123456789","dataset":"100","company_name":"Company Name"}]
The Response:
{"success":true,"account_id":"10278","total":1,"bad":0,"key":550447,"info":"Record is LIVE on the dialer."}
xml Pay Load:
<easycall> <ecnow_records> <id>550447</id> <FirstName>Joe</FirstName> <LastName>Blogs<LastName /> <dataset>100</dataset> <MobilePhone>07123456789</MobilePhone> <company_name>Company</company_name> </ecnow_records> </easycall>
The Response:
<result> <success>1</success> <account_id>10278</account_id> <total>1</total> <bad>0</bad> <key>550423</key> <info>Record is LIVE on the dialer.</info>
Reading records using ecnow.php endpoint
Read the data/records of a dataset.
- HTTP Request: GET
- Method: ecnow_records
- Action: read
- Arguments:
- At least one of these arguments are required - table (name of the campaign database name), dataset (dataset ID)
- id (optional), outcome (match outcome code or comma-separated list of outcome codes) (optional), format, dataset, table (campaign name), timetype (callback OR processdate), tstart, tstop, mode (processtype), agent (Agent Ref), search[ ] (optional to search against a field [ ] and provide a value to match example "search[loaddate]=2019-01-22" )
Example:
https://api.contactnow.8x8.com/ecnow.php?token=[Token]&format=json&method=ecnow_records&action=read&dataset=100&raw=1
json Response:
{"success":true, "total":5, "list":[ {"Address1":"", "Address2":"", "Address3":"", "Address4":"", "Address5":"", "Address6":"", "AgentRef":"0", "Agent_Specific":"0", "callback":"0000-00-00 00:00:00", "Call_Back_Notes":"", "Call_Back_Sametime":"0", "company_name":"Company Name", "datasetid":"100", "FirstName":"Joe", "HomePhone":"", "id":"550431", "LastName":"Blogs", "loaddate":"2019-01-07", "MobilePhone":"07123456789", "notes":"", "outcomecode":"100", "Postcode":"", "ProcessDate":"0000-00-00 00:00:00", "ProcessType":"New Prospect", "sourcefile":"api_data_100.dat", "test_field":"", "Title":"Mr", "URN":null, "VENDOR_URN":null, "WorkPhone":""} ]}
xml Response:
<?xml version="1.0" encoding="utf-8" ?> <result> <success>1</success> <total>2</total> <list> <ecnow_record> <Address1 /> <Address2 /> <Address3 /> <Address4 /> <Address5 /> <Address6 /> <AgentRef>0</AgentRef> <Agent_Specific /> <callback>0000-00-00 00:00:00</callback> <Call_Back_Notes /> <Call_Back_Sametime /> <company_name>Company Name</company_name> <datasetid>100</datasetid> <FirstName>Joe</FirstName> <HomePhone /> <id>550423</id> <LastName>Blogs<LastName /> <loaddate>2019-01-07</loaddate> <MobilePhone>07123456789</MobilePhone> <notes /> <outcomecode>100</outcomecode> <Postcode /> <ProcessDate>0000-00-00 00:00:00</ProcessDate> <ProcessType>New Prospect</ProcessType> <sourcefile>api_data_100.dat</sourcefile> <test_field /> <Title /> <URN></URN> <VENDOR_URN></VENDOR_URN> <WorkPhone /> </ecnow_record> </list> </result>
To update a record using ecnow.php endpoint
This will update an existing record and return its success state or any errors in the request.
- HTTP Request: POST
- Method: ecnow_records
- Action: update
- Arguments: raw, format, id
- Payload:
- At least one of these arguments are required - table (name of the campaign database name), dataset (dataset ID)
- homephone (optional), mobilephone (optional), workphone (optional) (note: at least one ddi should be entered), address1 (2)(3)(4) (optional) postcode (optional), firstname (optional), lastname (optional), title (optional), <custom_fields> (optional)
POST API call with json:
ecnow.php?token=[Token]&format=json&method=ecnow_records&action=update&raw=1
json Pay Load:
[{"id":"550447","title":"Mr","firstName":"Joe","lastName":"Blogs","mobilephone":"07123456789","dataset":"100","company_name":"Company Name"}]
The Response:
{"success":true,"account_id":"10278","total":1,"bad":0,"info":"Record is LIVE on the dialer."}
xml Pay Load:
<?xml version='1.0' encoding='utf-8' ?> <easycall> <ecnow_records> <id>550447</id> <FirstName>Joe</FirstName> <LastName>Blogs<LastName /> <dataset>100</dataset> <MobilePhone>07123456789</MobilePhone> <company_name>Company</company_name> </ecnow_records> </easycall>
The Response:
<result> <success>1</success> <account_id>10278</account_id> <total>1</total> <bad>0</bad> <key>0</key> <info>Record is LIVE on the dialer.</info>
Documentation
The following 8x8 ContactNow API reference material is available to the public. Each link will open a new browser tab: