Uninstall Callback
Handle App Uninstalls
Hootsuite supports a URL callback to a specified endpoint whenever a user uninstalls your application. This allows your system to clean up user data or revoke access tokens automatically.
You can configure your Uninstall Callback URL in your app settings within the Developer Portal.
Callback Details
When an uninstall occurs, Hootsuite sends a POST request to your configured URL with an application/x-www-form-urlencoded body.
| Parameter | Name | Description |
|---|---|---|
i | User ID | The ID of the user who uninstalled the application. |
ts | Timestamp | The time the uninstall event occurred. |
token | Token | A signature token to verify the authenticity of the callback request. |
Implementation Examples
Below are examples of how to capture the uninstall parameters in your backend environment.
Node.js (Express)
While the parameters are sent in the POST body, ensure you are using body-parser or express.json() to access the payload.
app.post('/uninstall', (req, res) => {
const userId = req.body.i;
const timestamp = req.body.ts;
const token = req.body.token;
console.log(`User ${userId} uninstalled the app at ${timestamp}`);
res.status(200).send('OK');
});
PHP
In PHP, you can retrieve the values directly from the $_POST superglobal.
<?php
$i = $_POST['i']; // Retrieve User ID
$ts = $_POST['ts']; // Retrieve Timestamp
$token = $_POST['token']; // Retrieve Token
// Process the uninstall logic here
http_response_code(200);
?>
Security Note
Always verify the token parameter provided in the callback to ensure the request originated from Hootsuite before performing any destructive actions (like deleting user data) in your database.