cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
tom_haar
Level: Powered On

Syntax for 'MicrosoftTeams.PostMessageToChannelV3'

I have a button in Power Apps that submits a form.  I'd like to use an 'and' statement and post the form's card data to a Teams Channel. 

 

I can't get the syntax right for - MicrosoftTeams.PostMessageToChannelV3(groupid,channelid,body...)

 

I used MicrosoftTeams.GetAllTeams().value to find the Teams Id and MicrosoftTeams.GetChannelsForGroup().value to find the Channel Id.  

 

I need help with getting the Teams Id and Channel Id in the correct format, and an explanation on the syntax for the getting the CardData into the body of the message. 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: Syntax for 'MicrosoftTeams.PostMessageToChannelV3'

HI @tom_haar ,

Do you want to push the form data card value back to your Teams channel?

 

I have made a test on my side, please consider take a try with the following workaround:

4.JPG

 

5.JPG

 

6.JPG

Add two Dropdown controls in your app -- Dropdown1 & Dropdown2. Set the Items property of the Dropdown1 to following:

MicrosoftTeams.GetAllTeams().value

Set the Items property of the Dropdown2 to following:

MicrosoftTeams.GetChannelsForGroup(Dropdown1.Selected.id).value

Set the OnSuccess property of Edit form to following:

MicrosoftTeams.PostMessageToChannelV3(
                                       Dropdown1.Selected.id, 
                                       Dropdown2.Selected.id,  
                                       {
                                           content: "The form data you submitted as below: <br/>" & "Column1 Value: " & EditForm1.LastSubmit.Column1 & "<br/> Column2 Value: " & EditForm1.LastSubmit.Column2 & ...,  // specify the submitted form data here
                                           contentType: "html"  // type 'text' or 'html' here 
                                       },
                                       {
                                         subject: "Message Submitted From PowerApps Form"
                                       }
);
Back()

When you submit your form data successfully, above formula would be executed. When you specify the submitted form data within above MicrosoftTeams.PostMessageToChannelV3(...) function, please use the following formula:

EditForm1.LastSubmit.Column1
EditForm1.LastSubmit.Column2
EditForm1.LastSubmit.Column3

 ...

...

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

tom_haar
Level: Powered On

Re: Syntax for 'MicrosoftTeams.PostMessageToChannelV3'

Thanks so much.  

 

It took me a minute to figure out that Column1, needed to be the name of the column in the form.  

 

Then I was able to add the Char(10) from - https://powerusers.microsoft.com/t5/Building-Power-Apps/Textbox-lt-br-gt/m-p/20489

 

That got me from a Teams message of - 

 

Job: Test Job 1 Date: 1-24-20 Location: Home

 

to

 

Job: Test Job 1

Date: 1-24-20

Location: Home

 

I only wish I had asked sooner.

View solution in original post

3 REPLIES 3
Eelman
Level 10

Re: Syntax for 'MicrosoftTeams.PostMessageToChannelV3'

@tom_haar 

My apologies in advance for posting a link rather than an answer but this link appears to have all the info you are chasing, it even has an explanation of usage.:

https://www.flexmind.co/blog/post-message-to-microsoft-teams-through-powerapps/

 

I've not used this functionality before but now that you've opened my eyes to it's possibility I may start using it 🙂 

Community Support Team
Community Support Team

Re: Syntax for 'MicrosoftTeams.PostMessageToChannelV3'

HI @tom_haar ,

Do you want to push the form data card value back to your Teams channel?

 

I have made a test on my side, please consider take a try with the following workaround:

4.JPG

 

5.JPG

 

6.JPG

Add two Dropdown controls in your app -- Dropdown1 & Dropdown2. Set the Items property of the Dropdown1 to following:

MicrosoftTeams.GetAllTeams().value

Set the Items property of the Dropdown2 to following:

MicrosoftTeams.GetChannelsForGroup(Dropdown1.Selected.id).value

Set the OnSuccess property of Edit form to following:

MicrosoftTeams.PostMessageToChannelV3(
                                       Dropdown1.Selected.id, 
                                       Dropdown2.Selected.id,  
                                       {
                                           content: "The form data you submitted as below: <br/>" & "Column1 Value: " & EditForm1.LastSubmit.Column1 & "<br/> Column2 Value: " & EditForm1.LastSubmit.Column2 & ...,  // specify the submitted form data here
                                           contentType: "html"  // type 'text' or 'html' here 
                                       },
                                       {
                                         subject: "Message Submitted From PowerApps Form"
                                       }
);
Back()

When you submit your form data successfully, above formula would be executed. When you specify the submitted form data within above MicrosoftTeams.PostMessageToChannelV3(...) function, please use the following formula:

EditForm1.LastSubmit.Column1
EditForm1.LastSubmit.Column2
EditForm1.LastSubmit.Column3

 ...

...

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

tom_haar
Level: Powered On

Re: Syntax for 'MicrosoftTeams.PostMessageToChannelV3'

Thanks so much.  

 

It took me a minute to figure out that Column1, needed to be the name of the column in the form.  

 

Then I was able to add the Char(10) from - https://powerusers.microsoft.com/t5/Building-Power-Apps/Textbox-lt-br-gt/m-p/20489

 

That got me from a Teams message of - 

 

Job: Test Job 1 Date: 1-24-20 Location: Home

 

to

 

Job: Test Job 1

Date: 1-24-20

Location: Home

 

I only wish I had asked sooner.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (6,158)