JsonReaderException when deserializing Slack payload to the InteractionPayload model
See original GitHub issueVersion
Microsoft.Bot.Builder 4.10.3
Describe the bug
JsonReaderException
when deserializing Slack payload to the InteractionPayload
model.
Problem: Newtonsoft.Json.JsonReaderException
at Newtonsoft.Json.JsonTextReader.ReadStringValue
Message: Unexpected character encountered while parsing value: {. Path ‘state’, line 1, position 4505.
i.e. exception is thrown when a user selects an option from the Slack static select element.
Slack sends a dictionary of objects on state
property and the Slack adapter library is trying to deserialize to a string.
Slack API reference: https://api.slack.com/reference/interaction-payloads/block-actions#fields
Microsoft.Bot.Builder.Adapters.Slack.Model.InteractionPayload
class has the State
property as a string property.
To Reproduce
- Create a chatbot project using the Microsoft.Bot.Builder.Adapters.Slack.SlackAdapter
- Configure the Slack app: set the Interactivity request URL to your chatbot endpoint
- Post a message to Slack using the
StaticSelectElement
- Select an option from the select element
- See the error happening on
adapter.ProcessAsync
Expected behavior
Deserialize the model properly and send the activity to the ActivityHandler
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
@gabemilani - I have reproduced the error and I’m working on a fix
Here is a example:
Send a post request to the following API URL https://api.slack.com/methods/chat.postMessage#arg_blocks with that blocks payload