Skip to content

Commit

Permalink
feat(messenger): allow receiving file content elements (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentlp committed May 11, 2022
1 parent 2f67e2f commit cfab6a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/channels/src/messenger/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ export class MessengerApi extends ChannelApi<MessengerService> {
text: message.message.text,
payload: message.message.quick_reply.payload
})
} else if (message.message.attachments) {
for (const attachment of message.message.attachments) {
await this.service.receive(scope, this.extractEndpoint(message), {
type: attachment.type,
[attachment.type]: attachment.payload.url
})
}
} else {
await this.service.receive(scope, this.extractEndpoint(message), { type: 'text', text: message.message.text })
}
Expand Down
1 change: 1 addition & 0 deletions packages/channels/src/messenger/messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface MessengerMessage {
mid: string
text: string
quick_reply?: { payload: string }
attachments?: { type: string; payload: { url: string } }[]
}
postback?: {
mid: string
Expand Down

0 comments on commit cfab6a1

Please sign in to comment.