Skip to content

LastIncomingCalls#

Beta version

The functionality is in beta mode. Functions can be changed and may also work unstably.

Test Postman Apidog

This method returns the latest incoming calls of the account.

Settings

To receive incoming calls you need to enable incomingWebhook and incomingCallWebhook setting using the SetSettings method or through the console.

It may take up to 5 minutes for the settings to take effect.

To receive the latest incoming calls by your phone before connecting the instance, after saving the settings on the instance, you need to do logout and authorize again.

The method returns the last 10000 calls. The LastIncomingCalls method only returns the history that WhatsApp provides to the system.

The appearance of calls history in the journal may take up to 2 minutes. Journal methods should only be used for retrieving calls history. For quicker calls retrieval, use the notification system.

Request#

To get incoming calls history, you have to execute a request at:

GET
{{apiUrl}}/waInstance{{idInstance}}/lastIncomingCalls/{{apiTokenInstance}}

For apiUrl, idInstance and apiTokenInstance request parameters, refer to Before you start section.

URL request parameters#

Parameter Type Mandatory Description
minutes integer No Time in minutes for which the calls should be displayed (default is 1440 minutes)

Response#

Response parameters#

Array of objects with parameters:

Parameter Type Description
type string Call type, incoming - incoming call
idMessage string Incoming call Id
timestamp integer Call end time in UNIX format
typeMessage string Call type: incomingCall - incoming call
chatId string Chat Id, in which the call was made
isVideo boolean Flag indicating whether this was a video call
status string Call status. Can have the following values:
pickUp - answered incoming call
hungUp - the recipient of an incoming call didn't pick up and dropped the call; the "Do Not Disturb" feature is enabled on the phone.
missed - the caller canceled the call. The status is deprecated and has been replaced by 'declined'
declined - a missed call or the caller canceled the call

Response body example#

[
    {
        "type": "incoming",
        "idMessage": "F33E8701AGHY4DE04254CBBAE21EC046",
        "timestamp": 1754455764,
        "typeMessage": "incomingCall",
        "chatId": "79001234567@c.us",
        "isVideo": false,
        "status": "pickUp"
    }
]

LastIncomingCalls errors#

For a list of errors common to all methods, refer to Common errors section

Request examples#

import requests

url = "{{apiUrl}}/waInstance{{idInstance}}/lastIncomingCalls/{{apiTokenInstance}}"

payload = {}
headers= {}

response = requests.request("GET", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/lastIncomingCalls/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/lastIncomingCalls/")
    .append({{apiTokenInstance}});

var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.GET, null, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/lastIncomingCalls/")
    .append({{apiTokenInstance}});

var response = Unirest.get(requestUrl.toString())
    .header("Content-Type", "application/json")
    .asString();

System.out.println(response);
Sub LastIncomingCalls()
    Dim url As String
    Dim http As Object
    Dim response As String

    ' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
    url = "{{apiUrl}}/waInstance{{idInstance}}/lastIncomingCalls/{{apiTokenInstance}}"

    Set http = CreateObject("MSXML2.XMLHTTP")

    http.Open "GET", url, False
    http.send

    response = http.responseText

    Debug.Print response

    ' Outputting the answer to the desired cell
    Range("A1").Value = response

    Set http = Nothing
End Sub