Skip to content

Instantly share code, notes, and snippets.

@ahkim
Created July 4, 2016 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahkim/598e9ee201bcad03e6e87900715e16fc to your computer and use it in GitHub Desktop.
Save ahkim/598e9ee201bcad03e6e87900715e16fc to your computer and use it in GitHub Desktop.
This demonstrates how you could post message from yammer group to slack channel using Azure Logic App + API App.

Yammer message in a group to Slack channel using Azure Logic App

This is how easy it is from a designer view. Add api app for yammer and slack in sequence and configure login. Done.

When you switch to codeview, you can configure more in detail(trigger interval, etc.)

{
    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-04-01-preview/workflowdefinition.json#",
    "actions": {
        "Post_Message": {
            "inputs": {
                "host": {
                    "api": {
                        "runtimeUrl": "https://logic-apis-australiasoutheast.azure-apim.net/apim/slack"
                    },
                    "connection": {
                        "name": "@parameters('$connections')['slack_1']['connectionId']"
                    }
                },
                "method": "post",
                "path": "/chat.postMessage",
                "queries": {
                    "channel": "#teamupdates_yammer",
                    "text": "@{triggerBody()?['content_excerpt']}"
                }
            },
            "runAfter": {},
            "type": "ApiConnection"
        }
    },
    "contentVersion": "1.0.0.0",
    "outputs": {},
    "parameters": {
        "$connections": {
            "defaultValue": {},
            "type": "Object"
        }
    },
    "triggers": {
        "When_there_is_a_new_message_in_a_group": {
            "inputs": {
                "host": {
                    "api": {
                        "runtimeUrl": "https://logic-apis-australiasoutheast.azure-apim.net/apim/yammer"
                    },
                    "connection": {
                        "name": "@parameters('$connections')['yammer']['connectionId']"
                    }
                },
                "method": "get",
                "path": "/trigger/in_group/@{encodeURIComponent(string(6281351))}.json"
            },
            "recurrence": {
                "frequency": "Hour",
                "interval": 1
            },
            "splitOn": "@triggerBody()?.messages",
            "type": "ApiConnection"
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment