API Delete Message

This API is used to delete a message via API.

You can delete the requested message you don't want to proceed anymore or other reason EXCEPT message with status processing.

processing message cannot be deleted.

if you want to delete it, you have to disconnect your device first, the processing message will changed to pending.

This way you can delete it.

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.fonnte.com/delete-message',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('id' => ''),
  CURLOPT_HTTPHEADER => array(
    'Authorization: TOKEN'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

If you prefer to see on postman, see here.

The token is device token. see how to get token.

Response

Successfull response

{
    "detail": "message 1 successfully deleted",
    "status": true
}

- invalid device : invalid token

{
    "reason": "invalid token",
    "status": false
}

- invalid message id : the message id does not exist or does not belong to your device.

{
    "reason": "invalid message id",
    "status": false
}

- cannot delete message with status processing : the message is being processed. message cannot be deleted

{
    "reason": "cannot delete message with status processing",
    "status": false
}

Related knowledge

See more
Made with in Indonesia