Skip to content

This app provides an extension point for JB to connect with any external services via REST API

License

Notifications You must be signed in to change notification settings

beau32/JB-Restful-Activity

Repository files navigation

JB RESTful Activity - This is app allows SFMC journey builder to integrate with third party API in real time

Reference links:

NOTE: You won't be able to run this locally. It is intended to be ran on a publicly available web server/cloud only.

Pre-Requisites

  • Node.js (to test locally)
  • Must have an Salesforce Marketing Cloud account
  • Journey Builder and all associated applications must be provisioned into this account
  • A publicly accessible web server or cloud (netlify)
  • Understanding of client-server communications, JavaScript, HTML(5), Node.js and Express

How To Use

Deploy to Render

  1. Deploy to Rnder using the button above, load the environment variables based on the ones in .env file
  2. Login to your account on Marketing Cloud
  3. Select Setup -> App Integration from navigation
  4. Select "Create New App"
  5. Create a custom activity for journey builder, and fill in the endpoint for the app, {subdomain}.netlify.app/public/jbcustom/ hit save then hit finish
  6. Go to Journey Builder and you should see the custom activity appearing in the bottom

Re-deploy application to host

Now that you have updated your configurations to point to the appropriate resources, push your changes.

Defining our test journey using a data extension as the source

  1. Log into the Marketing Cloud
  2. Choose Journey Builder and create a new journey.
  3. Add a data extension source

Creating our Custom Activity

  1. Drag the custom activity from the list onto the Interaction Canvas
  2. Hover and click the activity
  3. The custom activity dialog should appear (this is loading from your app)
  4. fill in the request body using json object specified by axios. Leverage data binding to access any part of the data structure sent in from SFMC.
image

example:

{
  method: 'post',
  url: 'https://apidev.example.com/',
  params: {
    apikey: "",
    function: 'InsertRecord',
    module: 'data',
    datasetid: 8088,
  },
  "data": {
        "FirstName": "{{Contact.Attribute.testlist.firstname}}",
        "salary": "{{Contact.Attribute.testlist.salary}}",
        "age": "{{Contact.Attribute.testlist.age}}",
        "id": {{Contact.Attribute.testlist.id}}
    }
}
  1. fill in webhook url and Oauth 2.0 if required
  2. fill in pre/post run options if you need to run your own javascript, SFMC data binding variables such as InArguments are accessible. Pre-run script aimes to address use case where request logging or data transformation is required. Post-run script allows developers to transform the server response into a format that can be consumed back in SFMC via outArguments
  3. activiate the journey, validate result via nodejs server log and destination API endpoint

About

This app provides an extension point for JB to connect with any external services via REST API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages