2017 © Pedro Peláez
 

library alphasms-message-delivery

Message Delivery AlphaSMS integration

image

wearesho-team/alphasms-message-delivery

Message Delivery AlphaSMS integration

  • Thursday, May 31, 2018
  • by Horat1us
  • Repository
  • 2 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

AlphaSMS Integration

Test & Lint Latest Stable Version Total Downloads codecov, (*1)

wearesho-team/message-delivery implementation of Delivery\ServiceInterface, (*2)

Installation

composer require wearsho-team/alphasms-message-delivery:^3.0

Cli Usage

You can use simple CLI tool to send messages and check balance:, (*3)

# Check balance
./alphasms balance
# Send messages interactively
./alphasms send

Usage

Configuration

Variable Required Description
ALPHASMS_SENDER_NAME yes Sender Name for SMS (alpha-name)
ALPHASMS_API_KEY yes Can be received on AlphaSMS Panel
ALPHASMS_WEBHOOK_URL no URL for Webhooks with SMS statuses

VoiceOTP Service

This section describes how to use the Voice OTP functionality of the AlphaSMS service., (*4)

Usage

The AlphaSMS service provides a method to send one-time passwords (OTP) via voice calls. This is useful for two-factor authentication or verification processes., (*5)

<?php

/** @var \Wearesho\Delivery\AlphaSms\Service $service */

// Create a Voice OTP request
$request = new \Wearesho\Delivery\AlphaSms\VoiceOtp\Request(
    id: 12345,                  // Unique identifier for the request
    phoneNumber: '380991234567' // Phone number to receive the voice call
);

try {
    // Send the Voice OTP request
    $response = $service->voiceOtp($request);

    // Get the OTP code (4 digits)
    $code = $response->code();

    // Get the price of the operation
    $price = $response->price();

    echo "Voice OTP sent successfully. Code: {$code}, Price: {$price}";
} catch (\Wearesho\Delivery\Exception $e) {
    // Handle delivery exceptions
    echo "Failed to send Voice OTP: " . $e->getMessage();
}

Request Parameters

  • id (int): A unique identifier for the request. This can be used for tracking or reference purposes.
  • phoneNumber (string): The recipient's phone number in international format (e.g., 380991234567).

Response Properties

  • code() (string): Returns the 4-digit OTP code that was sent to the recipient.
  • price() (float): Returns the cost of the voice call operation.

Error Handling

The voiceOtp() method may throw a \Wearesho\Delivery\Exception in the following cases:, (*6)

  • Invalid request parameters
  • Network connectivity issues
  • Service provider errors
  • Invalid response format

Always wrap the service call in a try-catch block to handle potential exceptions., (*7)

Command Line Interface

For command-line usage, you can use the provided Symfony Console command:, (*8)

# Basic usage
$ ./alphasms voice-otp 380991234567

# With custom request ID
$ ./alphasms voice-otp 380991234567 --id=12345

Authors

License

MIT, (*9)

The Versions

31/05 2018

dev-master

9999999-dev

Message Delivery AlphaSMS integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

31/05 2018

2.0.0-BETA

2.0.0.0-beta

Message Delivery AlphaSMS integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

31/05 2018

dev-feature/xml

dev-feature/xml

Message Delivery AlphaSMS integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

30/05 2018

dev-hotfix/url-generation-fix

dev-hotfix/url-generation-fix

Message Delivery AlphaSMS integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

15/05 2018

1.0.4

1.0.4.0

Message Delivery AlphaSMS integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

15/05 2018

1.0.3

1.0.3.0

Message Delivery AlphaSMS integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

15/05 2018

1.0.2

1.0.2.0

Message Delivery AlphaSMS integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

15/05 2018

1.0.1

1.0.1.0

Message Delivery AlphaSMS integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow

15/05 2018

1.0.0

1.0.0.0

Message Delivery AlphaSMS integration

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alexander Letnikow