Skip to content

Commit

Permalink
Merge pull request #36 from tgrosinger/webhook-bugs
Browse files Browse the repository at this point in the history
Webhook & Message Stream bugs
  • Loading branch information
mergify[bot] authored Aug 13, 2023
2 parents 5ed9b01 + 79a1820 commit 1b069f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion message_streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const (
// InboundMessageStreamType indicates a message stream is for inbound messages.
InboundMessageStreamType MessageStreamType = "Inbound"
// BroadcastMessageStreamType indicates a message stream is for broadcast messages.
BroadcastMessageStreamType MessageStreamType = "Broadcast"
BroadcastMessageStreamType MessageStreamType = "Broadcasts"
// TransactionalMessageStreamType indicates a message stream is for transactional messages.
TransactionalMessageStreamType MessageStreamType = "Transactional"

Expand Down
7 changes: 6 additions & 1 deletion webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,17 @@ type Webhook struct {
// is empty it will return all webhooks for the server. A non-existent message
// stream will result in an error.
func (client *Client) ListWebhooks(ctx context.Context, messageStream string) ([]Webhook, error) {
msgStreamParam := ""
if messageStream != "" {
msgStreamParam = fmt.Sprintf("?MessageStream=%s", messageStream)
}

var res struct {
Webhooks []Webhook
}
err := client.doRequest(ctx, parameters{
Method: http.MethodGet,
Path: fmt.Sprintf("webhooks?MessageStream=%s", messageStream),
Path: "webhooks" + msgStreamParam,
TokenType: serverToken,
}, &res)
return res.Webhooks, err
Expand Down

0 comments on commit 1b069f0

Please sign in to comment.