This is part 2 in a series about integrating Marketo with Slack.
How Slack’s Incoming Webhooks works
Using Incoming Webhooks to post to Slack works great, although you won’t get the opportunity to do much more. You receive a Slack branded URL to post data to and Slack gives an OK response after having posted:
How the Slack API differs
The interesting part with using the Slack API is allowing you to customize your alerts to be more interactive. Put simply, the Slack API mimics a normal user’s post by using a bot user.
Instead of an “ok” response after posting, Marketo receives the whole message back in JSON along with an important timestamp value for the message, ts.
Understanding the ts value
The timestamp is specific to the Slack workspace and channel it was posted in. It is the unique (per-channel) timestamp.
The ts value allows a Slack application to interact with their own message in the same way that a user would. The attribute’s value can be mapped to a Marketo field in the webhook settings:
After posting, the value will be added to the Marketo lead’s custom field. In the case above I created a custom field called Slack_Message ID Signup.
Using the Slack ts value in other API calls
The basic API call used is the chat.postMessage call, but there are some other ones that require a valid ts value like:
- chat.update – Editing/updating an initial message
- chat.delete – Deleting unnecessary messages
- chat.postMessage together with
thread_tsallows for adding a message as a threaded comment to the referred message.
Using Interactive Components with the Slack API
Alerts tend to get static, and one interesting way to bridge out workflows is with Interactive Components using the Slack API. Interactive components can be set up as buttons, menus, or menus and allow your Slack app to push back data to a determined source which can trigger other workflows.
Using menus for triggering lead qualification in Marketo & CRM
For example creating a lead alert for sales that allows any user to claim / disqualify a lead:
What this setup does is add an interactive dropdown menu with each alert that allows somebody to disqualify, claim or create a deal/opportunity for the lead.
How the data flows once an action is taken:
- To a scenario a third party integration tool called Integromat that grabs the Marketo lead ID, action value, ts and the Slack user ID of the person who took action.
- Integromat pushes the data to Marketo via the REST API through a sync lead call
- Integromat uses the ts value to update the “Accepted” message to something more friendly. Using the Slack User ID, chosen action and lead’s email the updated message comprises of: (1) Who took action, (2) What the Action was (3) Who it concerned.
- The update in Marketo triggers campaigns to update the lead’s lifecycle stage
- If the lead is sales accepted/qualified, Marketo pushes a pretty JSON payload to another Integromat scenario which in turn syncs
There are a multitude of use cases to customize your marketing/sales insights and processes via the Slack API. More on creating your own Slack app for using the API in our next post.