Integrating Marketo with Slack using the Web API

This post details some of the tactics I presented at the Marketing Nation Summit this year, the slides can be found here: Cut me some Slack! Leveraging The Slack API With Marketo Webhooks And Bots

Slack is a powerful tool for communication and collaboration. I think it's safe to say that the most of us have at least used Slack at one workplace if not on a daily basis. With the many useful integrations built by other tools we use, we have access to all useful information in one place and it's great at replacing tedious email threads.

A couple years back, I discovered the Incoming Webhooks integration from my previous colleague Henri Syvänen at Avaus and it gave an amazing opportunity for sending relevant lead alerts to Slack channels where teams could monitor the most interesting touchpoints Marketo was processing.

Starting with a fresh Marketo instance last year, we quickly got to setting up relevant alerts for marketing & sales to keep people in the loop of what Marketo helps us with how we can track high-intent conversions in the funnel:

marketo-alerts-across-funnel.png

Overview of Slack alerts across lead lifecycle stages

Although very insightful with alerts split up in different Slack channels, it was easy to miss/forget interesting leads in MQL alerts. I was setting up a few API integrations with other tools we use and got quite interested in how Slack apps work and the possibility of creating smarter alerts that were interactive to push data back to Marketo from Slack - the way an "integration" should work.

How the Slack API works

I'm not going to get into the Incoming Webhooks setup too much except for the fact that Slack gives you a "hooks.slack.com..." URL to POST to using your Marketo Webhook and Slack handles the rest, basically as a static message in Marketo.

incoming-webhooks-post.png

Incoming Webhooks post with a whole chunk of formatting in text field and "ok" response from Slack

Now, using the Slack API to post a message allows you to specify which channel to post to in the payload along with the opportunity of adding interactive components like buttons, menus and (quite recently) custom actions. This is how it flow of data looks like:

slack-marketo-flow-of-data.png

Payload, Slack post and Response using API

What's interesting about this setup is that when Slack receives the data it responds with the whole message and some other parameters like the timestamp/id (ts) of the message, that can be mapped to a Marketo field in the webhook's settings. The ts value would allow Marketo to interact with the original message, for example adding a thread comment with more data:

thread-comment-slack.png

Creating your own Slack app

What you'll need for this setup is to create your own Slack app and the great thing is that you can keep it in your internal workspace. Once your app is created, what you'll need is to set up is a bot user + permissions to post using a Bearer token in the header of your posts.

I have covered a detailed guide on this part here: Configuring a Slack app for use with Marketo

Posting using the Slack API

With all app settings ready, the app will be able to post to Slack through its bot user. This is basically the same as a normal Slack user posting, the bot needs to be invited to the channel it posts in and the channel ID needs to be specified in the payload as attachments.

The two part post from above is created using two webhooks and a wait step where the ts value is used to refer to the first webhook's posted message:

two-part-webhook.png

Using Marketo for formatting data

For those interested, I have put together a detailed guide on structuring webhook posts: Structuring Marketo webhooks to post via Slack API

It's quite easy to get into a disaster use case of either having (1) too much text in alerts with default values or (2) creating 20 different webhooks. Marketo knows what data is available and can be told what to actually post before calling a webhook.

One method that works quite well is creating a webhook template that is tokenized and defines all relevant data on the program / campaign level:

slack-payload-template-1.png

This webhook defines the Slack Channel ID and the title/pretext of the message using My Tokens and uses a custom field called Slack_Contact Details for preparing data before posting to Slack by running through a whole list of Change Data Value flow steps with choices:

Slack-post-flow-steps.png

What this can translate to in Slack is either using one webhook for multiple types of posts or simply removing fields when they're empty:

comparison-two-different-posts.png

Interactive components and passing data back to Marketo

When first testing this, I was tempted to use one button next to MQL alerts, but it seemed a bit risky if people get tempted to press it. Instead I opted for putting in a bit more work and adding a menu with three different choices to start: Disqualifying, Adding as contact (claiming) and Creating a deal/opportunity.

Adding interactive components to Slack requires a URL for Slack to post to. Contrary to "hopeful beliefs", you can't really configure so much from Slack's end and it's up to you to decide what to do with the data. This underlying process of sending data back to Marketo is configured with a tool called Integromat​ that I personally prefer over Zapier. Both tools work great if you're not very technical and posting to your own server.

How this type of setup looks like:

Slack-Qualification.gif

Underlying workflow for passing data back to Marketo

Integromat's webhook URL is added in the Slack app's settings and once a request is made, the JSON is parsed to grab the important values:

  • The ts value for updating the originating message
  • The action value from the drop-down menu for sending to Marketo
  • The lead's attributes for knowing who to update
  • The ID of the Slack user who took action to know who claimed/disqualified the lead

api-workflow-slack-marketo.png

The integromat scenario for receiving data from Slack

Integromat authenticates through the Marketo REST API and receives an authentication token. The lead's information is retrieved from Marketo using the token and Integromat syncs the data (points above) on the lead. After this is done, the originating message is updated with three different values based on what the action was that mentioned (1) What the action was, (2) Who took an action (3) Who the lead was.

For a more detailed guide on this part, I wrote up a post here: Sending data back to Marketo from Slack

marketo-triggered-workflow.png

Once Marketo receives the data, this triggers flow steps to update the revenue cycle stage along with details on the lead owner before running more actions to sync the lead to CRM and as a final step... Comment on the original slack message's thread mentioning the user and attaching a link to CRM to the Contact or Opportunity depending on what was chosen - in best case scenarios this takes 15 seconds to run through the whole flow.

I hope this was insightful and helpful for anyone interested in building something similar!

Best,
Erik

2196
0