SXI Forum

A place to collect usefull tips, tricks and implementation strategies.

You are not logged in.

#1 04-01-2019 10:46:37

SeanR
Administrator
Registered: 20-11-2018
Posts: 148

Integrate XLayer with Slack

Modern tools claim to be able to integrate with many different technologies and SXI is no different.  You may see claims that certain tools can integrate into Slack and we can do the same thing, without any code changes simply in configuration.

To perform this integration the client will need to create a new Incoming Webhook Slack API App (See the section under Send Messages) in their Slack domain.  The administrator of the slack account will be able to do this.  They will need to provide you with the webhook URL.  Lets use one I created for the SXI Slack domain. 

https://hooks.slack.com/services/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

When you send a message to this webhook your message will appear in the #clientnotifications channel.

Simply setup XLayer to use a RESTConnector to send the message to Slack.

The connector config could look as simple as follows:

<Connector id="SlackConnector" type="RESTWebService">
      <Connection xsi:type="sxi:RESTWebService">
        <sxi:URL>https://hooks.slack.com/services/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</sxi:URL>
        <sxi:DataTypeToSend>JSON</sxi:DataTypeToSend>
        <sxi:RetryDelay>60</sxi:RetryDelay>
      </Connection>
      <sxi:ReturnCodes>
        <sxi:Success>
          <sxi:Code>Success Code</sxi:Code>
        </sxi:Success>
        <sxi:RecoverableError>
          <sxi:Code>Recoverable Error</sxi:Code>
        </sxi:RecoverableError>
      </sxi:ReturnCodes>
    </Connector>

and the DataDefinition as follows:

<sxi:DataDefinition name="SendSlackMessage">
      <sxi:Fields>
        <sxi:Field name="dummy">
          <sxi:Rules>
            <sxi:Default>Testing from inside XLayer</sxi:Default>
          </sxi:Rules>
          <sxi:OutputField>text</sxi:OutputField>
        </sxi:Field>
      </sxi:Fields>
    </sxi:DataDefinition>

As you can see NO stylesheet is needed, however you do need to have an output field of text.  Youcan obviously read the message from an inputfield but inm this example I have chosen to simply send a default message.

This results in "Testing from inside XLayer" appearing in the #clientnotifications channel.

Hope this helps.

Offline

Board footer

Powered by FluxBB