Global Navigation

  • Products
  • Overview
  • Getting Started
  • Guides
  • Resources
  • Console

Table of Contents

  • Introduction
    • App Builder Overview
    • What is App Builder
    • Business Case
    • FAQ
    • Community
  • Quick Start
    • App Builder Getting Started
      • Setting Up
      • Creating your First App
      • Publishing Your App
      • Troubleshooting
    • Runtime Getting Started
      • Overview
      • Activations
      • Deploy
      • Entities
      • How Runtime Works
      • Resources
      • Setup
      • Understanding Runtime
  • Develop
    • References
    • App Builder Guides
      • Architecture Overview
        • App Hooks
        • Introduction to React Spectrum
        • Using SDKs
      • Application State
      • Application Logging
        • Azure Log Analytics
        • New Relic
        • Splunk Cloud
        • Splunk Enterprise
      • Configuration
        • Webpack Configuration
      • Deployment
        • CI/CD for App Builder Apps
        • Credential Rotation
        • Setting Response Headers
      • Development
      • Distribution
      • Events
        • Webhooks
      • Exc App
        • Interfaces
          • Modules
          • Page ObjectWithHref
          • Page ObjectWithPath
          • Page PageAPI
          • Page PageAPIProperties
          • Runtime
          • TopBar Callback
          • TopBar CustomFeedbackConfig
          • TopBar CustomSearchConfig
          • TopBar ExternalFeedbackConfig
          • TopBar HelpCenterFeedbackConfig
          • TopBar Solution
          • TopBar TopBarAPI
          • TopBar TopBarAPIProperties
          • User UserAPI
          • User UserInfo
        • Migrate App to Exp Cloud SPA
        • Modules
          • Page
          • TopBar
          • User
      • Extensions
        • Extension Migration Guide
      • Optimization
      • Security
        • Understanding Authentication
      • Telemetry
    • Runtime Guides
      • Contribution Guide
      • Asynchronous Calls
      • Creating Actions
      • Creating REST APIs
      • CI/CD Pipeline
      • Debugging
      • Logging & Monitoring
      • Reference Docs
        • API Reference
        • CLI Usage
        • Configuring Proxy
        • Environment Variables
        • Feeds
        • Multiple Regions
        • Packages
        • Prepackages
        • Runtimes
        • Sequences & Compositions
        • Triggers & Rules
        • WSK Usage
      • Security General
      • Securing Web Actions
      • System Settings
      • Throughput Tuning
      • Tools
        • CLI Install
      • Troubleshooting
      • Using Packages
      • Using Runtime
    • Contribution Guide
  • Learning
    • Asset Compute Worker PS API
      • Requirements
      • Lesson 1: Create an app from Asset Compute template
      • Lesson 2: Configure the app
      • Lesson 3: Develop worker calling Photoshop API
      • Lesson 4: Integrate worker in AEMaaCS
      • Well done
    • Barcode Reader
      • Requirements
      • Lesson 1: Bootstrap a Headless App
      • Lesson 2: Writing a Serverless Action
      • Lesson 3: Unit and E2E Tests
      • Well done
    • Blog Articles
      • Blog Articles
    • CI/CD
      • Requirements
      • Lesson 1: Setup CI/CD
      • Lesson 2: Monitoring CI/CD
      • Lesson 3: Custom CI/CD workflow
      • Well done
    • Cron Jobs
      • Requirements
      • Lesson 1: Bootstrap a Headless App
      • Lesson 2: Set up Alarm Feed with Trigger and Rule
      • Lesson 3: Types of Alarm Feed
      • Well done
    • Custom Asset Compute Worker
      • Requirements
      • How AEM as Cloud assets works
      • Architecture of our worker
      • Configure services
      • Local environment setup
      • Implement the worker
      • Test the worker
      • Setup AEM to use the worker
      • Well Done
    • Customer Dashboard
      • Requirements
      • Lesson 1: Create a New App Builder App from Campaign Standard Template
      • Lesson 2: Explore the App Builder App
      • Lesson 3: Run the App Builder App Locally
      • Lesson 4: List All Customer Profiles on the UI
      • Lesson 5: Add Personalized Promotion Emails Triggering
      • Well Done
    • Debugging
      • Requirements
      • Lesson 1: Getting familiar with Debugger
      • Lesson 2: Debugging Application Code
      • Lesson 3: Managing Application Logs
      • Well Done
    • Event Driven
      • Requirements
      • Lesson 1: Create a New App Builder App from Template
      • Lesson 2: Register the App as Event Provider
      • Lesson 3: Fire an Event
      • Lesson 4: Consume Events
      • Well Done
    • Events Runtime
      • Requirements
      • Lesson 1: Step by Step Guide
      • Lesson 2: Verify the result
      • Well done
    • Journaling Events
      • Requirements
      • Lesson 1: Create an Event Provider using App Builder
      • Lesson 2: Create the Event Consumer using Journaling API
      • Lesson 3: End to end test
      • Well done
    • Sample Apps
      • Code Snippets
        • Caching HTTP responses
        • App Builder Files SDK
        • App Builder State SDK
        • I/O Events handler
        • Real-time data from Adobe Analytics API 1.4
    • Spectrum Introduction
      • Lesson 1: What is Spectrum ?
      • Lesson 2: Using Spectrum CSS
      • Lesson 3: Using React Spectrum
      • Lesson 4: Using React Spectrum in App Builder
      • Well done
    • Todo App
      • Requirements
      • Lesson 1: Create a New App Builder App with the React Spectrum template
      • Lesson 2: Setup Runtime actions
      • Lesson 3: Setup the CreateTodoList component
      • Lesson 4: Setup the Todo component
      • Lesson 5: Setup the TodoList component
      • Lesson 6: Bringing the pieces together to build the App
      • Well done
    • Videos
      • Overview
        • Introducing App Builder
        • Getting Started
        • Architecture
        • A Full Security Overview
        • User Journey
      • Exploring
        • Projects and Workspaces
        • React Spectrum
        • Custom Events
        • CI/CD
        • Debugging
        • Learning Resources
        • Dashboard Case Study
        • ODE Case Study
        • Deep Dive Use Cases
        • Live Wired Sneak
        • Softcrylic Partner Showcase
      • Developers Live
        • App Builder Deep Dive
        • Asset Compute Service Extensibility
        • Extend Adobe Experience Cloud

Lesson 4: Consume Events

There are three ways one can consume event:

  • Using Journaling API
  • Using runtime action
  • Using webhook URL

Option 1: Using Journaling API to consume events

Adobe offers journaling to consume events. The Adobe I/O Events Journaling API lets enterprise integrations consume events at their own cadence and process them in bulk. Unlike webhooks, no additional registration or other configuration is required. Every enterprise integration that is registered for events is automatically enabled for journaling. Journaling data is retained for 7 days.

After you fire an event, you should be able to verify it by journaling the UNIQUE API ENDPOINT you get from the console by following the instructions in the Adobe I/O Events documentation: Journaling API.

You could also use the Curl command or POSTMAN to call the journaling UNIQUE API ENDPOINT to see your fired event. Or you could use Custom event SDK to call the Journaling API and retrieve your event.

Option 2: Using runtime action

If you have access to Adobe I/O Runtime (included with App Builder) and have defined a Slack webhook url, you can edit the app.config.yaml to add an action called slack:

  • slack:
          function: actions/slack/index.js
          web: 'yes'
          runtime: 'nodejs:14'
          inputs:
            LOG_LEVEL: debug
          annotations:
            final: true
    

    Add an actions folder actions/slack/index.js with this sample code:

var request = require('request'); /* default slackwebhook and channel add yours here and replace the TODO below */ /* this is a sample action for how to receive event and sent a message to slack */ var request = require('request'); /* default slackwebhook and channel add yours here and replace the TODO below */ var slackWebhook = "<your-webhook>"; var slackChannel = "<your-slack>"; async function main (params) { /* print event detail */ console.log('in main + event detail: ', params.event); var returnObject = { statusCode: 200, headers: { 'Content-Type': 'application/json' }, body: "" }; /* handle the challenge */ if (params.challenge) { console.log('Returning challenge: ' + params.challenge); returnObject.body = new Buffer(JSON.stringify({ "challenge": params.challenge })).toString('base64'); return returnObject; } else { /* we need it to run asynchronously, so we are returning a Promise */ return new Promise(function (resolve, reject) { var slackMessage = " Event received: " + JSON.stringify(params); var payload = { "channel": slackChannel, "username": "incoming-webhook", "text": slackMessage, "mrkdwn": true, }; var options = { method: 'POST', url: slackWebhook, headers: { 'Content-type': 'application/json' }, body: JSON.stringify(payload) }; request(options, function (error, response, body) { if (error) { console.log("ERROR: fail to post " + response); reject(error); } else { console.log ("SUCCESS: posted to slack " + slackMessage); returnObject.body = new Buffer(JSON.stringify({ "slackMessage": slackMessage })).toString('base64'); resolve(returnObject); } }); }); } } exports.main = main

Once you have deployed your runtime action, verfiy that the webhook is working by:

curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"}' https://<your-namespace>.adobeio-static.net/api/v1/web/event-demo-0.0.1/slack

On Developer console, you will see: slack webhook Select the Slack option and save it. Now when you fire an event, you should receive a Slack message whenever a person clicks the "Like" button: slack message

Option 3: Using webhook to consume events

You could configure another event delivery method through the console using Edit Events Registration and add a webhook:

webhook

Before you can register a webhook, the webhook needs to be online and operational. If it is not, the registration will fail. So set that up first. Your webhook must be hosted on a server. For development, you may use localhost along with a tool like Ngrok.

Your webhook needs to:

  • Be accessible from the internet (localhost won't work)
  • Be reachable over HTTPS
  • Correctly respond to a "challenge" request. For more details, consult Introduction to Adobe I/O Events Webhooks.

Test it and fire events

Now when you fire an event (or in our Code Lab case, click the invoke button) you should see it appearing in three ways:

  • Through Adobe I/O Journaling API
  • Receiving a Slack message through the slack runtime action webhook
  • Through a webhook URL