Add leads to OSDial via API

ViciDial and GoautoDial are two fantastic predictive dialers but when I get familiar with OSDial I find it more simple and useful than others . Behind its simple interface, it has powerful API implementation as well . APIs to add lead , List , Campaign , etc  . This is a step by step document on one of its practical APIs to add lead . I used it to integrate VTiger CRM to the telephony system .

Step 1 : Enable API access for admin ( or any ) user . We will use this user to access the API .
To enable the API access go to Agents menu and select admin .


And set admin API access to Y


Step 2 : For importing leads you need to create an XML file with Admin username and your admin password .

<?xml version='1.0' standalone='yes'?>
<api user="admin" pass="mypassword" function="add_lead" mode="admin" test="0" debug="0" vdcompat="0">
  <params>
      <dnc_check>NO</dnc_check>
      <duplicate_check>NO</duplicate_check>
      <gmt_lookup_method>POSTAL</gmt_lookup_method>
      <add_to_hopper>YES</add_to_hopper>
      <hopper_priority>0</hopper_priority>
      <hopper_local_call_time_check></hopper_local_call_time_check>
      <hopper_campaign_call_time_check></hopper_campaign_call_time_check>
      <vendor_lead_code></vendor_lead_code>
      <source_id></source_id>
      <list_id>201605271250</list_id>
      <phone_code>60</phone_code>
      <phone_number>175649736</phone_number>
      <title></title>
      <first_name>OmidReza</first_name>
      <middle_initial></middle_initial>
      <last_name>Mohajerani</last_name>
      <address1>Vila Street</address1>
      <address2>Karimkhan</address2>
      <address3></address3>
      <city>Tehran</city>
      <state>Tehran</state>
      <province></province>
      <postal_code>7418775355</postal_code>
      <country_code>IRAN</country_code>
      <gender>m</gender>
      <date_of_birth>1985-03-21</date_of_birth>
      <alt_phone>2142854854</alt_phone>
      <email>omid.mojhajerani@gmail.com</email>
      <custom1>RACE=I</custom1>
      <custom2>AGE=31</custom2>
      <comments>This is a test of the lead loading.</comments>
      <external_key>88975347</external_key>
      <cost></cost>
      <post_date>2016-03-20T14:30:00</post_date>
      <agent></agent>
      <additional_fields>
          <additional_field form="CREDITCARD" field="NAME">Omid Mohajerani</additional_field>
          <additional_field form="CREDITCARD" field="ADDRESS">9928 CC Lane</additional_field>
       </additional_fields>

  </params>

Step 3 : Send the sample.xml file via POST method to OSDial admin api.php

<?php
  $filename = "sample.xml";
  $handle = fopen($filename, "rb");
  $data = '';
  while (!feof($handle)) {
     $data .= fread($handle, 8192);
  }
  fclose($handle);
?>
<form action="https://OSDIAL-IP-ADDR/admin/api.php" method="post" enctype="multipart/form-data">
<textarea name="xml" rows="30" cols="80"><?php echo $data; ?></textarea>
<input type="submit" value="OK" />
</form>




OSDial is the popular full-featured predictive dialer, that uses Open Source licenses able to dial in every imaginable way .
VTiger is a popular Open Source CRM System based on PHP and MySQL.

Comments

Post a Comment