Setting up lead generation

Setup webhooks in your dashboard

To start your lead generation we first need to setup a webhook on the Puretalk dashboard.

  1. Login to your company and go to Settings > Form Builder
  2. Create or edit an existing
  3. Under the settings of your form you will see "Webhook Setup"

  4. First we need to setup the URL of where leads will be coming from
    (This works as a whitelist for us to allow you to generate leads)
  5. Set your preference of sending the data over whether it is JSON or Form Data
  6. Associate your form fields with with the data you will be sending over
  7. Lastly go to your campaign and copy the token (You will need this later)

Setup webhooks on your end

Request URL

Puretalk AI supports a basic token authentication along with a whitelist to improve security. In order to generate leads you will need to POST from your whitelisted URL to the following URL format.

Request Body

In your request you will need to put in associate your lead generation fields with the form fields you setup earlier.

*Note: you are required to send over a phone number otherwise the generation will return a failure for you

Return Body

Returns your newly created lead

Request URL

Request Body

 

Return Body

 

Setting up custom webhooks

Setup webhooks in your dashboard

If you have your own CRM that you want lead information sent when a call completes PureTalk offer a simple solution. How we accomplish this is through webhooks that can be executed upon a calls completion. To start follow the instructions below:

  1. Login to your company and go to Campaign Management > Campaigns
  2. Click edit on your campaign
  3. Under the settings of your campaign you will see "Call Transfer Webhook"

  4. Now when calls are transferred the information for the lead is sent through a POST request to your website

Request URL

Example Request


Customer API

Puretalk supports HTTP basic authentication with username and password. This protects your information as only you and the Puretalk team can access it.

The suggested syntax for Puretalk API filtering for  GET operations uses a JSON object syntax to declare the desired filter. The syntax is as below, and must be valid, parseable JSON. Note that the examples given in this documentation will not be URI encoded for readability, but JSON encoding then URI encoding is the suggested way of sending this information.

https://dashboard.puretalk.ai/api/v2/<collection_name>?query={ "column1": "value" }
https://dashboard.puretalk.ai/api/v2/<collection_name>?query={ "column1": { "comparator": "value" }

The syntax we use here is modelled and influenced by other libraries such as MongoDB.


Available Comparison Operators

Property Example Parsed Notes
$lt
{"col":{"$lt":1}}
[col] < 1
$lte
{"col":{"$lte":1}}
[col] <= 1
$eq
{"col":{"$eq":1}}
[col] = 1
If a value is used in place of a comparison object, then an implicit $eq will be applied to it (see first example).
$gt
{"col":{"$gt":1}}
[col] > 1
$gte
{"col":{"$gte":1}}
[col] >= 1
$ne, $neq
{"col":{"$ne":1}}
[col] != 1
$is
{"col":{"$is":null}}
[col] IS NULL
To be used with NULL
$isnot
{"col":{"$isnot":null}}
[col] IS NOT NULL
To be used with NULL
$lk, $like
{"col":{"$lk":"s%"}}
[col] LIKE 's%'
$nlk, $notlike
{"col":{"$nlk":"s%"}}
[col] NOT LIKE 's%'
$in
{"col":{"$in":[1,2]}}
[col] IN (1, 2)
To be used with arrays of values
$nin, $notin
{"col":{"$nin":[1,2]}}
[col] NOT IN (1, 2)
To be used with arrays of values
$has, $contains
{"col":{"$has":"s"}}
[col] LIKE '%s%'
Automatically surrounds value with % signs, then uses LIKE operator

Available Logical Operators

Property Example Parsed Notes
$and
{"$and": [{"col1":1},{"col2":2}]}
[col1] = 1 AND [col2] = 2
Note that if multiple comparators are provided in the same object, then an implicit $and grouping will be applied to them. See below for examples.
$or
{"$or": [{"col1":1},{"col2":2}]}
[col1] = 1 OR [col2] = 2
$not
{"$not": { "col": 1 } }
NOT ( [col] = 1 )

Examples

 ?query={ "amount": 43.2 } 
 [amount] = 43.2 
 ?query={ "amount": 43.2, "type": "charged" } 
 [amount] = 43.2 AND [type] = "charged" 
 ?query={ "amount": null } 
 [amount] IS NULL 
 ?query={ "amount": { "$gte": 43.2 } } 
 [amount] >= 43.2 
 ?query={ "amount": { "$gte": 43.2, "$lte": 55.7 } } 
 ([amount] >= 43.2 AND [amount] <= 55.7) 
 ?query={ "amount": 43.2, "created_at": { $gte: "2016-01-01 00:00:00" } } 
 ([amount] = 43.2 AND [timestamp] >= '2016-01-01T00:00:00') 
 ?query={ "$or": [ { "amount": 43.2 }, { "user_id" : { "$nin": [ 1, 2, 3 ] } } ] } 
 ([amount] = 43.2) OR ([user_id] NOT IN (1, 2, 3)) 
 ?query={ "$or": [ { "amount": 43.2, "type": 2 }, { "user_id" : { "$nin": [ 1, 2, 3 ] } } ] } 
 ([amount] = 43.2 AND [type] = 2) OR ([user_id] NOT IN (1, 2, 3)) 
 ?query={ "memo": { "$has": "Last Tuesday" } } 
 [memo] LIKE '%Last Tuesday%' 
 
?query={
  "$not": {
    "$or": [
      { "amount": null },
      { 
        "$and": [
          { "type": "charged" },
          { "amount": { "$neq": 2 } }
        ]
      }
    ]
  }
}
										
NOT (
  [amount] IS NULL
  OR (
    [type] = "charged"
    AND [amount] != 2
  )
)
										

Campaign Object

Campaigns are what we use to assign leads and make our outbound calls

Request Types Available

GET, POST, PUT, DELETE

Attributes

  • id

    * Required for update

    read only
    system defined

    String, filterable, sortable

    Unique identifier for this object. Sort order is ASC by default.
  • company_id

    * Required for update

    read only
    system defined

    String, filterable, sortable

    Unique identifier that assigns this object to this company
  • calls_per_agent

    Optional

    Integrer, filterable, sortable

    Setting for handling call volumes. This sets how many calls you want to dial per transfer agents you have put in. Call Volume is equal to calls_per_agent * num_agents
  • num_agents

    Optional

    Integrer, filterable, sortable

    Setting for handling call volumes. This sets how many transfer agents you have put in for this campaign. Call Volume is equal to calls_per_agent * num_agents
  • form_id

    Optional

    String, filterable, sortable

    Unique identifier that assigns a form to this object. This is for when generating leads we can assign our data to specific fields
  • name

    Optional

    String, filterable, sortable

    Specifies the name of the object
  • status

    Optional

    String, filterable, sortable

    The virtual agent assigned to campaign

Request URL

Sample Objects

Form Object

Forms are what defines the data when generating leads such as setting customer names, emails, etc.

Request Types Available

GET, POST, PUT, DELETE

Attributes

  • id

    * Required for update

    read only
    system defined

    String, filterable, sortable

    Unique identifier for this object. Sort order is ASC by default.
  • company_id

    * Required for update

    read only
    system defined

    String, filterable, sortable

    Unique identifier that assigns this object to this company
  • fields

    Optional

    Array

    Fields is an array that holds individual fields that define the data from leads Show Child Elements >
    • field_name

      Optional

      String

      The name of the field
    • order

      Optional

      Integer

      The order in which you display fields for leads
    • webhook_field

      Optional

      String

      Setting which binds your webhook form field to this field
  • form_name

    Optional

    String, filterable, sortable

    Specifies the name of the object
  • webhook_type

    Optional

    String, filterable, sortable

    Specifies what kind of webhook for lead generation
  • webhook_url

    Optional

    String, filterable, sortable

    Define the url your webhook will come from

Request URL

Sample Objects

Lead Object

A lead is a customer at its core. A lead object holds all the information for that customer such as their basic information, phone number, and call logs. Leads are unique between campaigns meaning you can only have one of each customer per campaign. Puretalk AI has automatic filtering which denies the creation of duplicate customer when it comes to the same campaign.

Request Types Available

GET

Attributes

  • id

    * Required for update

    read only
    system defined

    String, filterable, sortable

    Unique identifier for this object. Sort order is ASC by default.
  • campaign_id

    * Required for update

    read only
    system defined

    String, filterable, sortable

    Unique identifier that assigns this object to a campaign
  • call_logs

    Optional

    Array

    Call logs hold on to the data for any call made on this lead Show Child Elements >
    • call_id

      Optional

      String

      Unique identifier for the call made
    • recording_id

      Optional

      String

      Unique identifier for the recording
    • status

      Optional

      String

      This displays the current status of this call
    • time_taken

      Optional

      Integer

      Number of seconds the call lasted
  • lead_data

    Optional

    Array

    Lead data hold the information on the lead Show Child Elements >
    • field_name

      Optional

      String

      Name of the field
    • field_value

      Optional

      String

      Value of the field
  • reference_number

    * Required

    String, filterable, sortable

    This is the number that is dialed
  • status

    Optional

    String, filterable, sortable

    Status of the last call made on this lead
  • time_taken

    Optional

    Integer, filterable, sortable

    Total duration in seconds for all calls made

Request URL

Sample Objects

Wallet Transaction Object

Wallet transactions are anytime your account is charged, recharged, voided, or refunded. This is used to determine your current account balance and allows your account to make calls

Request Types Available

GET

Attributes

  • id

    * Required for update

    read only
    system defined

    String, filterable, sortable

    Unique identifier for this object. Sort order is ASC by default.
  • company_id

    * Required for update

    read only
    system defined

    String, filterable, sortable

    Unique identifier that assigns this object to this company
  • amount

    Optional

    Float, filterable, sortable

    The dollar amount for the transaction
  • memo

    Optional

    String, filterable, sortable

    Memo attached to the transaction used to describe what the purpose of the transaction
  • type

    Optional

    String, filterable, sortable

    The type of transaction made

Request URL

Sample Objects