-
Notifications
You must be signed in to change notification settings - Fork 662
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
Allow mrkdwn_in, callback_id fields in message attachments #528
Changes from 5 commits
301d00b
e93c377
12b6f1a
f506855
c9bf842
951fe41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,9 @@ export interface MessageAttachment { | |
type: string; | ||
text?: string; | ||
}[]; | ||
attachment_type?: 'default'; | ||
callback_id?: string; | ||
mrkdwn_in?: ('pretext' | 'text' | 'fields')[]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this works and its right, but i was a little confused by the syntax. would you mind making a named string-based enum type and then setting this type to an array of that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer to use a union type instead of an enum, because if a declare it as an enum type, e.g.:
it won't be possible to define mesages in this "plain" way
and forces a user to use this style:
so it won't be compatible with exports from tools like Walkiebot (and also with old projects, based on the older SDK). But I can write it as a separate union type instead, to make it more readable:
what do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😮 i guess i never really gave any thought to the intricate differences between a union type and an enum. i always thought that enums were a "more powerful" union type because TypeScript would generate a symbol with the actual map, but didn't realize the compiler would complain when you use the literal values like in your example. i tried it out here. in light of this fact, i agree that the union type is a better solution. thanks! |
||
} | ||
|
||
export interface LinkUnfurls { | ||
|
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.
while i see that this is an accepted field, there are no values other than 'default', so i don't think it adds any value to type it (i'm not sure there will ever be any other possible values, and each additional property has a visual cost when your editor is trying to give you hints)
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, I understand, but our UX team uses Walkiebot for designing flows and messages. We also plan to fetch those messages designed by Walkiebot automatically to our integrations (using the Walkiebot API), but there is a problem - Walkiebot generates JSON/JS of designed attachments with
attachmet_type
field included (see the attached screenshot), therefore the output is not compatible with this SDK and we have to manually remove this field from every exported message. I can contact Walkiebot and ask them to remove this field, but it seems, they strictly stick to Slack API specs, so maybe as a first step is good to remove this unnecessary field from Slack API documentation.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.
oh that's really cool! i'd love to make sure there's a great experience when integrating with Walkiebot, we recommend their product to loads of designers/developers.
what kind of error are you getting when you have the additional property in your API call? if you're in a javascript project, the client shouldn't care about additional properties. if you're in a typescript project, i thought our addition of the
AuxiliaryArguments
type would make this usage valid as well (interesting use case for the discussion @ #496)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, we use TypeScript for all our projects - but I thought before that our attachments were incompatible with the
MessageAttachment
because of missing theattachment_type
field, but as I see now, my assumption is not true (thanks to theAuxiliaryArguments
). Our incompatibility comes from missing types in the nested fieldMessageAttachment.actions
- the current type definition foractions
contains only two fields:but the attachment actions in our project contains additional fields. So I will prepare a separate PR also with complete definitions for the attachment actions.