Support Portal

Example Webhook payload in Seven Senders Portal and Scheduling of a Look via Webhook

Understanding Webhook Payload

Webhooks are a powerful way to regularly deliver data to your servers or third-party services like S3, Dropbox or Google sheets through products like Warkato & Zapier. Webhooks deliver data to a HTTPS URI with your data and some meta-information as JSON. Seven Senders Portal requires your server or service of choice to present a valid HTTPS certificate before sending data. If you just want to send and not schedule data click here to explore more.

Formats

Seven Senders Portal webhook supports various formats for representing the data in your Look or Dashboard. When scheduling a Look to send its data via Webhook, Seven Senders Portal supports the following formats:

  • CSV
  • TXT
  • JSON ("inline" and as a JSON string)
  • HTML
  • Excel

When scheduling a Dashboard to send its data via webhook, Seven Senders Portal supports sending data as a PDF. Note that, scheduling the dashboards to send it via email supports slighlty different formats. In the following sections are examples listed that show how Seven Senders Portal sents the data it is accessible. 

Webhook Payload Example: CSV

Here are some example data for a CSV webhook payload —** CSV** is the format you probably want to select, if you are aiming for data in a text-based, structured, table format. The structure of the payload presented here will be identical for TXT, HTML and JSON formats. XLSX and PDF formats will also have the same structure, but must be treated seperately because they are binary formats (more in the Webhook Payload Example: PDF section). The Inline JSON format has a slightly different structure and is also covered below.


{
    "attachment": {
        # Raw data
        "data": "Division,Revenue,Profit\nBrick + Mortar,3828101,739192\nOnline,7184918,4947684",
        "mimetype": "text/csv",
        "extension": "csv"
    },
    # Meta information
    "scheduled_plan": {
        # Name of the Look or Dashboard in Looker
        "title": "Sales — Year to Date",
        # Link to the Look or Dashboard in Looker
        "url": "https://look-your-data.looker.com/looks/19",
        "scheduled_plan_id": 37,
        "type": "look"
    }
}

The structure of the payload (i.e. the keys for the webhook data) for JSON, TXT and HTML are the same. In all these cases, data are encoded as a string under the attachment:data key of the webhook payload; for example for JSON:

"data": [{"Division": "Brick + Mortar", "Revenue": 3828101, "Profit": 739192}, {"Division": "Online", "Revenue": 7184918, "Profit": 4947684}]

Webhook Payload Example: Inline JSON

When specifying Inline JSON as your delivery format, the structure (i.e. the keys) of the payload will slightly differ. Whereas both the JSON and Inline JSON formats encode data under the attachment:data key, Inline JSON specifies format specifies data as a JSON object and does not include the "mimetype" or "extension" keys.

Example data:


{
    "attachment": {
        # Note that data are JSON object and not a JSON string
        "data": [
            {
                Division: "Brick + Mortar",
                Revenue: 3828101,
                Profit: 739192
            },
            {
                Division: "Online",
                Revenue: 7184918,
                Profit: 4947684
            }
        ]
        # Note that mimetype and extension are not specified
    }
    "scheduled_plan": {
        "title": "Sales — Year to Date",
        "url": "https://look-your-data.looker.com/looks/37",
        "scheduled_plan_id": 11,
        "type": "look" 
    }
}

Webhook Payload Example: PDF

Whereas the CSV format is text-based, the PDF and XLSX are binary formats and are treated a little different. The keys included in the webhook payload will be the same and data will still be contained in the attachment:data key in both formats. Yet data will be base64 encoded. Let's look at an example:


{
    "attachment": {
        # Base64 encoded data
        "data": "TG9va2VyIHJvY2tzIQ==...",
        "mimetype": "application/pdf;base64",
        "extension": "pdf"
    },
    # Meta information
    "scheduled_plan": {
        # Name of the Look or Dashboard in Looker
        "title": "Sales Dashboard",
        "url": "https://look-your-data.looker.com/dashboard/42",
        "scheduled_plan_id": 23,
        "type": "dashboard"
    }
}

When saving a PDF document, you will need to decode the base64 data, save it, then open it in your application of choice. Important here, Zapier does currently not allow saving binary files and thus PDFs cannot be saved with Zapier to services like Dropbox.

XLSX documents require the same procedure and it is reccommended to use the standard, but long mimetype application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64.

Scheduling a Look via Seven Senders Portal Webhook

To schedule a Look via Seven Senders Portal Webhook, follow the steps described above:

  • Open any Look you wish to schedule 

  • Click on Schedule in the menu opening by clicking on the gear or press Ctrl+Alt+S.

  • Name your schedule
  • Select Webhook as data destination. The Webhook URL should be copied from the service provider you are using such as Workato (example explained here). 
  • Select the data format to define the receiving data. Just keep in mind JSON-Simple Inline payload differs from all the other formats and should be treated differently explained here  
  • Customise how you wish the data to be delivered i.e Daily, Weekly, Monthly, Hourly etc.  
  • Apply the set of filters  
  • Define advance options explained here    
  • Click Save All at the end. There is also the option to test your webhook first to see if its working.    

Webhook from Workato

In this section, is a step by step explanation for setting up a webhook with Workato as an example service provider. Workato also enables a simple way to sent data in JSON-Simple Inline format. 

  • Goto Workato and open an account. 
  • After your account has been successfully created navigate to Recipes and click on Create a new recipe.

  • Choose the app "HTTP" as trigger option
  • Select the trigger event option New Event Via Webhook

  • Workato provides you with the URL to be entered in Webhook URL in Seven Senders Portal. *Do not paste it yet and click next and Connect your HTTP Connection


  • Choose Connection name
  • Select an authentication type (Keep it none if you wish)
  • Use client SSL certificate and click Link your Account and then click Next.

  • Choose the Event name. After naming it you see that the Webhook URL has change and added event name at the end of Webhook URL. 
  • Now your Webhook URL is ready to copy from workato and paste in Seven Senders Portal (explaned this step
  • Select webhook type to be PUT/POST with JSON Payload and Empty Payload to be 'No'
  • Now its time to define schema so that we can catch the data and use it in different applications. Copy the exact schema which is working for all formats from here except "JSON — Simple, Inline". For "JSON — Simple, Inline" use this Schema.

  • Click next on top right
  • Now you're done with catching the data from webhook. Now its up to you what you want to do with this. For ease of understanding we will create a JSON file in google drive.
  • In the actions part select the App Google Drive and Action Upload a file and click next

  • Link your Google Drive and click next. Once your account is linked you can now upload a new file with the content coming from webhook.
  • Choose the file content 'Data' from right App data → New event via Webhook → Payload → Attatchment → Data or simply drag and drop. Make sure that Mimetype is "Mimetype" from app data and title needs be "title" so that it is clear which file was created. You can also specify your own custom filename here as well and select the folder you want this file to be saved. 
  • Click Finish 
  • Now just click Start recipe


Whenever Seven Senders Portal sends data via webhook, a file will be created in the selected google drive.

Generic Schema for all Payloads:

Use this schema to catch the data for all formats expect "JSON-Simple Inline" which is listed below:

{"attachment": {
"mimetype": "application/json",
"extension": "json",
"data":  " " },
"scheduled_plan": {
  "scheduled_plan_id": "142",
  "title": "Nexive region"
 }
}

Schema for "JSON-Simple Inline"

The webhook payload differs for JSON-Simple Inline. Use the schema mentioned below to catch the data:

{
"data": " ",
  "scheduled_plan": {
    "scheduled_plan_id": "142",
    "title": "Nexive region"
  }
}