Skip to content

Commit

Permalink
chatwoot: remove ability to set custom attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Mar 26, 2024
1 parent d05e0ba commit 0f42214
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
2 changes: 0 additions & 2 deletions chatwoot.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,13 @@ func main() {
})
syncer.OnEventType(event.EventReaction, func(ctx context.Context, evt *event.Event) {
ctx = addEvtContext(ctx, evt)

stateStore.UpdateMostRecentEventIDForRoom(ctx, evt.RoomID, evt.ID)
if VerifyFromAuthorizedUser(ctx, evt.Sender) {
go HandleReaction(ctx, evt)
}
})
syncer.OnEventType(event.EventRedaction, func(ctx context.Context, evt *event.Event) {
ctx = addEvtContext(ctx, evt)

stateStore.UpdateMostRecentEventIDForRoom(ctx, evt.RoomID, evt.ID)
if VerifyFromAuthorizedUser(ctx, evt.Sender) {
go HandleRedaction(ctx, evt)
Expand Down
19 changes: 0 additions & 19 deletions chatwootapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,25 +263,6 @@ func (api *ChatwootAPI) SetConversationLabels(conversationID int, labels []strin
return nil
}

func (api *ChatwootAPI) SetConversationCustomAttributes(conversationID int, customAttrs map[string]string) error {
jsonValue, _ := json.Marshal(map[string]any{
"custom_attributes": customAttrs,
})
req, err := http.NewRequest(http.MethodPost, api.MakeUri(fmt.Sprintf("conversations/%d/custom_attributes", conversationID)), bytes.NewBuffer(jsonValue))
if err != nil {
return err
}

resp, err := api.DoRequest(req)
if err != nil {
return err
}
if resp.StatusCode != 200 {
return fmt.Errorf("POST conversations/%d/custom_attributes returned non-200 status code: %d", conversationID, resp.StatusCode)
}
return nil
}

func (api *ChatwootAPI) doSendTextMessage(ctx context.Context, conversationID int, jsonValues map[string]any) (*Message, error) {
log := zerolog.Ctx(ctx).With().Str("component", "send_text_message").Logger()
jsonValue, err := json.Marshal(jsonValues)
Expand Down

0 comments on commit 0f42214

Please sign in to comment.