Tutorial with an example event
Learn how to design workflows with events through a step-by-step guide.
Scenario
In a marketing and sales team environment, contacts are created either in HubSpot or in Slack using Actioner workflows. Both workflows publish Contact created event upon successful creation.
Another workflow subscribes to this event and notifies the #leads channel in Slack whenever a new contact is created, regardless of the source.
How it works?
The app contains an Actioner event, "Contact created" and below workflows:
- Contact created in HubSpot
- Create contact in Slack
- Notify #leads channel for new contacts
When a contact is created in HubSpot, Contact created in HubSpot workflow publishes Contact created event.
Similarly, when a contact is created in Slack, Create contact in Slack workflow publishes Contact created event.
The Notify #leads channel for new contacts workflow is initiated with Contact created event, so it will be triggered when both workflows are executed.
Upon receiving an event, this workflow will fire a notification to the #leads channel in Slack, and provide details about the new contact including their email, name, and the source of creation (HubSpot or Slack).
Steps
Step 1. "Contact created" Actioner event
Create a new event on Events tab of your app. Name it as "Contact created". You can select the event type as Private.
Enter below in Event schema field:
{
"properties": {
"email": {
"type": "string",
"format": "email",
"title": "Email",
"description": "The email address of the contact."
},
"name": {
"type": "string",
"title": "Name",
"description": "The name of the contact."
},
"source": {
"type": "string",
"title": "Source",
"description": "The creation source of the contact."
}
},
"required": ["email", "name", "source"]
}
- Enter below in Example payload field.
{
"email": "john.doe@example.com",
"name": "John Doe",
"source": "HubSpot"
}
Step 2. "Contact created in HubSpot" workflow
The workflow is
- Triggered with "Contact created" event from HubSpot integration
- Publishes "Contact created" event.
- Create the trigger node with HubSpot integration. Select "Contact created" event.
- Add a new Actioner event node. Select "Contact created" event and enter below in Event payload field.
{
"email": {{event.body.contact.properties.email}},
"name": {{event.body.contact.properties.firstname + ' ' + event.body.contact.properties.lastname}},
"source": "HubSpot"
}
Step 3. "Create contact in Slack" workflow
The workflow is
- Triggered when "Contact created" is submitted in Slack.
- Publishes "Contact created" event.
- Create the manual node two text inputs: Email and Name.
- Add a new Actioner event node. Select "Contact created" event and enter below in Event payload field.
{
"email": {{input.email}},
"name": {{input.name}},
"source": "Slack"
}
Step 4. "Notify #leads channel for new contacts" workflow
The workflow is
- Initiated by the Actioner event Contact created.
- Sends a message to the #leads channel in Slack.
- Create the trigger node with Actioner event. Select "Contact created" event.
- Add a new action node. Select Slack integration and then "Send message to channel" action. Enter below in Markdown block field.
# New lead:
> **Email**: {{event.body.email}}
> **Name**: {{event.body.name}}
> **Source**: {{event.body.source}}
Step 5. Test your event
- Create a new contact by running "Create contact in Slack" via
/actioner
command in Slack and check new messages in your Slack channel.
- Create a new contact in your HubSpot account and navigate to your channel to view the notification.