Skip to content

Commit

Permalink
Merge pull request #12 from AfricasTalkingLtd/develop
Browse files Browse the repository at this point in the history
Make premium SMS keyword optional
  • Loading branch information
aksalj authored Dec 17, 2018
2 parents 5d91e5b + 30b2b8c commit 76be6eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ Instantiating the class will give you an object with available methods

- `message`: SMS content. `REQUIRED`
- `to`: An array of phone numbers. `REQUIRED`
- `keyword`: Your premium product keyword `REQUIRED`
- `from`: Shortcode that is registered with your Africa's Talking account. `REQUIRED`
- `keyword`: Your premium product keyword
- `linkId`: "[...] We forward the `linkId` to your application when a user sends a message to your onDemand service"
- `retryDurationInHours`: "This specifies the number of hours your subscription message should be retried in case it's not delivered to the subscriber"

Expand Down
8 changes: 5 additions & 3 deletions src/SMS.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ protected function doSend ($options, $isPremium)
}

if ($isPremium === true) {
if (empty($options['keyword']) || empty($options['from'])) {
if (empty($options['from'])) {
return [
'status' => 'error',
'data' => 'sender, keyword and linkId are required for premium SMS'
'data' => 'from is required for premium SMS'
];
}

$data['keyword'] = $options['keyword'];
if (!empty($options['keyword'])) {
$data['keyword'] = $options['keyword'];
}

if (!empty($options['linkId'])) {
$data['linkId'] = $options['linkId'];
Expand Down

0 comments on commit 76be6eb

Please sign in to comment.