To begin with, we have to create a connector for the Microsoft Teams channel to which we need to post messages to. To do so,
In Microsoft Teams, choose the required channel and click on the three dots next to the name. Once clicked, choose the option 'Connectors'.
Inside the connectors dialog box, locate the option 'Incoming Webhooks' and click Add.
Once added, click on the three dots next to the channel again and click on Connectors.
Now, next to Incoming Webhooks, click on Configure. You'll be asked to provide a name for the Incoming Webhook. Provide a name of your choice and click Create. You can optionally change the picture of the Incoming Webhook too.
Once created, an endpoint URL will be provided. Copy that URL and keep it somewhere stored as it'll be used further down this process.
We've successfully setup a connector for the Microsoft Teams channel and an endpoint URL has been generated too. The next step is to use these to post messages.
To do so, in ServiceDesk Plus, head to Admin -> Developer Space -> Web-hooks and click +New under the Request module.
Once you click +New, you'll be navigated to the web-hook configuration page.
Fill in the Name and the Description fields as per your requirement. Choose the HTTP method as 'POST'.
Under URL, paste the URL that was copied in step number 5. The next field to be filled is the Request Payload.
In Request Payload, the message to be posted in the Microsoft Teams channel should be specified in the JSON format. For example, if the message should say "Hey, a new Request has been created.", then the Request Payload will be :
{
"text":"Hey, a new request has been created."
}
You can include dynamic content inside the message too. For instance, if you want the message to include the Request ID, you can make use of the dollar ($) variable to customise the message. Inside "text", type $ and you'll be provided with a list of the request's parameters that can be included in the message. Choose Request ID in this case.
Once all the details have been filled, click on Save. Now the custom trigger to execute this web-hook to post message should be configured.
To do so, head to Admin - > Automation - > Custom Triggers.
Under the Request module, create a Trigger group if not created one already and then choose +Add Trigger. Now heading to the configuration,
Provide the Trigger name as per your requirement. Under 'Execute on actions' field, in this case, we'll be choosing the value 'created' to post messages in the channel when a request is created.
In the fields 'Execute during', 'Cascade execution' and 'Condition', configure the details as per your requirement.
Under Actions, in the drop-down, select Webhook and then choose the web-hook that we just created to post messages.
Once everything has been configured, choose Save.
Everything has been successfully configured now to post messages to the Microsoft Teams channel.
From now, whenever a Request gets created, a message will be posted in the configured Microsoft Teams channel as specified.
Note :
You can also include formatting options in the message content. The following formatting options are supported by Microsoft :
Bold Text : **bold text**
Italic Text : _italic text_
Strikethrough Text : ~~strikethrough text~~
Bold and Italic Text : **_bold and italic text_**
Line breaks :