How to Declare Authorizations HTTP POST in messages ?

Copper Contributor

Hi Everyone ! 
I have try completed input text then post to webhook.
below code :

 

POST https://outlook.office.com/webhook/######
Content-Type: application/json

{
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "themeColor": "0076D7",
    "summary": "Larry Bryant created a new task",
    "sections": [{
        "activityTitle": "![TestImage](https://47a92947.ngrok.io/Content/Images/default.png)Larry Bryant created a new task",
        "activitySubtitle": "On Project Tango",
        "activityImage": "https://teamsnodesample.azurewebsites.net/static/img/image5.png",
        "facts": [{
            "name": "Assigned to",
            "value": "Unassigned"
        }, {
            "name": "Due date",
            "value": "Mon May 01 2017 17:07:18 GMT-0700 (Pacific Daylight Time)"
        }, {
            "name": "Status",
            "value": "Not started"
        }],
        "markdown": true
    }],
    "potentialAction": [{
        "@type": "ActionCard",
        "name": "Add a comment",
        "inputs": [{
            "@type": "TextInput",
            "id": "comment",
            "isMultiline": false,
            "title": "Add a comment here for this task"
        }],
        "actions": [{
            "@type": "HttpPOST",
            "name": "Send mail",
            "target": "https://outlook.office.com/webhook/######",
            "body": "{'text':'{{comment.value}}'}"
        }]
    }]
}

 

 

but i tried with my api then send mail with authorizations in headers.
below code :

 

POST https://outlook.office.com/webhook/######
Content-Type: application/json

{
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "themeColor": "0076D7",
    "summary": "Larry Bryant created a new task",
    "sections": [{
        "activityTitle": "![TestImage](https://47a92947.ngrok.io/Content/Images/default.png)Larry Bryant created a new task",
        "activitySubtitle": "On Project Tango",
        "activityImage": "https://teamsnodesample.azurewebsites.net/static/img/image5.png",
        "facts": [{
            "name": "Assigned to",
            "value": "Unassigned"
        }, {
            "name": "Due date",
            "value": "Mon May 01 2017 17:07:18 GMT-0700 (Pacific Daylight Time)"
        }, {
            "name": "Status",
            "value": "Not started"
        }],
        "markdown": true
    }],
    "potentialAction": [{
        "@type": "ActionCard",
        "name": "Add a comment",
        "inputs": [{
            "@type": "TextInput",
            "id": "comment",
            "isMultiline": false,
            "title": "Add a comment here for this task"
        }],
        "actions": [{
            "@type": "HttpPOST",
            "name": "Send mail",
            "target": "https://domain.com/api/sendmail",
            "headers": [
                            {"Authorization": "Bearer token#####"},
                            {"Content-Type": "application/json"},
                     ],
            "body": "{
                            'subjects':'Title Mail',
                            'message':'Hello World',
                            'recipient_list':'email@mail.com',
                            'bcc':'email@mail.com'
                     }"
        }]
    }]
}

 

Send to msteam completed when i click button then send json to api this is my message error 

Thanks for your support . have fun today

The remote endpoint returned an error (HTTP Unauthorized). Please try again later.
 
1 Reply
Hello,
Could you resolve your issue? I am facing now the same issue.
Thanks in advance