Skip to content

Commit

Permalink
fix: add metadata into question answer webhook (#63)
Browse files Browse the repository at this point in the history
* fix:added metadata into question answer webhook

Signed-off-by: pallavicoder <pallavi.ghule@ayanworks.com>

* chore:solved prettier issue

Signed-off-by: pallavicoder <pallavi.ghule@ayanworks.com>

---------

Signed-off-by: pallavicoder <pallavi.ghule@ayanworks.com>
  • Loading branch information
pallavighule authored and bhavanakarwade committed Mar 11, 2024
1 parent b8df8b1 commit b83e44f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/events/QuestionAnswerEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const questionAnswerEvents = async (agent: Agent, config: ServerConfig) =
QuestionAnswerEventTypes.QuestionAnswerStateChanged,
async (event: QuestionAnswerStateChangedEvent) => {
const record = event.payload.questionAnswerRecord
const body = record.toJSON()
const body = { ...record.toJSON(), ...event.metadata }

// Only send webhook if webhook url is configured
if (config.webhookUrl) {
Expand All @@ -25,7 +25,7 @@ export const questionAnswerEvents = async (agent: Agent, config: ServerConfig) =
...event,
payload: {
message: event.payload.questionAnswerRecord.toJSON(),
basicMessageRecord: body,
questionAnswerRecord: body,
},
})
}
Expand Down

0 comments on commit b83e44f

Please sign in to comment.