Search code examples
botframeworkadaptive-cards

I am unable to pass the Header in HTTPAction while making an Adaptive Card


I am developing a Chatbot and want to send a message to a new chat when user clicks a button. I am unable to pass the Header value.

AdaptiveCard card = new AdaptiveCard();
card.Actions.Add(new HttpAction()
    {
    Url="https://directline.botframework.com/v3/directline/conversations/ConversationID/activities",
    Title = "Yes",
    Method = "Post",
    Headers = "Authorization : SecretKey",
    Body = "{ \"type\": \"message\", \"from\": { \"id\": \"vid\", \"name\":\"vname\" }, \"text\": \"$" + "yes_person" + "$***" + convId + "***" + "\" }"
    });

Solution

  • This was an error in the documentation, which has been updated now. https://learn.microsoft.com/en-us/adaptive-cards/create/cardschema#action-http

    Headers is actually an array of objects with a name/value pair.


    The HTTP headers to send with the request. Each item in the array should be a name/value pair.

    Example: [{ "name": "content-type", "value: "application/json" }]