Skip to content

Commit

Permalink
Add spam RTM events
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriansaliou committed Oct 9, 2024
1 parent a7ff907 commit 7aa4609
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,12 @@ Available events are listed below:
* **Message Notify Unread Received** [`user`, `plugin`]:
* `message:notify:unread:received`

* #### **Spam Events**: [Reference](https://docs.crisp.chat/references/rtm-api/v1/#spam-events)
* **Spam Message** [`user`]:
* `spam:message`
* **Spam Decision** [`user`]:
* `spam:decision`

* #### **People Events**: [Reference](https://docs.crisp.chat/references/rtm-api/v1/#people-events)
* **People Profile Created** [`user`, `plugin`]:
* `people:profile:created`
Expand Down
31 changes: 31 additions & 0 deletions crisp/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,25 @@ type EventsReceiveMessageNotify struct {
EventsSessionGeneric
}

// EventsSpamMessage maps spam:message
type EventsSpamMessage struct {
EventsGeneric
EventsWebsiteGeneric
SpamID *string `json:"spam_id"`
Type *string `json:"type"`
Reason *string `json:"reason"`
Metadata *interface{} `json:"metadata,omitempty"`
Headers *interface{} `json:"headers,omitempty"`
Timestamp *uint64 `json:"timestamp"`
}

// EventsSpamDecision maps spam:decision
type EventsSpamDecision struct {
EventsGeneric
EventsWebsiteGeneric
Action *string `json:"action"`
}

// EventsReceivePeopleProfileCreated maps people:profile:created
type EventsReceivePeopleProfileCreated struct {
EventsGeneric
Expand Down Expand Up @@ -1213,6 +1232,18 @@ func (evt EventsReceiveMessageNotify) String() string {
}


// String returns the string representation of EventsSpamMessage
func (evt EventsSpamMessage) String() string {
return Stringify(evt)
}


// String returns the string representation of EventsSpamDecision
func (evt EventsSpamDecision) String() string {
return Stringify(evt)
}


// String returns the string representation of EventsReceivePeopleProfileCreated
func (evt EventsReceivePeopleProfileCreated) String() string {
return Stringify(evt)
Expand Down

0 comments on commit 7aa4609

Please sign in to comment.