Skip to content

Commit 76be6eb

Browse files
authored
Merge pull request #12 from AfricasTalkingLtd/develop
Make premium SMS keyword optional
2 parents 5d91e5b + 30b2b8c commit 76be6eb

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ Instantiating the class will give you an object with available methods
8585

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

src/SMS.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ protected function doSend ($options, $isPremium)
2424
}
2525

2626
if ($isPremium === true) {
27-
if (empty($options['keyword']) || empty($options['from'])) {
27+
if (empty($options['from'])) {
2828
return [
2929
'status' => 'error',
30-
'data' => 'sender, keyword and linkId are required for premium SMS'
30+
'data' => 'from is required for premium SMS'
3131
];
3232
}
3333

34-
$data['keyword'] = $options['keyword'];
34+
if (!empty($options['keyword'])) {
35+
$data['keyword'] = $options['keyword'];
36+
}
3537

3638
if (!empty($options['linkId'])) {
3739
$data['linkId'] = $options['linkId'];

0 commit comments

Comments
 (0)