Pipedream

Introduction

Pipedream is a low code integration platform built for developers. With Pipedream, you can build workflows by selecting a trigger (HTTP requests, schedules, app events, and more) and adding one or more steps.

MoEngage <> Pipedream

The MoEngage and Pipedream integration allows you to easily send data between MoEngage and other apps using custom logic and code functions. With this integration, you can - 

  1. Use MoEngage as a trigger Pipedream via our Connector campaigns 
  2. Send data from Pipedream to MoEngage using our Data APIs 

Use Cases

  1. When an event occurs in MoEngage, add a new row in Google Sheets.
  2. Import users from Google Form Leads into MoEngage.
  3. Send a Slack message when a user performs an event.
  4. Import events into MoEngage from a WebHook setup in Pipedream.

Integration

 

PREREQUISITES

  • Ensure you have access to your Pipedream account.
  • Ensure you have access to Data API keys in MoEngage Dashboard.

Use MoEngage as a Trigger

You can make use of MoEngage's Connector Campaigns to use MoEngage as a trigger.

Step 1: Add HTTP Webhook Requests as a Trigger

Trigger-Step1.png

  1. Click on "Add a Trigger".
  2. Search for "HTTP / Webhook".

Trigger-Step2.png

  1. Event Data => Full HTTP Request
    HTTP Response => Return HTTP 200 OK
  2. Click on "Save and continue".
  3. A new unique URL to trigger your workflow will be displayed. Save this URL as we will need it to set up the Connector Campaign.

Trigger-Step3.png

Step 2: Setup the Connector Campaign in MoEngage Dashboard

  1. Navigate to MoEngage Dashboard.
  2. Use any one of the following options:
    1. On the All Campaigns page, click Create Campaign.
      The Create Campaign page is displayed.
      CreateCampaign_RightNav.png
    2. Click Create New > Campaign.
      The Create Campaign page is displayed.
      CreateCampaignLeftNav.png
  3. Click Custom under Connectors.
  4. For the campaign delivery types, choose "Event-Triggered".
    • For more information about delivery types, refer to Delivery Types.
  5. On the next screen, give your Campaign a name, and select the Criteria as "Device Uninstall".
  6. For the trigger, choose "immediately".

UseCase2-Step3.png

  1. For the audience, let us choose "All users" for this use case. Click "Next" when satisfied.
  2. On the content screen, we will define our payload and webhook URL we got from the previous step.
  3. Choose the method as "POST" (know more about Pipedream HTTP Requests).
  4. Enter the webhook URL you copied earlier.
  5. Define the headers and parameters as per your requirements. For this use case, we will just define our payload body- (you can type @ to insert personalized values as well)

Trigger-Step4.png

  1. Now you need to test this webhook, scroll down and enter a test user's data and click on "test".
  2. You should see a new modal saying the test was successful:

UseCase2-Step5.png

  1. Now go back to the Pipedream editor. You should see "1 New Event" in the Select Event dropdown.

Trigger-Step5.png

Step 4: Test Trigger on Pipedream

  1. Select the latest event from the "Select Event" dropdown. You should see the API request in the Exports tab. Click continue.

Trigger-Step6.png

  1. You can now publish your Connector Campaign on MoEngage.
  2. In Pipedream, add a new step in your workflow. For example, let's pick Google Sheets. Choose "Add Single Row" Action.
  3. Select or connect a new Google Sheets Account. 
  4. Pick your Spreadsheet.
  5. Pick your Sheet.
  6. Pick "Yes" if you have the first row as Header in your Sheet.
  7. Map each of the columns of your Sheet from the response of the Trigger. You can also enter custom values.

Action-Step2.png

  1. Once you are satisfied with the configuration, you can choose to test this step or the entire workflow.

Action-Step3.png

  1. Once the insert is successful, you can then deploy this workflow. It will insert new rows to Google Sheets each time a user performs your selected event in MoEngage.

Action-Step4.png

Using Data APIs in Pipedream

Using MoEngage's Data APIs, you can:

  1. Create or Update users
  2. Import Events
  3. Add or remove users in cohort (segment)

In order to make use of Data APIs in Pipedream, you need to add the "HTTP / Webhook" step. You can choose to send GET or POST Requests depending on the type of call supported in MoEngage. Data API is a collection of the following APIs:

This help doc will show you how to setup User API as Action, but can be applied to any of the above APIs.

Step 1: Add Webhook Step in Pipedream

  1. Choose "HTTP / Webhook" from the list of apps.
  2. Select "Send POST Request" from the list of actions.
  3. For the request URL, type https://api-0X.moengage.com/v1/customer/<APP_ID>. Replace 0X with the Data Center Region your app resides in, and APP_ID with your App ID. To get your App ID, go to Dashboard >> Settings >> API >> Data API Settings.
  4. In the Auth tab, select "Basic Auth".
    1. For Username, type your App ID.
    2. For Password, type your Data API Key.

Action-Webhook-Step-2.png

  1. In the Headers tab, enter a new header:
    1. Header Name: MOE-APPKEY
    2. Header Value: type your App ID.

Action-Webhook-Step-3.png

  1. In the Body tab, select Content-Type as "application/json".
  2. Click on the "Edit Raw JSON".
  3. Copy and paste the following payload from the User API docs:
{
"type" : "customer",
"customer_id": "john@example.com",
"attributes": {
    "first_name":"John",
    "last_name":"Doe",
    "email": "john.doe@example.com",
    "platforms" : [{"platform":"ANDROID", "active":"true"}]
    }
}
  1. You can now map values from your previous step to this JSON body. Just select the appropriate variable from the Pipedream editor Variable selector dropdown.

Action-Webhook-Step-4.png

  1. You can add/remove the fields in the Body as you like. The final payload can look something like this:

Action-Webhook-Step-5.png

  1. Once you are ready, you can "Test" the step. This will send an API Request to the MoEngage Data Centers.
  2. If your call is a success, you should see the following in your Results panel:

Action-Webhook-Step-6.png

  1. You can choose to Deploy your workflow once you are happy with the results.

The rest of the Data APIs can also be deployed in a similar fashion.

Was this article helpful?
0 out of 0 found this helpful