Posting to Microsoft teams from using Lotusscript

With the new HTTP classes in Domino 10 and lotusscript sending a message to a Microsoft teams group is very simple.

first you need to enable your microsoft teams group to accept posts this is done by adding a incoming webhook to the teams channel

  1. Open the Channel and click the More Options button (which appears as three dots at the top right of the window).
  2. Select Manage teams.
  3. Click on the Apps tab and click on the Go to Store button
  4. Scroll down or search for Incoming Webhook and click the Add button.
  5. Give the connector a name and image of your choosing and finally click Create.
  1. A new unique URI is automatically generated. Copy this URI string to your clipboard.

Now over to domino designer

  1. Create a Lotusscript agent
  2. Add the following code
Dim session As New notessession
Dim teamsURL As String,Body As String,Message as string
message="Domino 10 Talks"
teamsURL="<Paste the teams URI here>"
Dim http As NotesHTTPRequest
Set http=session.CreateHTTPRequest()
Body=|{"text":"|+Message+|"}|
Call http.SetHeaderField("ContentType","application/json")
Call http.Post(teamsURL,Body)
	

Run the code and a message should appear in the channel. There is lots of extensions to the Json Body so you can format the text and add images or links. Happy Coding!! This is the first post of a series how you can extend Domino 10 using the new http and json request classes.
Check out Posting to Slack

Happy Coding.

  1. Interesting – how does NotesHTTPRequest handle the SSL certificate?

    • Avatar Fredrik Norling

      In the beta versions it didn’t but now it works, If I recall correct it should use the security\certificates from the Nab.
      I haven’t got any issues with need to import certs but I haven’t tried any self certs either.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.