Link Search Menu Expand Document

Updated Thu Sep 23rd 2021, 14:49 UTC

Create a new Group with Contacts

POST /:account/groups

Note: This endpoint is still under active development, and may change without warning.

A Group is a static list of known contacts to send repeat Campaigns. To create a Group a name is required to be sent in the body of the request. However, if you want to create a list of contacts within your Group, then you could send an optional array of contact paths with their ids in the body. The response of this endpoint is a representation of the newly created Group. To keep our payloads small, each representation is a condensed version of a normal Group that is focused on relevant information.

Examples

Creating a group with contact IDs

Request

POST /my_account/groups

Body

{
"contacts": ["/contacts/qBB9gaG"], "name": "Test Group"
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X POST /my_account/groups
     -d '{json: "body"}' 

Response

Status

201

Response Type

Group

Example
{
  "@type": "Group",
  "@context": "/contexts/Group.jsonld",
  "id": "/groups/6LR9Yj",
  "name": "Test Group",
  "slug": "6LR9Yj",
  "createdAt": "2020-05-21T20:07:20.862Z",
  "account": "/accounts/my_account",
  "user": "/users/kY16Lm",
  "contacts": {
    "@type": "hydra:Collection",
    "@context": "/contexts/hydra:Collection.jsonld",
    "id": "/groups/nMjkXZ/contacts",
    "totalItems": 1,
    "members": [
      {
        "id": "/contacts/Vled2N",
        "@type": "Contact",
        "@context": "/contexts/Contact.jsonld",
        "name": "Jamel Hirthe",
        "firstName": "Jamel",
        "lastName": "Hirthe",
        "phones": {
          "id": "/contacts/Vled2N/phones",
          "@type": "hydra:Collection",
          "@context": "/contexts/hydra:Collection.jsonld",
          "totalItems": 1,
          "members": [
            {
              "@type": "ContactPhone",
              "id": "/contact_phones/mxvbRw",
              "@context": "/contexts/ContactPhone.jsonld",
              "phoneNumber": "+13035551234",
              "formattedPhoneNumber": "(303) 555-1234",
              "extension": null,
              "type": "Mobile",
              "deliverabilityStatus": "unknown",
              "contact": "/contacts/DQeeO69"
            }
          ]
        },
        "notes": {
          "@type": "hydra:Collection",
          "id": "/contacts/DQeeO69/notes",
          "@context": "/contexts/hydra:Collection.jsonld",
          "totalItems": 0,
          "members": [
            {
              "@type": "ContactNote",
              "id": "/contact_notes/RN5QNG",
              "@context": "/contexts/ContactNote.jsonld",
              "content": "Life is a fragile thing, Har. One minute you're chewin' on a burger, the next minute you're dead meat.",
              "createdAt": "2018-10-31T16:17:10.914Z",
              "updatedAt": "2018-10-31T16:17:10.914Z",
              "user": {
                "@type": "User",
                "@context": "/contexts/User.jsonld",
                "id": "/users/wqyODPA",
                "name": "Chuck Norris",
                "firstName": "Chuck",
                "lastName": "Norris",
                "email": "chuck@textus.example",
                "avatar": null,
                "automatedActor": false,
                "hasPassword": false,
                "discarded": false,
                "settings": {
                  "notifications": {
                    "email": true
                  },
                  "customSettings": {}
                },
                "memberships": "/users/wqyODPA/memberships"
              },
              "contact": "/contacts/DQeeO69"
            }
          ]
        },
        "conversations": "/contacts/DQeeO69/conversations",
        "data": {},
        "createdAt": "2020-01-06T21:49:58.312Z"
      }
    ]
  }
}

Creating a Group with contact collection ID

Request

POST /my_account/groups

Body

{
"name": "Test Group",
"contacts": "/my_account/contact_filters/all/contacts"
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X POST /my_account/groups
     -d '{json: "body"}' 

Response

Status

201

Response Type

Group

Example
{
  "@type": "Group",
  "@context": "/contexts/Group.jsonld",
  "id": "/groups/6LR9Yj",
  "name": "Test Group",
  "slug": "6LR9Yj",
  "createdAt": "2020-05-21T20:07:20.862Z",
  "account": "/accounts/my_account",
  "user": "/users/kY16Lm",
  "contacts": {
    "@type": "hydra:Collection",
    "@context": "/contexts/hydra:Collection.jsonld",
    "id": "/groups/nMjkXZ/contacts",
    "totalItems": 1,
    "members": [
      {
        "id": "/contacts/Vled2N",
        "@type": "Contact",
        "@context": "/contexts/Contact.jsonld",
        "name": "Jamel Hirthe",
        "firstName": "Jamel",
        "lastName": "Hirthe",
        "phones": {
          "id": "/contacts/Vled2N/phones",
          "@type": "hydra:Collection",
          "@context": "/contexts/hydra:Collection.jsonld",
          "totalItems": 1,
          "members": [
            {
              "@type": "ContactPhone",
              "id": "/contact_phones/mxvbRw",
              "@context": "/contexts/ContactPhone.jsonld",
              "phoneNumber": "+13035551234",
              "formattedPhoneNumber": "(303) 555-1234",
              "extension": null,
              "type": "Mobile",
              "deliverabilityStatus": "unknown",
              "contact": "/contacts/DQeeO69"
            }
          ]
        },
        "notes": {
          "@type": "hydra:Collection",
          "id": "/contacts/DQeeO69/notes",
          "@context": "/contexts/hydra:Collection.jsonld",
          "totalItems": 0,
          "members": [
            {
              "@type": "ContactNote",
              "id": "/contact_notes/RN5QNG",
              "@context": "/contexts/ContactNote.jsonld",
              "content": "Life is a fragile thing, Har. One minute you're chewin' on a burger, the next minute you're dead meat.",
              "createdAt": "2018-10-31T16:17:10.914Z",
              "updatedAt": "2018-10-31T16:17:10.914Z",
              "user": {
                "@type": "User",
                "@context": "/contexts/User.jsonld",
                "id": "/users/wqyODPA",
                "name": "Chuck Norris",
                "firstName": "Chuck",
                "lastName": "Norris",
                "email": "chuck@textus.example",
                "avatar": null,
                "automatedActor": false,
                "hasPassword": false,
                "discarded": false,
                "settings": {
                  "notifications": {
                    "email": true
                  },
                  "customSettings": {}
                },
                "memberships": "/users/wqyODPA/memberships"
              },
              "contact": "/contacts/DQeeO69"
            }
          ]
        },
        "conversations": "/contacts/DQeeO69/conversations",
        "data": {},
        "createdAt": "2020-01-06T21:49:58.312Z"
      }
    ]
  }
}

© 2021 TextUs