Pass Custom Parameters from webchat control to bot framework

后端 未结 2 830
闹比i
闹比i 2021-01-24 20:04

So, I\'m currently using this:



  
    
2条回答
  •  闹比i
    闹比i (楼主)
    2021-01-24 21:06

    The other answer provided is helpful but it overwrites channelData. For others finding this answer and just wanting to send custom parameters, this will be helpful:

    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)
        }
    })
    

提交回复
热议问题