Activities

Get all activities

GET /cases/:case_id/activities

Query string parameters

Response
Status code 200

{
  "data": [
    {
      "id": "f665e23c-5501-2438-22b5-d22bbc74a623",
      "activity_types": [
        {
          "id": 1,
          "name": "Some type"
        },
        {
          "id": 2,
          "name": "Some other type"
        },
        {
          "id": 3,
          "name": "Some Third type"
        }
      ],
      "communication_channel": "email",
      "created_at": "2015-02-11 09:03:09",
      "updated_at": "2015-02-11 09:03:09"
    }
  ],
  "pagination": {
    "total": 9,
    "page": 1,
    "per_page": 15,
    "urls": {
      "previous": null,
      "next": null
    }
  }
}

Find a activity

GET /cases/:case_id/activities/:activity_id

Response
Status code 200

{
  "id": "f665e23c-5501-2438-22b5-d22bbc74a623",
  "activity_types": [
    {
      "id": 1,
      "name": "Some type"
    },
    {
      "id": 2,
      "name": "Some other type"
    },
    {
      "id": 3,
      "name": "Some Third type"
    }
  ],
  "communication_channel": "email",
  "note": {
    "id": 1,
    "note": "Sit sunt ut odit ut.. Laudantium voluptas quia excepturi dolorum ad assumenda.. Voluptas ipsum consequatur reprehenderit.",
    "user": {
      "id": 1,
      "first_name": "Doe",
      "last_name": "John",
      "phone_number": "+4588888888",
      "job_title": "Animal",
      "email": "info@easir.com",
      "profile_picture": "http://cdn.cutestpaw.com/wp-content/uploads/2013/06/l-Baby.jpeg",
      "created_at": "2014-01-01 12:45:56",
      "updated_at": "2014-01-02 00:11:22"
    },
    "created_at": "2015-02-11 09:03:09",
    "updated_at": "2015-02-11 09:03:09"
  },
  "correspondence": {
    "email": {
      "sender": "info@easir.com",
      "recipients": [
        {
          "email_address": "mail1@example.com"
        },
        {
          "email_address": "mail2@example.com"
        },
        {
          "email_address": "mail@example.com",
          "contact": {
            "id": "024217da-f2b3-4854-a24f-04418f560725",
            "name": "john doe"
          },
          "account": {
            "id": "0de95f95-a5b9-2960-1d21-5d7cccfa45ad",
            "name": "Some company"
          }
        }
      ],
      "cc": [
        {
          "email_address": "mail3@example.com"
        },
        {
          "email_address": "mail4@example.com"
        },
        {
          "email_address": "mail34@example.com",
          "contact": {
            "id": "024217da-f2b3-4854-a24f-04418f560725",
            "name": "john doe"
          },
          "account": {
            "id": "0de95f95-a5b9-2960-1d21-5d7cccfa45ad",
            "name": "Praesent Consulting"
          }
        }
      ],
      "bcc": [
        {
          "email_address": "mail5@example.com"
        },
        {
          "email_address": "mail6@example.com"
        },
        {
          "email_address": "mail65464365@example.com",
          "contact": {
            "id": "024217da-f2b3-4854-a24f-04418f560725",
            "name": "john doe"
          },
          "account": {
            "id": "0de95f95-a5b9-2960-1d21-5d7cccfa45ad",
            "name": "Praesent Consulting"
          }
        }
      ],
      "attachments": [
        "9a8d0758-6182-4e16-92a6-d9a4adfeabb7"
      ],
      "subject": "nesciunt quis laudantium eveniet",
      "content": "Sit officia veritatis velit a perspiciatis quia. Quidem ratione voluptatem voluptas qui ex maxime esse dolorem. Omnis natus optio tempore nisi iure. Est id alias quia. Ut est autem repellat enim eaque dolores vero. Sunt eum et autem facilis. Sapiente saepe non magni autem. Assumenda distinctio aut autem minus provident dolorum. Id voluptatem non modi ad. Et minima fugit ut voluptatem aut quia hic.",
      "body": "<html><head></head><body>Sit officia veritatis velit a perspiciatis quia. Quidem ratione voluptatem voluptas qui ex maxime esse dolorem. Omnis natus optio tempore nisi iure. Est id alias quia. Ut est autem repellat enim eaque dolores vero. Sunt eum et autem facilis. Sapiente saepe non magni autem. Assumenda distinctio aut autem minus provident dolorum. Id voluptatem non modi ad. Et minima fugit ut voluptatem aut quia hic.</body></html>",
      "sent_at": "2015-02-11 09:03:09",
      "opened_at": "2015-02-11 09:03:09",
      "clicked_at": "2015-02-11 09:03:09",
      "created_at": "2015-02-11 09:03:09",
      "updated_at": "2015-02-11 09:03:09"
    }
  },
  "product_details": {
    "id": "9de8fe50-af18-a4b6-3632-3a5c371dae8c",
    "products": [
      {
        "id": "a61db97b-1d90-e744-16c5-a7274ceb55eb",
        "name": "Adipiscing Elit Associates",
        "quantity": 3,
        "type": "487",
        "price": 3109,
        "discount": 10,
        "comment": "Some comment"
      },
      {
        "id": null,
        "name": "Mi Felis PC",
        "quantity": 0,
        "type": "488",
        "price": 5412,
        "discount": 0,
        "comment": null
      },
      {
        "id": "650ef4e4-5df3-c465-fbae-1aa06ff6693f",
        "name": "Erat Eget Ltd",
        "quantity": 3,
        "type": "487",
        "price": 8432,
        "discount": 10,
        "comment": "Some comment"
      },
      {
        "id": null,
        "name": "Eu Corporation",
        "quantity": 0,
        "type": "488",
        "price": 4057,
        "discount": 0,
        "comment": null
      }
    ],
    "created_at": "2015-02-11 09:03:11",
    "updated_at": "2015-02-11 09:03:11"
  },
  "task": [],
  "created_at": "2015-02-11 09:03:09",
  "updated_at": "2015-02-11 09:03:09"
}

Create a new activity

POST /cases/:case_id/activities

Parameters

  • activity_types array - List of the activity types ids.
    • Required
  • communication_channel string
    • Must be email, call, letter or meeting.
    • Required
  • extra_steps array - List of extra step ids.
  • user_id integer
  • source string - Source of activity.
    • Between 1 and 255 characters.
  • note string

Different types of payload

You can pass additional payload when creating a new activity, which is shown below.

Email correspondence

Parameters

  • correspondence.email.correspondence_id UUID - When left out, this will start a new correspondence. Use if this is part of a thread.
  • correspondence.email.recipients array - Objects containing either email-addresses or contact to send to.
    • See recipients array format below.
    • Required when correspondence.email exists
  • correspondence.email.cc array - Objects containing either email-addresses or contact to send cc to.
  • correspondence.email.bcc array - Objects containing either email-addresses or contact to send bcc to.
  • correspondence.email.attachments array - File-ids (will be converted to attachment IDs after saving).
  • correspondence.email.subject string - Email subject.
    • Required when correspondence.email exists
  • correspondence.email.content string - Content of the email.
    • Note that Merge Fields can be used in this field (see the chapter Merge Fields for more information)
    • Required when correspondence.email exists
  • correspondence.email.template_id integer - Which email template to use
    • Required when correspondence.email exists

Format of recipients, cc, and bcc arrays

It's possible to add an e-mail address directly, or reference a contact, for example

[
  {
    "email_address": "customer@example.com"
  },
  {
    "contact": "943cef92-f9b4-4fcb-b4e4-834f34915973"
  }
]

Payload

{
  "activity_types": [
    "a203539b-f06c-442c-8ad0-f5a56f0615f6"
  ],
  "communication_channel": "email",
  "correspondence": {
    "email": {
      "recipients": [
        {
            "email_address": "mail@example.com"
        }
      ],
      "cc": [
        {
            "email_address": "mail2@example.com"
        }
      ],
      "subject": "Subject",
      "content": "CONTENT",
      "attachments": [
        "9c11d08a-b0fd-4989-88d8-c9536d39e236",
        "c9536d39-c4f3-4113-1337-fe2369c11d08"
      ],
      "template_id": 2
    }
  },
  "user_id": 1
}
Letter correspondence

Parameters

  • correspondence.letter.content string
    • Required when correspondence.letter exists
    • Supports Merge Fields
  • correspondence.letter.template_id integer
    • Required when correspondence.letter exists

Payload

{
  "activity_types": [
    "a203539b-f06c-442c-8ad0-f5a56f0615f6"
  ],
  "communication_channel": "letter",
  "correspondence": {
    "letter": {
      "content": "Hello",
      "template_id": 1
    }
  },
  "user_id": 1
}

Response
Status code 201

{
  "id": "618caac1-943a-443d-a449-48193788ea84",
  "activity_types": [
    {
      "id": "a203539b-f06c-442c-8ad0-f5a56f0615f6",
      "name": "Contract"
    }
  ],
  "communication_channel": "email",
  "note": null,
  "correspondence": {
    "email": {
      "id": "2413af3a-2c15-49c9-b53f-0c99f684ac25",
      "activity_id": null,
      "correspondence_id": "8194b060-4d5a-4586-8ec2-a0e5bfc6b94c",
      "user": {
        "id": 1,
        "first_name": "Jane",
        "last_name": "Doe",
        "phone_number": "+4588888888",
        "job_title": "Sales Executive",
        "email": "demo@easir.com",
        "email_notifications": false,
        "profile_picture": "https:\/\/randomuser.me\/api\/portraits\/thumb\/women\/5.jpg",
        "system_user": false,
        "created_at": "2014-01-01 12:45:56",
        "updated_at": "2017-04-25 09:04:36"
      },
      "contacts": null,
      "case_id": null,
      "relations_path_name": "Case type",
      "type": "activity-outgoing",
      "sender": "demo@easir.com",
      "from": [
        {
          "user_id": 1
        }
      ],
      "recipients": [
        {
          "email_address": "mail@example.com"
        }
      ],
      "cc": [
        {
          "email_address": "mail2@example.com"
        }
      ],
      "bcc": [],
      "subject": "Subject",
      "attachments": null,
      "content": "CONTENT",
      "parsed": {
        "fragments": [
          {
            "content": "CONTENT",
            "is_hidden": false,
            "is_signature": false,
            "is_quoted": false
          }
        ],
        "visible_text": "CONTENT"
      },
      "body": null,
      "sent_at": null,
      "created_at": "2017-04-26 07:48:12",
      "updated_at": "2017-04-26 07:48:12"
    },
    "letter": {
      "content": "Hello",
      "template_id": 1,
      "attachment_id": "e958d299-a5b6-42a0-b6cd-22cd835d7397"
    }
  },
  "product_detail": null,
  "product_details": null,
  "task": null,
  "extra_steps": [],
  "created_at": "2017-04-26 07:48:12",
  "updated_at": "2017-04-26 07:48:12"
}
Task

Parameters

  • complete_task UUID
    • Must be a valid UUID and an existing task.
  • task.start_at date
    • Y-m-d H:i:s format.
    • Must be after "now".
    • Required when task exists
  • task.end_at date
    • Y-m-d H:i:s format.
    • Must be after task.start_at
    • Required when task exists
  • task.type string - Task type
    • Must be either email, call, meeting or remind_me
    • Required when task exists
  • task.user_id integer - If the assigned user is not the logged in user.
  • task.next_activity_id UUID - If you want to suggest the next milestone, you can provide a milestone id.

Payload

{
  "activity_types": [
    "a203539b-f06c-442c-8ad0-f5a56f0615f6"
  ],
  "communication_channel": "call",
  "complete_task": "d13d15bb-2c4a-45cc-8d5a-c83aa2c548d4",
  "task": {
    "start_at": "2017-07-15 12:34:53",
    "end_at": "2017-07-15 13:33:33",
    "type": "meeting"
  },
  "user_id": 1
}

Response
Status code 201

{
  "id": "1338da82-d5b8-413d-8224-c63b236ae856",
  "activity_types": [
    {
      "id": "a203539b-f06c-442c-8ad0-f5a56f0615f6",
      "name": "Contract"
    }
  ],
  "communication_channel": "call",
  "note": null,
  "correspondence": {
    "email": null,
    "letter": null
  },
  "product_detail": null,
  "product_details": null,
  "task": {
    "id": "0ba37fc2-9ac4-4a7f-a890-b468c1e19956",
    "type": "meeting",
    "case": {
      "id": "fb8091cb-7a1c-3f51-b42e-949656b5d687",
      "case_number": 767
    },
    "activity_id": "1338da82-d5b8-413d-8224-c63b236ae856",
    "user": {
      "id": 1,
      "first_name": "Jane",
      "last_name": "Doe",
      "phone_number": "+4588888888",
      "job_title": "Sales Executive",
      "email": "demo@easir.com",
      "email_notifications": false,
      "profile_picture": "5.jpg",
      "user_type": {
        "name": "admin"
      },
      "company": {},
      "system_user": false,
      "created_at": "2014-01-01 12:45:56",
      "updated_at": "2017-04-25 09:04:36"
    },
    "next_activity": null,
    "status": "later",
    "start_at": "2017-07-15 12:34:53",
    "end_at": "2017-07-15 13:33:33",
    "completed_at": null,
    "created_at": "2017-04-26 08:16:25",
    "updated_at": "2017-04-26 08:16:25"
  },
  "extra_steps": [],
  "created_at": "2017-04-26 08:16:25",
  "updated_at": "2017-04-26 08:16:25"
}
Automated communications

Parameters

  • automated_communications.*.send_at date
    • Y-m-d H:i:s format.
    • Must be after "now".
    • Required
  • automated_communications.*.template_id integer
    • Must be of type email and exist.
  • automated_communications.*.subject string
    • Min 1 char.
    • Required
  • automated_communications.*.content string
    • Min 1 char.
    • Required
  • automated_communications.*.attachments array - List of file-ids.
    • Required

Payload

{
  "activity_types": [
    "a203539b-f06c-442c-8ad0-f5a56f0615f6"
  ],
  "communication_channel": "call",
  "complete_task": "d13d15bb-2c4a-45cc-8d5a-c83aa2c548d4",
  "automated_communications": [
    {
      "send_at": "2017-07-12 23:23:23",
      "subject": "HEJHEJHEJ",
      "content": "INDHOLDINDHOLDINDHOLD",
      "template_id": 2,
      "attachments": [
        "29aed944-3ea9-465d-a8ca-919e6775e2a5",
        "fc54f470-2eb3-44e5-947d-b3909013c583"
      ]
    }
  ],
  "user_id": 1
}

Response
Status code 201

{
  "id": "54eb9417-f4ed-4cab-83d0-81513a00b265",
  "activity_types": [
    {
      "id": "a203539b-f06c-442c-8ad0-f5a56f0615f6",
      "name": "Contract"
    }
  ],
  "communication_channel": "email",
  "note": null,
  "correspondence": {
    "email": null,
    "letter": null
  },
  "product_detail": null,
  "product_details": null,
  "task": null,
  "extra_steps": [],
  "created_at": "2017-04-26 08:19:43",
  "updated_at": "2017-04-26 08:19:43"
}
Product details

Parameters

  • product_details.products array - Is an array of objects with the following rules.
    • product_details.products.*.type string - The product type.
      • Can be pieces or hours.
      • Required
    • product_details.products.*.id string - If the product exists send the product id. You can overwrite the price etc, but we need the id for reports.
    • product_details.products.*.name string - Product name
      • Required
    • product_details.products.*.quantity integer - Product Quantity
      • Required
    • product_details.products.*.price integer/float - Product price.
      • Required
    • product_details.products.*.discount integer/float - Product discount.
    • product_details.products.*.comment string - Adds a comment for the line.

Payload

{
  "activity_types": [
    "a203539b-f06c-442c-8ad0-f5a56f0615f6"
  ],
  "communication_channel": "call",
  "product_details": {
    "products": [
      {
        "name": "Product name",
        "quantity": 10,
        "type": "pieces",
        "price": 10.95,
        "discount": 0,
        "comment": "SOME COMMENT"
      },
      {
        "id": "f066bc3e-347f-3768-a280-b24aab19318f",
        "name": "Adipiscing Elit Associates",
        "quantity": 1,
        "type": "pieces",
        "price": 235,
        "discount": 10
      }
    ]
  },
  "user_id": 1
}

Response
Status code 201

{
  "id": "cf070927-cd6b-4882-a44b-44d6b06dae3c",
  "activity_types": [
    {
      "id": "a203539b-f06c-442c-8ad0-f5a56f0615f6",
      "name": "Contract"
    }
  ],
  "communication_channel": "call",
  "note": null,
  "correspondence": {
    "email": null,
    "letter": null
  },
  "product_detail": {
    "id": "064b5e2c-2a1b-46f5-80d0-9ef654da00bd",
    "products": [
      {
        "id": null,
        "name": "Product name",
        "quantity": 10,
        "type": "pieces",
        "price": 10.95,
        "discount": 0,
        "comment": "SOME COMMENT"
      },
      {
        "id": "f066bc3e-347f-3768-a280-b24aab19318f",
        "name": "Adipiscing Elit Associates",
        "quantity": 1,
        "type": "pieces",
        "price": 235,
        "discount": 10,
        "comment": null
      }
    ],
    "created_at": "2017-04-26 08:23:27",
    "updated_at": "2017-04-26 08:23:27"
  },
  "product_details": {
    "id": "064b5e2c-2a1b-46f5-80d0-9ef654da00bd",
    "products": [
      {
        "id": null,
        "name": "Product name",
        "quantity": 10,
        "type": "pieces",
        "price": 10.95,
        "discount": 0,
        "comment": "SOME COMMENT"
      },
      {
        "id": "f066bc3e-347f-3768-a280-b24aab19318f",
        "name": "Adipiscing Elit Associates",
        "quantity": 1,
        "type": "pieces",
        "price": 235,
        "discount": 10,
        "comment": null
      }
    ],
    "created_at": "2017-04-26 08:23:27",
    "updated_at": "2017-04-26 08:23:27"
  },
  "task": null,
  "extra_steps": [],
  "created_at": "2017-04-26 08:23:27",
  "updated_at": "2017-04-26 08:23:27"
}

The product_detail field is deprecated and will be removed January 15th, 2019. The product_details field can be used instead.

You can use the correspondence.letter.file_id to retrieve the PDF (using the file manager download endpoint)

Suggest next milestone

GET /cases/:case_id/milestone-suggestions

Parameters

  • date date
    • Y-m-d H:i:s format.
    • Must be after "now".
    • Required
  • milestone_id UUID
    • Must be valid UUID from the same relations path as the case.
    • Required

If no suggestion is found, a 404 will be returned.

Response
Status code 200

An activity type object is returned.