DynaSlack is a Dynamo package providing integration with Slack, allowing you to post messages to Slack, currently via webhooks only.
Includes support for :
- Slack text formatting
- using an emoji or image as message icons
- setting integration name (equivalent to a person's name on Slack)
Soon to include support for :
- OAuth flow
- posting as a bot
- posting as a user
Getting started with DynaSlack
for your own use is very simple : using Dynamo's built-in package manager, search for DynaSlack
and then click the download button.
A new category called DynaSlack
should appear in the Dynamo node library, but in some cases you might need to restart Dynamo. Remember that installation for packages is separate for Dynamo Sandbox/Studio and Dynamo for Revit, so you will need to install it separately as required.
DynaSlack currently exposes a few nodes in Dynamo, in the DynaSlack.Slack
category, organised in a further 2 sub-categories :
- Client
- Webhooks
The samples
folder includes a simple example that shows you how to post a message using webhooks.
The definition is pictured below :
The result of this will show up Slack as below :
The samples
folder includes a more complex example that shows you how to post 2 separate messages using 2 differently configured webhooks that have different names and different icons. One of the webhooks makes use of an emoji
icon whilst the other uses a cloud-hosted image
.
The definition is pictured below :
The result of this will show up Slack as below :
Please remember to fill in your own webhook URL, the one used in the samples has been deactivated.
This subcategory implements a client for access to a Slack team. It's current functionality is limited but planned updates will include support for OAuth and implicitly, multiple teams, bots and more.
Please note the OAuth flow is currently in development, so I suggest using the Webhook functionality instead until an update is released.
This node creates a new Slack client. It takes in only 1 input :
1. token - an OAuth token.
An empty string will suffice as input if you don't have a token laying around the house.
This node will post a message to a Slack channel through a webhook, provided the following inputs :
1. SlackClient : a Slack client with a valid token that has a webhook configured
2. text : the text to post as a message, supports all Slack formatting
3. emoji : the emoji to use as the message image, as per Slack syntax ( :rocket: for example)
The query nodes, marked with ?
in Dynamo allow you to see the properties of a Client. Use these for troubleshooting and debugging.
This subcategory allows the creation of a new Slack IncomingWebhook, which allows data to be sent to Slack
This node creates a new Webhok. It takes in a few inputs :
1. URL : the Slack URL to post to, in the form of
https://hooks.slack.com/services/{teamID}/B4AHCV22F/...
2. Channel : the channel to post the message to, note that a valid existing channel's name is required otherwise sending messages will fail
3. User : the name of the integration, equivalent to a user's name and displayed as message author
4. EmojiIcon : the emoji to use as the message image, as per Slack syntax ( :rocket: for example)
5. UrlIcon : a URL to an image to use as the message image. An image is used as icon only when the emoji input is invalid or an empty string. Requires the URL to an image hosted on the internet.
This node is the one that actually posts the message to Slack. It requires 2 inputs :
1. Webhook : a pre-configure webhook, see node above
2. text : the text to post as a message, supports all Slack formatting
The query nodes, marked with ?
in Dynamo allow you to see the properties of a Webhook. Use these for troubleshooting and debugging.
This project requires the following applications or libraries be installed :
Dynamo : version 1.2 or later
.Net : version 4.5 or later
Please note the project has no dependency to Revit and its APIs.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
As a prerequisite, this project was authored in and requires :
Visual Studio : version 2015 or later
If you already have a Github account, fork (& star) the project, then clone to desktop
or clone using Github Desktop
.
If you don't already have a Github account or don't want one, follow these steps :
- click the green `Clone or Download` button on this project's page and select `Download ZIP`
- unzip the downloaded file
- to enable testing in Dynamo, copy the `packages\DynaSlack` folder to the location of Dynamo packages :
- `%appdata\Dynamo\Dynamo Core\1.2\packages` for Dynamo Sandbox, replacing `1.2` with your version of Dynamo
- `%appdata\Dynamo\Dynamo Revit\1.2\packages` for Dynamo for Revit, replacing `1.2` with your version of Dynamo
After you have the project saved to your development machine, navigate to the DynaSlack\src
folder and open the DynaSlack.sln
solution to access the full Visual Studio solution and source code.
Build the project before making any changes to make sure the environment is properly set up, as the project relies on a few NuGet packages, see list below.
The DynaSlack
project relies on a few community-published NuGet packages as listed below :
- Newtonsoft - handles serializing and deserializing to JSON
- RestSharp - enables easier interaction with REST API endpoints
- DynamoServices - an official Dynamo package providing support for better mapping of C# code to Dynamo nodes
Please read CONTRIBUTING.md for details the code of conduct, and the process for submitting pull requests.
DynaSlack use the SemVer semantic versioning standard.
For the versions available, see the versions listed in the Dynamo package manager or releases on this repository.
The versioning for this project is X.Y.Z
where
X
is a major release, which may not be fully compatible with prior major releasesY
is a minor release, which adds both new features and bug fixesZ
is a patch release, which adds just bug fixes
- Radu Gidei : Github profile, Twitter profile
See also the list of contributors who participated in this project.
This project is licensed under the GNU AGPL 3.0 License - see the LICENSE FILE for details.
-
Hat tip to the UK Dynamo User Group and the wider Dynamo community for spurring me on to present & release this.
-
This project is a spin-off from a more involved Revit addin I developed that enabled routing of Revit events to Slack for notification.
-
The codebase is in no way striving for efficiency, but instead simplicity & legibility for the community's benefit. Any suggestions or help improving it is warmly welcomed.