How to use Custom Requests?
Alex Kistenev avatar
Written by Alex Kistenev
Updated over a week ago

In order to start getting data from your data bases you need to:

  1. create an endpoint that would return a JSON object;

  2. create Custom Request;

  3. add the Request to one of your reports.

Creating an endpoint

In order to get data from your data base you need to create an endpoint and provide us with its URL. Returning a JSON with one custom Slack attachment is required for the HTTP GET request to the provided URL.

To learn more about attachment structure check out the Slack official documentation. In order to check your code click this link, then click "Try it", then enter your JSON and see the preview of the message that you'll get from Standuply.

Here is an example of our own JSON object we use for getting data from our internal data base via Custom Request:

{
  "fallback": "Required plain-text summary of the attachment.",
  "color": "#36a64f ",
  "pretext": "Dashboard",
  "author_name": "Your Bot",
  "author_icon": "http://flickr.com/icons/bobby.jpg",
  "title": "Total data",
  "title_link": "https://.../",
  "text": "Main total numbers",
  "fields": [
    {
      "title": "Teams",
      "value": "N",
      "short": true
    },
    {
      "title": "Active reports",
      "value": "N",
      "short": true
    },
    {
      "title": "Answers",
      "value": "N",
      "short": true
    },
    {
      "title": "No bot",
      "value": "N",
      "short": true
    },
    {
      "title": "Report Paused",
      "value": "-",
      "short": true
    },
    {
      "title": "Requests",
      "value": "-",
      "short": true
    },
    {
      "title": "PAT",
      "value": "-",
      "short": true
    }
  ],
  "image_url": "http://my-website.com/path/to/image.jpg",
  "thumb_url": "http://example.com/path/to/thumb.png",
  "footer": "Slack API",
  "footer_icon": "https://platform.slack-edge.com/img/default_application_icon.png",
  "ts": 1503041350
}

How to create Custom Request?

1. Open your Standuply's personal account.

2. Click "Create Request" here (if this is the first Request you create)

or here (if you've already created some Requests)

3. Select "Custom Request"

4. Enter the endpoint's URL.

Note: If you get back to the dashboard without accomplishing the Request customization, its status will be shown as "Draft"

How to add the Custom Request to a report?

There are two ways to add the Custom Request to a report.

1. You can add the request right after you've created or edited it by clicking "Next" after you're done with setting it up.

You will see the list of your reports. Choose the one you'd like to add the Request to and click the gray switcher in order to connect the Request to this particular report.

When the Request is connected to the report, the switcher becomes green and you can see the word "Connected!" near it. This means that you will get the data from your data base according to the schedule of this report.

2. You can add the request from the "Respondents & Requests" section of the report's settings.

Click "Request" on the report's block

or click this gear on the right side and select "Edit"

If you have chosen the second option, click "Respondents & Requests" on the top bar of the report's settings

Scroll down to the bottom of this section and click the "Add request" button

Select the request you'd like to connect to the report

After you connected one or several requests to the report, they appear in the report's settings

In order to delete a request click the green gear of the request's block and then click "Delete"

Did this answer your question?