Skip to content

Commit a8bd4cc

Browse files
authored
Merge pull request #59 from damianperez/master
Allow custom query parameters in webhook URL
2 parents 35ca6cf + 9de7055 commit a8bd4cc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
77
### Notes
88
- [:ledger: View file changes][Unreleased]
99
### Added
10+
- Allow webhook to contain custom query parameters.
1011
### Changed
1112
### Deprecated
1213
### Removed

src/BotManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,10 @@ public function validateAndSetWebhook(): self
237237
return !empty($v);
238238
}, ARRAY_FILTER_USE_BOTH);
239239

240+
$webhook['url'] .= parse_url($webhook['url'], PHP_URL_QUERY) === null ? '?' : '&';
240241
$this->handleOutput(
241242
$this->telegram->setWebhook(
242-
$webhook['url'] . '?a=handle&s=' . $this->params->getBotParam('secret'),
243+
$webhook['url'] . 'a=handle&s=' . $this->params->getBotParam('secret'),
243244
$webhook_params
244245
)->getDescription() . PHP_EOL
245246
);

0 commit comments

Comments
 (0)