PHP

Send Single SMS

try {

    $jwtToken = 'YOUR JWT TOKEN';
    $phoneNumber = '0912*******';
    $message = 'Hi, there';

    $client = new \GuzzleHttp\Client([
        'timeout' => 30,
    ]);

    $response = $client->request('POST', 'https://api.bitel.rest/api/v1/sms/single', [
        'headers' => [
            'Content-type' => 'application/json',
            'Authorization' => 'Bearer ' . $jwtToken,
        ],
        'body' => json_encode([
            'phoneNumber' => $phoneNumber,
            'message' => $message,
        ])
    ]);
    
    $responseJson = json_decode($response->getBody(), true);
    if ($responseJson['error'] != null) {
        echo 'error: ' . $responseJson['error'];
    } else {
        $requestId = $responseJson['result']['requestId'];
        echo 'requestId is: ' . $requestId;
    }
} catch (\Throwable $th) {
    echo 'exception: ' . $th->getMessage();
}

Send P2P SMS

Send OTP Code

Make Single Call

Last updated

Was this helpful?