Skip to content

Commit

Permalink
feat(teams): add support for quotes (#663)
Browse files Browse the repository at this point in the history
Co-authored-by: François Levasseur <francois.levasseur@botpress.com>
  • Loading branch information
davidvitora and franklevasseur authored Mar 27, 2024
1 parent 2bc0106 commit 0ad7c3c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/channels/src/teams/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ export class TeamsApi extends ChannelApi<TeamsService> {
const endpoint = { identity: '*', sender: activity.from.id, thread: convoRef.conversation!.id }
const text: string | undefined = activity.value?.text || activity.text

const quote = activity?.attachments?.find((attachment) => attachment?.content?.includes('</blockquote>'))?.content

if (activity?.attachments?.length) {
for (const attachment of activity.attachments) {
if (attachment.contentType === 'text/html' && attachment?.content?.length) {
continue
}

const { contentType, name, contentUrl } = attachment
await this.service.receive(scope, endpoint, {
type: this.mapMimeTypeToStandardType(contentType),
Expand Down Expand Up @@ -75,7 +81,7 @@ export class TeamsApi extends ChannelApi<TeamsService> {
payload: text.replace(POSTBACK_PREFIX, '')
})
} else {
await this.service.receive(scope, endpoint, { type: 'text', text })
await this.service.receive(scope, endpoint, { type: 'text', text, ...(quote && { quote }) })
}
}

Expand Down

0 comments on commit 0ad7c3c

Please sign in to comment.