-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support for new user-change events with types #1448
Conversation
…edEvent, UserProfileChangedEvent, UserStatusChangedEvent).
Codecov Report
@@ Coverage Diff @@
## main #1448 +/- ##
=======================================
Coverage 81.97% 81.97%
=======================================
Files 18 18
Lines 1476 1476
Branches 434 434
=======================================
Hits 1210 1210
Misses 172 172
Partials 94 94 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -937,6 +940,240 @@ export interface UserChangeEvent { | |||
cache_ts: number; | |||
} | |||
|
|||
export interface UserHuddleChangedEvent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@filmaj for my own reference, what source did you use for the schema reference? api.slack.com, Java/Python, or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api.slack.com, I checked the public-facing docs (i.e. https://api.slack.com/events/user_huddle_changed), and all three event descriptions say:
The event is identical to the existing user_change event. Both user_change and user_huddle_changed are dispatched. at the exact same time.
... so I just copy/pasted the existing user_change event.
Sort of awkward that the verb tense goes from present tense (user_change) to past tense (user_huddle_changed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot to be desired with respect to the accuracy / completeness of the api site and I don't know how to make it better. We don't seem to even have a good public facing SOT for user_change to base off of since the example is incomplete so, "everything is identical to user_change" feels unhelpful to me personally.
I'd also consider this a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Did a first pass! I wonder whether we don't get more feedback on the accuracy of these types from the community because people don't use them. Yes this one should probably be a minor.
src/types/events/base-events.ts
Outdated
two_factor_type: string; | ||
has_files: boolean; | ||
is_workflow_bot: boolean; | ||
who_can_share_contact_card: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is at least type string if not constrained further given"EVERYONE"
in the sample included on the API site and it applies to user_huddle_changed
and user_profile_changed
. Seems like this might mean that user_change
modeled above also needs a tweak on this field.
src/types/events/base-events.ts
Outdated
is_invited_user?: boolean; | ||
has_2fa?: boolean; | ||
locale: string; | ||
presence: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be optional? Not seeing it in the user_huddle_changed
sample event but the "this is the exact same thing as user_change` is tripping me up.
src/types/events/base-events.ts
Outdated
is_owner: boolean; | ||
teams: string[]; | ||
}; | ||
two_factor_type: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like if has_2fa is an optional field, two_factor_type should be optional as well. I also don't see this in the event sample on the docs site
src/types/events/base-events.ts
Outdated
teams: string[]; | ||
}; | ||
two_factor_type: string; | ||
has_files: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
src/types/events/base-events.ts
Outdated
}; | ||
two_factor_type: string; | ||
has_files: boolean; | ||
is_workflow_bot: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
src/types/events/base-events.ts
Outdated
two_factor_type: string; | ||
has_files: boolean; | ||
is_workflow_bot: boolean; | ||
who_can_share_contact_card: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
who_can_share_contact_card: boolean; | |
who_can_share_contact_card: string; |
@@ -937,6 +940,240 @@ export interface UserChangeEvent { | |||
cache_ts: number; | |||
} | |||
|
|||
export interface UserHuddleChangedEvent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot to be desired with respect to the accuracy / completeness of the api site and I don't know how to make it better. We don't seem to even have a good public facing SOT for user_change to base off of since the example is incomplete so, "everything is identical to user_change" feels unhelpful to me personally.
Yeah... wow @srajiang I am now testing these events with an app and there are.. a lot of differences. I will try to address them in forthcoming commits as best I can... |
@@ -920,7 +926,7 @@ export interface UserChangeEvent { | |||
is_invited_user?: boolean; | |||
has_2fa?: boolean; | |||
locale: string; | |||
presence: string; | |||
presence?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I never saw this field in my testing of these three events
first_name: string; | ||
last_name: string; | ||
email: string; | ||
email?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't see this field either, even though the "is_email_confirmed" field WAS present and it said "true" 🤔
src/types/events/base-events.ts
Outdated
@@ -882,11 +885,14 @@ export interface UserChangeEvent { | |||
status_text: string; | |||
status_text_canonical: string; | |||
status_emoji: string; | |||
status_emoji_display_info: []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change this empty array type to be the correct one? Same for other events. https://github.com/slackapi/node-slack-sdk/blob/%40slack/web-api%406.7.1/packages/web-api/src/response/UsersInfoResponse.ts#L87
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that @seratch ! I think I have fixed that now.
…user change events
These are UserHuddleChangedEvent, UserProfileChangedEvent, UserStatusChangedEvent.
I assume this is a minor version bump but maybe not? Not sure if a new type counts as an API addition? 🤔