cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to send notification from Hopex Workflow to Microsoft Teams Channel?

imran_khatyan
MEGA Partner
MEGA Partner

Hello, 

With the boom of meeting software, and collaborative environments, we have been working extra hours on teams, I was starting to wonder if there was a way we can send notifications directly from mega to teams with least amount of efforts. 

 

So here is a very lazy solution to send workflow notifications directly to a teams channel with web hooks (Can also be used with email groups etc.). Now most of you already tried it and may have succeeded with a better solution following is mine, which may help someone looking for something similar: 

Following steps are pretty simple self explanatory however if you wish to see this in action there is a video link as well: https://youtu.be/sUFOAzT9iJI

Steps

Step 1: Create a channel in Teams

Step 2: Create a "Web hook" Connector on the channel

Step 3: Copy the connector URL from the teams

Step 4: Create a new action with a new macro on any transition you deem worthy

Step 5: use the following code as a reference for the macro<Don't forget to replace URL with your connector url>

Step 6: Run the workflow and see the check the fun part

 

Dim mgRoot
Set mgRoot = objWorkflowContextAction.GetRoot

Dim mgobjWorkflowSubject
Set mgobjWorkflowSubject = objWorkflowContextAction.GetWorkflowSubject

Dim mgobjCurrentWorkflowStatusInstance
Set mgobjCurrentWorkflowStatusInstance = objWorkflowContextAction.GetCurrentWorkflowStatusInstance

Dim objHTTP, URL, user
set user = mgRoot.getobjectfromid(mgRoot.currentenvironment.GetCurrentUserid)

Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = "<Connector URL>"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.setRequestHeader "Content-Type", "application/json"

objHTTP.send("{'text':'Hello World from mega'}")
Set mgobjWorkflowSubject = Nothing
Set mgRoot = Nothing
Set mgobjCurrentWorkflowStatusInstance = Nothing
ExecuteAction= ""

 

Limitations: Server must be connected to internet or atleast be allowed to connect to the connector URL.

 

 

3 Replies

mimperiali
MEGA
MEGA

Yes, that's correct. 

imran_khatyan
MEGA Partner
MEGA Partner

It's a good alternative, but i believe for it you will have to setup SMTP. 

mimperiali
MEGA
MEGA

There is also another way to achieve the same result: every Team has a unique email address. You could create custom "Team users" in your environment, assigning them the Team's email address and then use them in your workflow transition.

 

mimperiali_0-1610368269379.png