Configuring a webhook template
You can configure a project, team space and a server webhook template on IBM® DevOps Test Hub (Test Hub) to send notifications to the configured messaging application.
You must have completed the following tasks:
- Ensured that you are assigned the role of a Project Owner in the project. See Managing access to the server projects.
- Ensured that you are assigned a role as a Team Space Owner in the team space. See Managing members and their roles in a team space.
- Created a project in your team space in Test Hub. See Creating a project.
- Ensured that you are familiar with Apache Velocity. See Apache Velocity Documentation.
You can create a template based on the channel type that you configured. You can select a generic template to send notifications to the generic application. You can also select a JSON sample template with specific fields defined to display event-related notifications in Microsoft Teams or Slack. You can use the sample template that is available for the messaging application or you can also define a JSON template to post the message about the events that occur on Test Hub.
- Select from the following actions you want to perform:
-
Perform the following steps to configure a project webhook template.
Log in to Test Hub.
The Projects page of the initial team space is displayed.
- Click My projects > project_name to open the project that contains the test assets.
The Overview page of the project is displayed.
- Click Manage > Webhooks.
The Templates tab of Webhooks is displayed.
- Click New Template.
The New template page is displayed.
- Perform the following actions on the
DETAILS tab:
- Enter a unique name for the template.
- Click the Channel Type option, and then select an existing channel type.
- Alternatively, you can create a new channel
type by clicking Create new channel type
... option if there are no channel types
available in the drop-down list.
The New channel type dialog is displayed.
- Enter a unique name for the channel type, and then enter a
description for the channel type.Note: You can also create a new channel type or edit a channel type from the Channel Type option available within the Templates tab.
- Perform the following steps if you want to
select either a channel icon or a brand icon:
- Click Create new channel type..., and
then click Channel type icon
.
The Select icon page is displayed.
- View a list of icons that are displayed In the GENERAL tab.
- Search for the icons by entering any text contained in the icon
name in the Search field, and then select
the required icon.
The selected icon is displayed in the Selected icon box.
- Click the BRANDS tab.
View a list of icons that are displayed.
- Search for the brands by entering any text contained in the
brand name in the Search field, and then
select the brand.
The selected brand is displayed in the Selected icon box.
- Click Ok.
The default icon is replaced with the selected icon.
- Click Create new channel type..., and
then click Channel type icon
- Enter a description for the channel type, and then
click Apply.
The channel type is created and added to the Channel Type list.
- Enter a description for the template.
- Perform the following steps to select an
event:
- Click This template is suitable for
events and select All Events, or any of the
subset events from the following list:
- All Events
- Team Space Events
- Project Events
- Execution Events
- License Events
- Search for the events by entering any text contained in the
events name in the Search field, and then select the
corresponding checkbox to select the specific event. Note: All Events is the default event that is set for the webhook template.
- Click This template is suitable for
events and select All Events, or any of the
subset events from the following list:
- Click the Template
tab, and then perform any of the following actions:
- Perform the following steps to insert a generic template:
- Click the cloud icon
to insert a velocity text processing template in the Template body.
A message is displayed about the action that inserts a text in the template body.
- Click Ok.
The text is inserted in the Template body.
- Click the cloud icon
- Perform the following steps to insert a Microsoft Teams sample
template:
- Click the Microsoft Teams icon
to replace a template with a Microsoft Teams template.
A message is displayed about the action that replaces the content of the template body with a Microsoft Teams template.
- Click Ok.
A Microsoft Teams sample template is inserted in the Template body.
- Click the Microsoft Teams icon
- Perform the following steps to insert a Slack sample
template:
- Click the Slack icon
.
- A message is displayed about the action that replaces the content of the template body with a Slack template.
- Click Ok.
A Slack sample template is inserted in the Template body.
- Click the Slack icon
- Perform the following steps to insert a generic template:
- Click Apply.
The template is created and added to the Templates tab.
-
Perform the following steps to configure a team space webhook template:
Log in to Test Hub.
The Projects page of the initial team space is displayed.
- Click Initial Team Space > Manage Team Space > > Webhooks.
The Templates tab of Webhooks is displayed.
- Click New Template.
The New template page is displayed.
- Perform the following actions on the
DETAILS tab:
- Enter a unique name for the template.
- Click the Channel Type option, and then select an existing channel type.
- Alternatively, you can create a new channel
type by clicking Create new channel type
... option if there are no channel types
available in the drop-down list.
The New channel type dialog is displayed.
- Enter a unique name for the channel type, and then enter a
description for the channel type.Note: You can also create a new channel type or edit a channel type from the Channel Type option available within the Templates tab.
- Perform the following steps if you want to
select either a channel icon or a brand icon:
- Click Create new channel type..., and
then click Channel type icon
.
The Select icon page is displayed.
- View a list of icons that are displayed In the GENERAL tab.
- Search for the icons by entering any text contained in the icon
name in the Search field, and then select
the required icon.
The selected icon is displayed in the Selected icon box.
- Click the BRANDS tab.
View a list of icons that are displayed.
- Search for the brands by entering any text contained in the
brand name in the Search field, and then
select the brand.
The selected brand is displayed in the Selected icon box.
- Click Ok.
The default icon is replaced with the selected icon.
- Click Create new channel type..., and
then click Channel type icon
- Enter a description for the channel type, and then
click Apply.
The channel type is created and added to the Channel Type list.
- Enter a description for the template.
- Perform the following steps to select an
event:
- Click This template is suitable for
events and select All Events, or any of the
subset events from the following list:
- All Events
- Team Space Events
- Project Events
- Execution Events
- License Events
- Search for the events by entering any text contained in the
events name in the Search field, and then select the
corresponding checkbox to select the specific event. Note: All Events is the default event that is set for the webhook template.
- Click This template is suitable for
events and select All Events, or any of the
subset events from the following list:
- Click the Template
tab, and then perform any of the following actions:
- Perform the following steps to insert a generic template:
- Click the cloud icon
to insert a velocity text processing template in the Template body.
A message is displayed about the action that inserts a text in the template body.
- Click Ok.
The text is inserted in the Template body.
- Click the cloud icon
- Perform the following steps to insert a Microsoft Teams sample
template:
- Click the Microsoft Teams icon
to replace a template with a Microsoft Teams template.
A message is displayed about the action that replaces the content of the template body with a Microsoft Teams template.
- Click Ok.
A Microsoft Teams sample template is inserted in the Template body.
- Click the Microsoft Teams icon
- Perform the following steps to insert a Slack sample
template:
- Click the Slack icon
.
- A message is displayed about the action that replaces the content of the template body with a Slack template.
- Click Ok.
A Slack sample template is inserted in the Template body.
- Click the Slack icon
- Perform the following steps to insert a generic template:
- Click Apply.
The template is created and added to the Templates tab.
-
Perform the following steps to configure a server webhook template:
Log in to Test Hub.
The Projects page of the initial team space is displayed.
- Click the Settings
icon on the menu bar.
- Click Webhooks.
The Templates tab of Webhooks is displayed.
- Click New Template.
The New template page is displayed.
- Perform the following actions on the
DETAILS tab:
- Enter a unique name for the template.
- Click the Channel Type option, and then select an existing channel type.
- Alternatively, you can create a new channel
type by clicking Create new channel type
... option if there are no channel types
available in the drop-down list.
The New channel type dialog is displayed.
- Enter a unique name for the channel type, and then enter a
description for the channel type.Note: You can also create a new channel type or edit a channel type from the Channel Type option available within the Templates tab.
- Perform the following steps if you want to
select either a channel icon or a brand icon:
- Click Create new channel type..., and
then click Channel type icon
.
The Select icon page is displayed.
- View a list of icons that are displayed In the GENERAL tab.
- Search for the icons by entering any text contained in the icon
name in the Search field, and then select
the required icon.
The selected icon is displayed in the Selected icon box.
- Click the BRANDS tab.
View a list of icons that are displayed.
- Search for the brands by entering any text contained in the
brand name in the Search field, and then
select the brand.
The selected brand is displayed in the Selected icon box.
- Click Ok.
The default icon is replaced with the selected icon.
- Click Create new channel type..., and
then click Channel type icon
- Enter a description for the channel type, and then
click Apply.
The channel type is created and added to the Channel Type list.
- Perform the following steps to select an
event:
- Click This template is suitable for
events and select All Events, or any of the
subset events from the following list:
- All Events
- Team Space Events
- Project Events
- Execution Events
- License Events
- Search for the events by entering any text contained in the
events name in the Search field, and then select the
corresponding checkbox to select the specific event. Note: All Events is the default event that is set for the webhook template.
- Click This template is suitable for
events and select All Events, or any of the
subset events from the following list:
- Click the Template
tab, and then perform any of the following actions:
- Perform the following steps to insert a generic template:
- Click the cloud icon
to insert a velocity text processing template in the Template body.
A message is displayed about the action that inserts a text in the template body.
- Click Ok.
The text is inserted in the Template body.
- Click the cloud icon
- Perform the following steps to insert a Microsoft Teams sample
template:
- Click the Microsoft Teams icon
to replace a template with a Microsoft Teams template.
A message is displayed about the action that replaces the content of the template body with a Microsoft Teams template.
- Click Ok.
A Microsoft Teams sample template is inserted in the Template body.
- Click the Microsoft Teams icon
- Perform the following steps to insert a Slack sample
template:
- Click the Slack icon
.
- A message is displayed about the action that replaces the content of the template body with a Slack template.
- Click Ok.
A Slack sample template is inserted in the Template body.
- Click the Slack icon
- Perform the following steps to insert a generic template:
- Click Apply.
The template is created and added to the Templates tab.
You have configured and created a project, team space and a server webhook template on Test Hub.
You must configure a webhook to push the events from Test Hub to the messaging application. See Configuring a project webhook.