How to use Custom Requests?
To start getting data from your databases, you need to:
Create an endpoint that would return a JSON object;
Create Custom Request;
Add the Request to one of your reports.
Creating an endpoint
To get data from your database, 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. 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 database 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?
Step 1: Open your Standuply's personal account and click the "Create Request" button. Then all the Requests you create will be located nearby that area.
Step 2: Select the “Custom integration” item.
Step 3: Enter the endpoint's URL, and hit the “Done” button and your Request will be added to Standuply Dashboard.
You can see how your Request will look like in Slack by clicking the “Preview in Slack” button. You are allowed to customize the Request name as well.
If you get back to the Dashboard without accomplishing the Request customization, its status will be shown as "Draft". So you can continue creating the Request by clicking on the “Edit” button or deleting it.
How to add the Custom Request to a Report?
There are two ways to add the Custom Request to a Report.
Way #1:
You can add the Request right in the process of creating or editing by clicking the "Next" button 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 the item "Connected!" appears. This means that you will get the data from your database according to the schedule of this Report.
Way #2:
You can add the Request from the "Respondents & Requests" section of the Report's settings.
Step 1: Click "Request" on the report's block or click the “Settings” button on the right side and select "Edit".
Step 2: On the "Respondents & Requests" top bar of the report's settings scroll down to the bottom and click "Add request".
Step 3: Select the Request you'd like to connect to the Report. After you’ve connected one or several Requests to the Report, they will 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".