PATCH / phone-numbers/update
Base URL: https://backend.easify.app/api/v2
This endpoint is used to update the incoming webhook URL for a phone number.
The user can update the webhook URL for incoming SMS. If any incoming SMS is received on their number, the SMS data will be posted to the webhook URL.
There is a rate limit of 60 requests per minute. If you exceed this limit, you will receive a 429 Too Many Requests status, along with a message indicating when you can try again.
Authentication
The Easify API token used for authentication is passed in the header as a Bearer token, which can be obtained from the easify app under Settings > API Settings.
Headers
Authorization string required Bearer << YOUR_EASIFY_API_TOKEN_HERE >>
Query Params
phone_number_id integer | The phone number's unique ID (will be provided in the phone-numbers API response) | Required |
Sample Params and Response:
Request:
{
"phone_number_id": 1,
"webhook_url": "<> "
}
Success Response:
{
"status": true,
"message": "Webhook URL updated successfully",
"data": {
"id": 228,
"number": "+1864400****",
"approved": "Approved",
"gateway": "Easify SMS Gateway",
"name": "Easify SMS Call Gateway",
"status": "Active",
"webhook_url": "https://***********",
"created_at": "10-08-2024 07:46:20 AM"
}
}
Api Response Status
Case | Status Code | Response |
---|---|---|
If the user does not provide a token in the header or provides an invalid token | 401 |
{
"status":false,
"message":"Unauthenticated",
"errors":[]
}
|
If user not provided phone_number_id | 422 |
{
"message": "The phone number id field is required.",
"errors": {
"phone_number_id": ["The phone number field is required."]
}
}
|
If user provided invalid phone_number_id | 400 |
{
"status":false,"message":"Invalid phone number id","errors": []
}
|
If user not provided webhook_url | 422 |
{
message":"The webhook url field is required.",
"errors": {
"webhook_url”: ["The webhook url field is required."]
}
}
|
If the user exceeds the allowed rate limit for requests | 429 |
{
"status":false,
"message":"Too many requests. Try again in 59 seconds",
"errors":[]
}
|
If the user's subscription has ended | 402 |
{
"status":false,"message":"You need to recharge your account to proceed","errors":[]
}
|
If the user does not have an enterprise plan | 403 |
{
"status": false,
"message": "Access denied. Your current plan does not allow access to this feature. Please upgrade to the Enterprise plan.",
"errors": []
}
|
PHP-cURL
php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://backend.easify.app/api/v2/phone-numbers/update?phone_number_id=228&webhook_url=https%3A%2F%2Fwww.google.co.in%2F',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer 1955|43da5bb5-5c2b-4059-a4de-d44bf5****'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;