GitHub Issue: SMSNoc Provider returns 401 Unauthorized (Uses Outdated v3 API Endpoint)
Title
Bug: SMSNoc Provider returns 401 Unauthorized (Uses Outdated v3 API Endpoint)
Description
The current implementation of the SMSNoc provider class (Xenon\LaravelBDSms\Provider\SMSNoc) uses an outdated and deprecated API endpoint:
- Current package endpoint:
https://app.smsnoc.com/api/v3/sms/send
- Official working endpoint:
https://smsnoc.com/api/v1/send-sms
Making requests to the outdated /api/v3 URL results in a 401 Unauthorized HTML response from SMS NOC, even with fully valid Bearer Tokens. Additionally, the official SMS NOC documentation specifies sending requests to the V1 endpoint in JSON format.
Steps to Reproduce
- Configure SMS settings to use the
SMSNoc provider with a valid sender_id and bearer_token.
- Trigger an SMS send event.
- The client receives a
401 Unauthorized client exception.
Root Cause & Code Details
1. Outdated API Endpoint in SMSNoc.php
In vendor/xenon/laravelbdsms/src/Provider/SMSNoc.php:
private string $apiEndpoint = 'https://app.smsnoc.com/api/v3/sms/send';
According to official SMS NOC API Docs, the standard endpoint is:
private string $apiEndpoint = 'https://smsnoc.com/api/v1/send-sms';
2. Duplicate Request Parameters in Request.php
Additionally, when sending JSON POST requests, Guzzle's optionsPostRequest in Xenon\LaravelBDSms\Request appends parameters in the URL and the JSON body simultaneously since it does not unset($options['query']) when isContentTypeJson() is true:
if ($this->isContentTypeJson()) {
$options[RequestOptions::JSON] = $this->query;
}
This causes Guzzle to query parameterize the payload to the URL like POST https://app.smsnoc.com/api/v3/sms/send?recipient=...&message=... while simultaneously sending a JSON body.
GitHub Issue: SMSNoc Provider returns 401 Unauthorized (Uses Outdated v3 API Endpoint)
Title
Bug: SMSNoc Provider returns 401 Unauthorized (Uses Outdated v3 API Endpoint)
Description
The current implementation of the
SMSNocprovider class (Xenon\LaravelBDSms\Provider\SMSNoc) uses an outdated and deprecated API endpoint:https://app.smsnoc.com/api/v3/sms/sendhttps://smsnoc.com/api/v1/send-smsMaking requests to the outdated
/api/v3URL results in a401 UnauthorizedHTML response from SMS NOC, even with fully valid Bearer Tokens. Additionally, the official SMS NOC documentation specifies sending requests to the V1 endpoint in JSON format.Steps to Reproduce
SMSNocprovider with a validsender_idandbearer_token.401 Unauthorizedclient exception.Root Cause & Code Details
1. Outdated API Endpoint in
SMSNoc.phpIn
vendor/xenon/laravelbdsms/src/Provider/SMSNoc.php:According to official SMS NOC API Docs, the standard endpoint is:
2. Duplicate Request Parameters in
Request.phpAdditionally, when sending JSON POST requests, Guzzle's
optionsPostRequestinXenon\LaravelBDSms\Requestappends parameters in the URL and the JSON body simultaneously since it does notunset($options['query'])whenisContentTypeJson()is true:This causes Guzzle to query parameterize the payload to the URL like
POST https://app.smsnoc.com/api/v3/sms/send?recipient=...&message=...while simultaneously sending a JSON body.