Discovery connector request nodes provide a JSONata mapping capability, which you can use
to map data between nodes in a message flow without needing a separate transformation node in the
flow. This topic provides an example of how to map data between a GitHub Input node and a Slack Request node.
Before you begin
Read the following topics:
For demonstrations of how to configure discovery connector request nodes to use JSONata
mapping and how to access trees in the message assembly by using JSONata mapping, see the following
videos:
About this task
Complete the following steps to create a message flow that monitors a GitHub repository for new issues and then sends a message to
Slack, showing details of the new issue.
Procedure
Configure a GitHub Input node by completing the
following steps:
- In the IBM® App Connect
Enterprise Toolkit, create a flow containing a GitHub Input node.
- Select the GitHub Input node in the flow to show
the node properties in the editor.
- On the Basic tab, click Launch Connector
Discovery.
A panel is displayed in which you specify the name of the
policy project and vault details to be used during connector discovery.
- Specify the details of the policy project and vault to be
used during connector discovery:
- In the Policy Project field, specify the policy project that is
used to store the policies that are created during connector discovery.
Alternatively,
you can create a new policy project by clicking New and then specifying the
name of the new policy project. Then click Finish.
- Specify the vault to be used during connector discovery. By default, credentials that
are used during connector discovery are stored in an external directory vault, which is
an App Connect Enterprise vault that can be used by any integration server.
Alternatively, you can store the credentials in an integration server vault, which is created in the
integration server's work directory and can be used only by that specific integration server.
To specify the vault to be used for storing the credentials, complete the steps in the
Using
the Connector Discovery wizard section of one of the following topics:
- In the Vault key field, enter the vault key that is used to
access the credentials stored in the vault. The vault key must be at least 8 characters in
length.
- Optional: By default, the specified vault location and vault key are saved
as preferences in the Toolkit so that the values are preset when you launch Connector Discovery. If
you do not want the preferences to be saved, deselect Save in vault
preferences.
- Click Launch Connector Discovery to
start the Connector Discovery wizard for the GitHub
connector.
The Connector Discovery window is displayed. If
existing GitHub connections (accounts) are available, a
list of those connections is displayed. If there are no existing connections, the status of the GitHub connector is shown as Not connected
.
- If one or more GitHub connections are available,
complete the following steps:
- Select the connection that you want to use.
- Click Configure more events.
- Click .
- Click Connect.
- If there are no existing connections, complete the following steps:
- Click Configure more events.
- Click .
- Click Connect.
A window is displayed in which you specify your
connection details. Enter the following information:
- Application type: Select either GitHub Enterprise Server
or GitHub Cloud from the drop-down menu.
- Authorization method: Select either BASIC or
BASIC OAUTH from the drop-down menu.
- Access token: Enter the personal access token to access the GitHub API. You generate the personal access token from your
GitHub account Settings page.
For more information about identifying these connection details, see How to use IBM App Connect with GitHub.
- The credential that is used for connecting to GitHub
is stored in the vault, and the other connection details are saved in the GitHub policy.
- Select the required organization and repository.
- Select the appropriate timezone and then specify how frequently you want the node to
check for new issues. For example, select
1
to configure the node to poll for new
issues every minute.
- Click Save.
The values of the properties that you set
in the wizard are returned to the GitHub Input node in the IBM App Connect
Enterprise Toolkit.
- When you finish discovery and saved the property values, exit the Connector Discovery
wizard by clicking the X in the upper-right corner of the window or by pressing Alt+F4.
Configure a Slack Request node in the IBM App Connect
Enterprise Toolkit by completing the following steps:
- Add a Slack Request node to the flow and wire it up to the GitHub Input node node:
- Select the Slack Request node in the flow to show
the node properties in the editor.
- Open the Request tab on the Slack Request node.
This tab contains a Map
inputs table, which you use to specify what is going to be sent to the connector. You
can specify which parts of the message tree you want to use, such as the parts of the input body or
local environment. For example, you might want to get the issue number and title of a new issue that
was created in GitHub.
- To create the map inputs entry, click Add. The Add Map
inputs entry dialog is displayed, pre-filled with the name of the node and the schema
from the previous node, if one exists.
- Click OK to accept the entries shown in the
dialog.
Alternatively, if you want to access data from a different location, you can
select the required schema and data location.
- Click Launch Connector Discovery.
A panel is
displayed in which you specify the name of the policy project and vault details to be used during
connector discovery. Specify the details of the policy project and vault, as described in step
4.
- Click Launch Connector Discovery to start the Connector Discovery
wizard for the Slack connector.
The
Connector Discovery window is displayed.
- Select the Slack connection that you want to
use from the list of connected accounts.
If there are no existing connections, the status
of the
Slack connector is shown as
Not
connected
, and you will need to create a new connection to
Slack, similar to the connection that was created for
GitHub in step
5. For information about how to create a
connection to
Slack, see
Using Slack with IBM App Connect Enterprise.
- Configure the node to send a message to Slack when it is triggered, by clicking
.
- The Controls section controls how the fields in the target
application (in this case, Slack) will be populated.
Leave this option set to the default setting of Define mappings below, to specify
that you want to define the mappings in the Connector Discovery wizard. You use the fields in the
Populate the target fields in Slack section to define your mappings.
Alternatively, you can select Use input message unchanged to take the input
message that was constructed by a transformation node earlier in the flow, such as a Mapping node, an ESQL Compute node, or a JavaCompute node.
- Select the Destination type. For example,
Channel.
- In the Where do you want to post the message field, select the
name of the channel.
- In the Text field, define the content of the message that you want
to be sent to Slack. For example, to send a message about a new issue that has been created in GitHub, containing the words "New issue" followed by the
issue number and title, complete the following steps:
- In the Text field, type
New
issue
.
- Click the mapping icon to the right of the Text field. A list
of available mappings is displayed, using the trees such as InputRoot and InputLocalEnvironment, and
which also shows the custom response schema that describes the message that was produced by the GitHub Input node that you configured previously (Map inputs
GitHub_node_name
).
- Expand the list of properties that are defined in the response schema created by the
GitHub Input node, by clicking the down-arrow.
- Click Issue number, then open the list again and click
Title, and then type the text that you want to be included in the message
that will be sent to Slack together with the issue
number and title (such as "has been created in GitHub").
- When you have finished specifying the properties in the Connector Discovery wizard, click
Save.
The values of the properties that you set in the wizard are
returned to the Slack Request node in the message flow
editor.
- When you have finished discovery and saved the property values, exit the Connector
Discovery wizard by clicking the X in the upper-right corner of the window.
- Check that the property settings on the Slack Request node are correct and then save the message flow.
- Deploy the message flow.
Results
When a new issue is created in GitHub, a message is
sent to Slack saying "New issue <issue-number>
<issue-title> has been created in GitHub".