Skip to main content

$dialer.getPayload

When adding a phone number to a call campaign, various supplementary data can be provided for each number.

  • When the call campaign is created, you can pass an appropriate phone number list: a table where all columns other than the first are interpreted as such additional data.
  • When adding new phone numbers to an already active call campaign via the Calls API POST /addPhones method, the data can be passed in the payload request body field.
tip
The $dialer.getPayload method allows access to this data from the bot script.

Syntax

The method is called without arguments:

$dialer.getPayload();

The method returns an object with data supplied for the current client’s phone number.

  • If the number was added to the campaign via the Calls API, the object returned is the same as the JSON passed in the request.
  • If the number was included in the phone number list, the keys and values of the object returned correspond to the column headers and cell values in the phone number row, respectively.

How to use

Suppose the following list of numbers was uploaded when creating the call campaign:

phonenameaddress
9990000000JohnNew York

Calling $dialer.getPayload will return the following object:

{
"phone": "9990000000",
"name": "John",
"address": "New York"
}
tip
If the list of numbers contains empty headers, they will be replaced by numbers starting from 0:
{
"0": "9990000000",
"1": "John",
"2": "New York"
}
tip
If one of the cells is empty, the method will return an empty string for the appropriate key:
{
"phone": "9990000000",
"name": "John",
"address": ""
}

This example shows how the method can be used in the script:

state: WhatIsMyName
intent!: /WhatIsMyName
if: $dialer.getPayload().name
a: Your name is {{$dialer.getPayload().name}}.
else:
a: I don’t know your name.