I have a requirement to pass an ID from webchat client to the bot. I did my research and found this stackoverflow post where @justin-harris mentions the following code
const originalDirectline = props.webchat.createDirectLine({
token,
})
const directLine = Object.assign({}, originalDirectline, {
postActivity: (activity: any) => {
const newActivity = Object.assign({}, activity)
newActivity.customParam = "custom value"
return originalDirectline.postActivity(newActivity)
}
})
This works in a sense and I am able to receive the ID in my bot but whenever I send a message from my webchat client as a user, it goes twice (the first message fails and the second succeeds). I am not sure as to why it is doing that. Would really appreciate if somebody sheds some light on the issue.