Reports

Segment based reports & bulk actions

Segments are pre-defined “views” of your data. You can create a segment from almost any data type, and the report will only show data that matches the segment’s filter rules. The Sheep system comes with a large number of automatic segments created for common use cases. You can also create your own segments.

Requesting a report/action

Reports are asynchronous - you must request the report and then come back once it has been processed. To request a report, you must provide the following information: (the segment URI is part of the URL). The report file will be stored on Amazon S3 when it is ready.

template

optional - (this dictates which fields are visible in the report)

policy

optional - the security policy for the report only needed if you wish to export fields beyond the usual security policies.

gdpr_bypass

optional - defaults to False, set True to bypass GDPR checking

gdpr_bypass_reason

required if GDPR bypass is set, you must provide a reason for doing so

gdpr_channel

optional: for PDF reports (process (default), post, email)

http GET https://sls-api.sheepcrm.com/api/v2/example/segment/634d38a....21d46/all/{format}/ "Authorization: Bearer $API_KEY"

HTTP/1.0 200 OK

{
"bucket": "example",
"debug": null,
"journal_uri": "/example/journal/634db79....d005c2a/",
"lambda_prefix": "sheepcrm-reports",
"policy": "membership",
"report_format": "xlsx",
"template": "/example/template/634d41.....63821e1a/",
"uid": "634d38a....21d46",
"use_mapreduce": true,
"user_uri": "/sheepcrm/user/554b31....00a4b4/"
}

The journal_uri in the response is the URI of a notification/reminder/task which will have been created for the user. The notification is created with a “preparing” title, and will be updated with the report’s status and the S3 link when it is ready to download.

If the report fails, the notification will be updated with the error message.

Report Types

Excel / XLSX

Use Excel reports to get access to the underlying data.

{segment uri}/all/xlsx/

PDF

Use PDF reports to get printable versions of the data. PDF templates can be user generated content or a fixed format report.

{segment uri}/all/pdf/

template

size

description

sheep-card-standard

8.51 x 5.51 cm

simple membership card

sheep-receipt-a5

A5 Landscape

payment receipt

sheep-membership-certificate-a4

A4 Portrait

sheep-invoice-a4

A4 Portrait

avery-3478

(1 x 1)

address labels

q-connect-kf26050

(1 x 1)

address labels

q-connect-kf26056

(1 x 2)

address labels

q-connect-kf02246

(2 x 2)

address labels

q-connect-kf71461

(2 x 3)

address labels

q-connect-kf26055

(2 x 4)

address labels

q-connect-kf26053

(2 x 8)

address labels

q-connect-kf26052

(3 x 6)

address labels

q-connect-kf26054

(2 x 7)

address labels

q-connect-kf26051

(3 x 7)

address labels

q-connect-kf26071

(3 x 8)

address labels

avery-3652

(3 x 7)

address labels

avery-3653

(2 x 7)

address labels

avery-3653-p

(2 x 7)

address labels

avery-3484

(2 x 8)

address labels

avery-3427

(4 x 2)

address labels

avery-3475

(8 x 3)

address labels

avery-3425

(5 x 2)

address labels

avery-3483

(2 x 2)

address labels

avery-3663

(5 x 13)

address labels

ryman-p16-universal-99x34mm

(2 x 8)

address labels

for full list of labels see API calls below

Available Labels

http GET https://sls-api.sheepcrm.com/api/v2/reports/pdf/address_labels/  "Authorization: Bearer $API_KEY"

HTTP/1.0 200 OK

{
    "avery-3425": {
        "height": 5.7,
        "name": "avery-3425 (5 x 2)",
        "unit": "cm",
        "width": 10.5
    },
    "avery-3427": {
        "height": 7.4,
        "name": "avery-3427 (4 x 2)",
        "unit": "cm",
        "width": 10.5
    },
...

Available Membership Certificates

bucket

optional - pass the bucket (flock identifier) for additional custom certificates

http GET https://sls-api.sheepcrm.com/api/v2/reports/pdf/membership_certificates/  "Authorization: Bearer $API_KEY"

HTTP/1.0 200 OK
{
    "sheep-membership-certificate-a4": {
        "height": 29.7,
        "name": "sheepCRM A4 portrait",
        "unit": "cm",
        "width": 21.0
    }
}

Available Letter Templates

bucket

required

http GET https://sls-api.sheepcrm.com/api/v2/reports/pdf/letters/  "Authorization: Bearer $API_KEY"

HTTP/1.0 200 OK
{
"/example/template/63490b08fa78f4fa203eedea/": {
    "height": 29.7,
    "name": "Thank you for your completed membership application",
    "unit": "cm",
    "width": 21.0
},
"/example/template/634d41ddcffe37f863821e1a/": {
    "height": 29.7,
    "name": "Subscription Renewal PDF",
    "unit": "cm",
    "width": 21.0
}

}

Mailchimp Segment export

name

optional - name of the Mailchimp segment (will be prefixed by sheepCRM segment:), defaults to the segment name if not provided

Create a one-off mailchimp segment from the the sheep segment

{segment uri}/all/sync_mailchimp/

Sending emails to a segment

segment_uri

required - the segment uri

template

required* - template to use for the email

subject

required* - subject of the email

body

required* - body of the email

gdpr_bypass

optional - set to true to bypass the gdpr checks

*either template or subject and body are required

http POST https://api.sheepcrm.com/api/v1/example/reports/segment_email_builder/ "Authorization: Bearer $API_KEY" segment_uri=/example/segment/632c65beb05d1aa53ac6b923/ subject="test 1" body="hi {{first_name}}"

{
    "bad_email": 9,
    "duplicate": 0,
    "message": "/example/message/637e3cf3b443397649e785de/",
    "missing_email": 0,
    "num_contacts": 66,
    "query": {
        "membership_record_status": "active"
        "exact": true,
        "mode": "AND"
    },
    "segment_uri": "/example/segment/632c65beb05d1aa53ac6b923/",
    "skipped": 0
}