I am using HTTP Request plugin in Jenkins and using declarative pipeline script where in I have a stage to call Microsoft teams incoming webhook url and post message when build starts. My Stage looks like below
stage('Build Notification'){
steps{
script{
def payload = '''{
"#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": "Build Number",
"value": "${BUILD_NUMBER}"
}, {
"name": "Status",
"value": "Not started"
}],
"markdown": true
}]
}'''
httpRequest httpMode: 'POST', requestBody: payload, responseHandle: 'NONE' , url: 'blah/blah/blah', wrapAsMultipart: false
}
}
}
My issue is when this message is showing up in teams ,Build Status is literally displaying as ${BUILD_NUMBER } instead of giving the real build number .
I tried to echo ${BUILD_NUMBER} and its giving build number which proves its working but I am unable to find out why ${BUILD_NUMBER} given inside payload of http request is not replaced with real build number while sending the request
I am new to pipeline and stuck on this for last 2 days . Please help
Related
Im trying to display who clicked on "Yes" and who clicked on "No". Here is my code.
"channel": SLACK_CHANNEL,
"text": "Would you like to promote the build to production?",
"attachments": [
{
"text": "Yes to deploy your build to production",
"fallback": "You are unable to promote a build",
"callback_id": "Put the callback_id for the action",
"color": "#SomeColourHere",
"attachment_type": "default",
"actions": [
{
"name": "deployment",
"text": "Yes",
"style": "danger",
"type": "button",
"value": json.dumps({"approve": True, "codePipelineToken": token, "codePipelineName": codepipeline_name}),
"confirm": {
"title": "Are you sure?",
"text": "This will deploy the build to production",
"ok_text": "Yes",
"dismiss_text": "No"
}
},
{
"name": "deployment",
"text": "No",
"type": "button",
"value": json.dumps({"approve": False, "codePipelineToken": token, "codePipelineName": codepipeline_name})
}
]
}
]
Is there any way that we can show who clicked on those buttons.
You have provided insufficient details, but I can confirm that you can figure out who clicked the buttons.
The code seems to be legacy from the looks of it.
Slack recommends the use of block kit to construct interactive messages now.
For your solution, when you capture the event raised by the button click,
'user' details are sent as part of the payload.
Please check here for details: https://api.slack.com/legacy/interactive-messages
I have created Creating Office 365 Connectors for Microsoft Teams successfully. I can send message card to a teams channel. The message card contains an "HttpPOST" action, however when I click button I get an error inside the MS teams apps. The application tries to post to the following https://teams.microsoft.com/api/mt/emea/beta/users/connectors/19:0a75441f3c8340938d5f0789116fb5d5#thread.tacv2;messageid=1620161396652/1620161396652/executeAction, however it receives the following error message {"errorCode":"Forbidden"}.
My connector is register succesfully, with the question "Do you want to enable actions on your Connector cards?" set to yes.
Anybody has any ideas?
{
"#type": "MessageCard",
"#context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "Larry Bryant created a new task",
"sections": [{
"activityTitle": "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": "Add comment",
"target": "<my url>"
}]
}]
}
I will close this question. I have found the answer. I was using a normal O365 business license, and not a developer license.
I am posting a actionable message card to Microsoft team's channel using custom incoming webhook. However, I am not able to hit the target url using 'HttpPOST' action. I have provided accurate target url. I am able to post to that url through other sources. Whenever I click on button with given action, 'Could not complete the requested action. Please try again later.' this message is displayed.
Following is my JSON for message card. Target url is dummy. Please help.
{
"#type": "MessageCard",
"#context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "Larry Bryant created a new task",
"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": "Add comment",
"body":"hello",
"bodyContentType":"application/json",
"target":"https://demo.xyz.com/abc"
}]
}
]
}
Issue was resolved after using MS Teams with developer license.
I am using google smarthome actions for IOT... I updated my action url and account linking details. When i am trying to enable the Test in simulator to deploy my TestAPP to cloud, it fails and it gets me an error "GoogleFulfillment 'actions.fulfillment.devices' is not supported" and the linked app not update old URL. This worked a few days ago. Any changes from google side or anybody has any clue ?
There is a manual workaround. Thanks for Google Assistatant forum:
Steps:
1 - Download the gactions cli at https://developers.google.com/actions/tools/gactions-cli
2 - Authenticate with any command:
./gactions list --project [YOUT_PROJECT_ID]
3 - Download the json representation of your action:
./gactions get --project [YOUR_PROJECT_ID] --version draft > action.json
4 - Edit the json. Extract the only object from its array, remove the nested “googleFulfillments” object:
"googleFulfillments": [
{
"endpoint": {
"baseUrl": "[URL]"
},
"name": "actions.fulfillment.devices"
}
],
5 - Delete the brackets "[ ]" on the top and end of file. Only one language can be activated at a time. Delete all data from the action.json file unnecessary. The file looks like this, with its parameters:
{
"accountLinking": {
"accessTokenUrl": "xxxx",
"assertionTypes": [
"ID_TOKEN"
],
"authenticationUrl": "xxx",
"clientId": "xxx",
"clientSecret": "xxxx",
"grantType": "AUTH_CODE"
},
"actions": [
{
"description": "Smart home action for project xxxxxxx",
"fulfillment": {
"conversationName": "AoGSmartHomeConversation_xxxxxx"
},
"name": "actions.devices"
}
],
"conversations": {
"AoGSmartHomeConversation_xxxxxxxx": {
"name": "",
"url": "xxxxxxx"
}
},
"locale": "en",
"manifest": {
"category": "xxx",
"companyName": "xxx",
"contactEmail": "xxx",
"displayName": "xxx",
"largeLandscapeLogoUrl": "xxxxxx",
"longDescription": "xxxx",
"privacyUrl": "xxx",
"shortDescription": "xxxx",
"smallSquareLogoUrl": "xxxx",
"termsOfServiceUrl": "xxxxx",
"testingInstructions": "xxxxx"
}
}
6 - If you have updated the URL of fulfillment, authentication or token, go to Google Actions Console and update his entry on there;
7 - Push your fixed action into test:
./gactions test --project [YOUR_PROJECT_ID] --action_package ./action.json
This replaces the step " Click Simulator under TEST" in the google assistant manual setup. It worked for me!
More help here: https://community.home-assistant.io/t/google-assistant-trouble-shooting/99223/142
I am new to creating Compose Extensions in Teams and am facing an issue when I add it to my Teams.
All the configurations are in place, from registering the Bot to hosting it as a Bot Service on Azure and handling the compose extension query in the code. I have shared the Bot Id in the manifest and given the bot hosted URL with /api/messages appended to the endpoint URL.
The bot as a standalone application works locally as well as on the Azure Porta. I have successfully remote debugged it as well. However, as soon as I sideload it in Teams as a messaging extension, the query is not firing appropriately.
While typing, it stops and shows "Something went wrong with this app. Try Again".
Moreover, when we load the Compose Extension it should make an initial hit to the hosted bot application, I have the debuggers in place and it neither hits the Constructor nor the Post method.
I am getting a 404 error saying V3 agent not found and a failed POST request.
Anyone who might have faced a similar issue and has recovered from it, or may know where I may be going wrong kindly provide your advice. Highly appreciated.
{
"$schema": "https://statics.teams.microsoft.com/sdk/v1.2/manifest/MicrosoftTeams.schema.json",
"manifestVersion": "1.2",
"version": "1.0.0",
"id": "f3c14e30-0af2-4f96-b714-5d258edcab47",
"packageName": "net.azurewebsites.fetchassistant",
"developer": {
"name": "abc",
"websiteUrl": "https://fetchassistant.azurewebsites.net",
"privacyUrl": "https://fetchassistant.azurewebsites.net",
"termsOfUseUrl": "https://fetchassistant.azurewebsites.net"
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"name": {
"short": "FetchAssistant",
"full": "Fetch Assistant"
},
"description": {
"short": "abc",
"full": "xyz"
},
"accentColor": "#235EA5",
"composeExtensions": [
{
"botId": "Microsoft App/Bot Id",
"scopes": ["personal", "team"],
"commands": [
{
"id": "FirstName",
"description": "Search Relevant Documents",
"title": "Get Name Division",
"initialRun": false,
"parameters": [
{
"name": "xyz",
"description": "Get Name Division",
"title": "Names"
}
]
}
]
}
],
"permissions": ["identity", "messageTeamMembers"],
"validDomains": ["*.microsoft.com", "*.azurewebsites.net"]
}
I was able to get through the issue you're facing by doing the following:
Navigate to https://dev.botframework.com/bots/
Click on the Microsoft Teams icon in the "Add a featured channel" section
Register your app
I was getting this error myself on an extension.
Following the idea of adding channels, I went to the channels section.
There was no Teams channel configured.
So, I added it.
And the error went away as my extension loaded.