Avochato API


Welcome!

If anything isn’t working as documented, please message Avochato Support @ 415-214-8977.

Accounts

Fetch Accounts

Using your auth id + secret you can fetch Accounts by subdomains

Endpoint

GET /v1/accounts/:ids

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Comma separated list of Account subdomains to fetch
page Page to request

Request

Route

GET /v1/accounts/test-account,account_24?auth_id=qxk9E509RK&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=qxk9E509RK
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/accounts/test-account,account_24?auth_id=qxk9E509RK&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 674677bd-3b60-4084-ad9d-dce377ee7427
X-Runtime: 0.072218
Content-Length: 295

Body

{
  "status": 200,
  "data": {
    "accounts": [
      {
        "id": "nL8aAAp87N",
        "subdomain": "account_24",
        "name": "Account 24",
        "phone": null,
        "created_at": "2018-09-17T10:19:53.617-07:00"
      },
      {
        "id": "xB9NQQWbYO",
        "subdomain": "test-account",
        "name": "Test Account",
        "phone": null,
        "created_at": "2018-09-17T10:19:53.639-07:00"
      }
    ]
  },
  "page": 1
}

List Accounts

Using your auth id + secret you can list all your Accounts

Endpoint

GET /v1/accounts

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
page Page to request

Request

Route

GET /v1/accounts?auth_id=kvnJAjM8AD&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=kvnJAjM8AD
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/accounts?auth_id=kvnJAjM8AD&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: fda8a2e0-77b2-4061-8f0c-5071d98f7f03
X-Runtime: 0.032173
Content-Length: 295

Body

{
  "status": 200,
  "data": {
    "accounts": [
      {
        "id": "LP9Mzz0JqY",
        "subdomain": "account_25",
        "name": "Account 25",
        "phone": null,
        "created_at": "2018-09-17T10:19:54.119-07:00"
      },
      {
        "id": "AnJQLLw9y1",
        "subdomain": "test-account",
        "name": "Test Account",
        "phone": null,
        "created_at": "2018-09-17T10:19:54.136-07:00"
      }
    ]
  },
  "page": 1
}

Broadcasts

Create Broadcast

Using your auth id + secret you can setup a broadcast

Endpoint

POST /v1/broadcasts

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
message required Text to send in Broadcasts
media_url Url of media to send in MMS (500kb limit)
via_tags Comma-separated list of contact tags to add to broadcast
via_contact_ids Comma-separated list of contact ids to add to broadcast
via_phone_numbers Comma-separated list of phone_numbers to add to broadcast
via_field[field] String, either name ,phone ,phone_formatted ,email ,company ,city ,state ,country ,zip ,priority, OR Custom Variable name
via_field[value] String, match all contacts with a given field which matches this value exactly

Request

Route

POST /v1/broadcasts

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "VePJlLDJar",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "message": "new test message",
  "media_url": "https://somesite.com/pretty.jpg",
  "via_tags": "tag1,tag2",
  "via_contact_ids": "EG8jdm29Ql",
  "via_phone_numbers": "5105551234,4155551234",
  "via_field[field]": "email",
  "via_field[value]": "bob@mctest.com"
}

cURL

curl "https://www.avochato.com/v1/broadcasts" -d '{"auth_id":"VePJlLDJar","auth_secret":"YYYYYYYYYYYYYYYYYYYY","message":"new test message","media_url":"https://somesite.com/pretty.jpg","via_tags":"tag1,tag2","via_contact_ids":"EG8jdm29Ql","via_phone_numbers":"5105551234,4155551234","via_field[field]":"email","via_field[value]":"bob@mctest.com"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 2c801586-a3fd-44a3-ad92-ebaf0e162e68
X-Runtime: 0.203691
Content-Length: 248

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "wEG8j6e8Ql",
      "message": "new test message",
      "media_url": "https://somesite.com/pretty.jpg",
      "status": "initialized",
      "contacts_count": 0,
      "user": {
        "email": "person_5@example.com",
        "id": "o48Ov6VJeA",
        "name": "Person 5"
      }
    }
  }
}

Fetch Broadcasts

Using your auth id + secret you can fetch broadcasts based on their ids

Endpoint

GET /v1/broadcasts/:ids

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Comma separated list of Contact ids to fetch
page Page number to request

Request

Route

GET /v1/broadcasts/PweboEWJXm,GeAbZLyJDM?auth_id=wd6Jm0r97m&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=wd6Jm0r97m
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/broadcasts/PweboEWJXm,GeAbZLyJDM?auth_id=wd6Jm0r97m&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 5e6c1998-e2c8-469f-b626-53a16d59babd
X-Runtime: 0.157546
Content-Length: 337

Body

{
  "status": 200,
  "data": {
    "broadcasts": [
      {
        "id": "PweboEWJXm",
        "message": "1",
        "status": "initialized",
        "contacts_count": 1,
        "user": {
          "email": "person_4@example.com",
          "id": "Dz9nV5E9e3",
          "name": "Person 4"
        }
      },
      {
        "id": "GeAbZLyJDM",
        "message": "2",
        "status": "queued",
        "contacts_count": 0,
        "user": {
          "email": "person_4@example.com",
          "id": "Dz9nV5E9e3",
          "name": "Person 4"
        }
      }
    ]
  }
}

Publish Broadcast

Using your auth id + secret you can publish your broadcast

Endpoint

POST /v1/broadcasts/:id/publish

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
schedule_for Unix timestamp, Ensure delivery at this time
asap Boolean, Ignore schedule_for and schedule ASAP

Request

Route

POST /v1/broadcasts/xlYJpz0bmw/publish

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "ezjJ73lJ5y",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "schedule_for": 1537168785.2275798,
  "asap": true
}

cURL

curl "https://www.avochato.com/v1/broadcasts/xlYJpz0bmw/publish" -d '{"auth_id":"ezjJ73lJ5y","auth_secret":"YYYYYYYYYYYYYYYYYYYY","schedule_for":1537168785.2275798,"asap":true}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 4991430a-e732-4087-8ff5-a7c9b149b595
X-Runtime: 0.150340
Content-Length: 182

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "xlYJpz0bmw",
      "message": "5",
      "status": "queued",
      "contacts_count": 1,
      "user": {
        "email": "person_6@example.com",
        "id": "OobKa63J7E",
        "name": "Person 6"
      }
    }
  }
}

Update Broadcast

Using your auth id + secret you can add more contacts or update your broadcast

Endpoint

POST /v1/broadcasts/:id

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
message Text to send in Broadcasts
media_url Url of media to send in MMS (500kb limit)
via_tags Comma-separated list of contact tags to add to broadcast
via_contact_ids Comma-separated list of contact ids to add to broadcast
via_phone_numbers Comma-separated list of phone_numbers to add to broadcast
via_field[field] String, [:name, :phone, :phone_formatted, :email, :company, :city, :state, :country, :zip, :priority], OR Custom Variable name
via_field[value] String, match all contacts with a given field which matches this value exactly

Request

Route

POST /v1/broadcasts/ZMvbXkK8Rm

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "xDjJB2VJoO",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "message": "new test message",
  "media_url": "https://somesite.com/pretty2.jpg",
  "via_tags": "tag2,tag3",
  "via_contact_ids": "d6JmGzzb7m",
  "via_phone_numbers": "+15105551234,+14155551234",
  "via_field[field]": "email",
  "via_field[value]": "bob@mctest.com"
}

cURL

curl "https://www.avochato.com/v1/broadcasts/ZMvbXkK8Rm" -d '{"auth_id":"xDjJB2VJoO","auth_secret":"YYYYYYYYYYYYYYYYYYYY","message":"new test message","media_url":"https://somesite.com/pretty2.jpg","via_tags":"tag2,tag3","via_contact_ids":"d6JmGzzb7m","via_phone_numbers":"+15105551234,+14155551234","via_field[field]":"email","via_field[value]":"bob@mctest.com"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 7802aa77-94e8-46eb-83e6-d10c44d783bc
X-Runtime: 0.222164
Content-Length: 249

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "ZMvbXkK8Rm",
      "message": "new test message",
      "media_url": "https://somesite.com/pretty2.jpg",
      "status": "initialized",
      "contacts_count": 1,
      "user": {
        "email": "person_7@example.com",
        "id": "7Mb6WAn9ER",
        "name": "Person 7"
      }
    }
  }
}

CallTokens

Create Call Token

Using your auth id + secret you can create a token to make a call

Endpoint

POST /v1/calls

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field

Request

Route

POST /v1/calls

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "k5V9VyYblr",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY"
}

cURL

curl "https://www.avochato.com/v1/calls" -d '{"auth_id":"k5V9VyYblr","auth_secret":"YYYYYYYYYYYYYYYYYYYY"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 64ce9878-b014-47f0-b339-677150399075
X-Runtime: 0.058235
Content-Length: 324

Body

{
  "status": 200,
  "data": {
    "call_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InNjb3BlOmNsaWVudDpvdXRnb2luZz9hcHBTaWQ9bm90cmVhbCBzY29wZTpjbGllbnQ6aW5jb21pbmc_Y2xpZW50TmFtZT1qUmJrUlI1ODFQIiwiaXNzIjoidHdpbGlvX2FjY291bnRfc2lkIiwibmJmIjoxNTM3MjA0NzkzLCJleHAiOjE1MzcyOTExOTN9.YC3bbeh3dIKL9S0Lj3rf7-RBKYfiUwTcnMlesHuMemo"
  }
}

Contacts

Fetch Contacts

Using your auth id + secret you can fetch Contacts by ids

Endpoint

GET /v1/contacts/:ids

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Comma separated list of Contact ids to fetch
page Page to request

Request

Route

GET /v1/contacts/ZA9P0q59rw,QL9WeA78Wq?auth_id=xlYJprzbmw&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=xlYJprzbmw
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/contacts/ZA9P0q59rw,QL9WeA78Wq?auth_id=xlYJprzbmw&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 03d91fe3-319c-4c36-bde8-8955b95290d2
X-Runtime: 0.064577
Content-Length: 435

Body

{
  "status": 200,
  "data": {
    "contacts": [
      {
        "id": "ZA9P0q59rw",
        "name": "Bob Mc Test",
        "phone": "+15551234567",
        "email": "bob@mctest.com",
        "city": "Los Angeles",
        "state": "CA",
        "zip": "99999",
        "company": "McTest Inc",
        "created_at": 1537204781.5798342
      },
      {
        "id": "QL9WeA78Wq",
        "name": "Other Contact",
        "phone": "+15551234568",
        "email": "bob@contact.com",
        "city": "San Francisco",
        "state": "CA",
        "zip": "88888",
        "company": "Contact Inc",
        "created_at": 1537204781.5858681
      }
    ]
  },
  "page": 1
}

Search Contacts

Using your auth id + secret you can search for matching Contacts based on a query

Endpoint

GET /v1/contacts

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
query String to search Contacts with (default: iterate through all Contacts)
created_at[from] Select Contacts created after this unixtime
created_at[to] Select Contacts created before this unixtime (default: now)
page Page to request

Request

Route

GET /v1/contacts?auth_id=v5D9R2w9VA&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=name%3ABob+OR+%27San+Fran%27&created_at%5Bfrom%5D=1537204722.3227892&created_at%5Bto%5D=1537204842.322877&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=v5D9R2w9VA
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=name:Bob OR 'San Fran'
created_at%5Bfrom%5D=1537204722.3227892
created_at%5Bto%5D=1537204842.322877
page=1

cURL

curl "https://www.avochato.com/v1/contacts?auth_id=v5D9R2w9VA&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=name%3ABob+OR+%27San+Fran%27&created_at%5Bfrom%5D=1537204722.3227892&created_at%5Bto%5D=1537204842.322877&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 5ebc96a2-caaa-41c3-98ac-d96d14a05506
X-Runtime: 0.061374
Content-Length: 435

Body

{
  "status": 200,
  "data": {
    "contacts": [
      {
        "id": "Egb5pMr8ej",
        "name": "Bob Mc Test",
        "phone": "+15551234567",
        "email": "bob@mctest.com",
        "city": "Los Angeles",
        "state": "CA",
        "zip": "99999",
        "company": "McTest Inc",
        "created_at": 1537204782.1976151
      },
      {
        "id": "PG9yQZg9aO",
        "name": "Other Contact",
        "phone": "+15551234568",
        "email": "bob@contact.com",
        "city": "San Francisco",
        "state": "CA",
        "zip": "88888",
        "company": "Contact Inc",
        "created_at": 1537204782.2027562
      }
    ]
  },
  "page": 1
}

Update Contact

Using your auth id + secret you can create or update a Contact based on their phone number

Endpoint

POST /v1/contacts

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
phone required Phone number of Contact
name Name of the Contact
email Email for the Contact
other_phone Other phone for the Contact
company Company for the Contact
city City for the Contact
state State for the Contact
zip Zip Code for the Contact
country Country for the Contact
custom_variable_name Custom variable to set for the Contact
tags CSV of tags to apply to the Contact

Request

Route

POST /v1/contacts

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "ZMvbXxdbRm",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+14155553333",
  "email": "contact@example.com",
  "company": "Example Inc.",
  "city": "SF",
  "state": "CA",
  "country": "USA",
  "custom_variable_name": "value to set custom variable"
}

cURL

curl "https://www.avochato.com/v1/contacts" -d '{"auth_id":"ZMvbXxdbRm","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+14155553333","email":"contact@example.com","company":"Example Inc.","city":"SF","state":"CA","country":"USA","custom_variable_name":"value to set custom variable"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 3457b850-5fed-4c1b-8f84-1257aa9afdd4
X-Runtime: 0.170787
Content-Length: 262

Body

{
  "status": 200,
  "data": {
    "contact": {
      "id": "oWbqGDYJqn",
      "name": "New Contact",
      "phone": "+14155553333",
      "email": "contact@example.com",
      "city": "SF",
      "state": "CA",
      "company": "Example Inc.",
      "created_at": 1537204782.994157,
      "custom_variable_name": "value to set custom variable"
    }
  }
}

Events

Add Event (Contact id)

Using your auth id + secret you can append an Event directly into a Conversation stream based on the Contact id

Endpoint

POST /v1/contacts/:id/events

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
id required (URL) Contact id to add an event to
type required Type of event to log: click, sale, etc.
context Context to save regarding the event
revenue Value created for your team from this event

Request

Route

POST /v1/contacts/Rg803KaJj0/events

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "KRg80eebj0",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "type": "sale",
  "context": "Wanted a new watch ($99.99) with no warranty",
  "revenue": 99.99
}

cURL

curl "https://www.avochato.com/v1/contacts/Rg803KaJj0/events" -d '{"auth_id":"KRg80eebj0","auth_secret":"YYYYYYYYYYYYYYYYYYYY","type":"sale","context":"Wanted a new watch ($99.99) with no warranty","revenue":99.99}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 8d7a0137-c742-463d-96f4-08885f170710
X-Runtime: 0.166649
Content-Length: 303

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "ZA9PlOx9rw",
      "account_id": "d6Jmzze87m",
      "ticket_id": "zjJ76W095y",
      "contact_id": "Rg803KaJj0",
      "type": "sale",
      "context": "Wanted a new watch ($99.99) with no warranty",
      "revenue": 99.99,
      "element_id": "3Ynbgne8ae",
      "element_type": "CustomEvent",
      "sent_at": 1537204790.942878
    }
  }
}

Add Event (Phone)

Using your auth id + secret you can append an Event directly into a Conversation stream based on the phone number

Endpoint

POST /v1/events

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
phone required Phone number of the Contact
type required Type of event to log: click, sale, etc.
context Context to save regarding the event
revenue Value created for your team from this event

Request

Route

POST /v1/events

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "BLP9M2NJqY",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+15551234567",
  "type": "sale",
  "context": "Bought an avocado ($2) and was interested in a subscription",
  "revenue": 2.0
}

cURL

curl "https://www.avochato.com/v1/events" -d '{"auth_id":"BLP9M2NJqY","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+15551234567","type":"sale","context":"Bought an avocado ($2) and was interested in a subscription","revenue":2.0}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: e62e289b-4b3f-4c3b-979c-8406140b2219
X-Runtime: 0.405269
Content-Length: 316

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "K2b2xeqJWR",
      "account_id": "nMJLyyW8vZ",
      "ticket_id": "MvbX07jbRm",
      "contact_id": "LP9MWze8qY",
      "type": "sale",
      "context": "Bought an avocado ($2) and was interested in a subscription",
      "revenue": 2.0,
      "element_id": "AwebYqobaE",
      "element_type": "CustomEvent",
      "sent_at": 1537204788.907848
    }
  }
}

Add Event (Ticket id)

Using your auth id + secret you can append an Event directly into a Conversation stream based on the Ticket id

Endpoint

POST /v1/tickets/:id/events

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
id required (URL) Ticket id to add event to
type required Type of event to log: click, sale, etc.
context Context to save regarding the event
revenue Value created for your team from this event

Request

Route

POST /v1/tickets/ePJl7YN9ar/events

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "0nMJL2WbvZ",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "type": "sale",
  "context": "Wanted one hat ($10) and upsold warranty ($5.50)",
  "revenue": 15.5
}

cURL

curl "https://www.avochato.com/v1/tickets/ePJl7YN9ar/events" -d '{"auth_id":"0nMJL2WbvZ","auth_secret":"YYYYYYYYYYYYYYYYYYYY","type":"sale","context":"Wanted one hat ($10) and upsold warranty ($5.50)","revenue":15.5}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: cc4f5703-f00a-4f8f-8f15-bccee9dc187d
X-Runtime: 0.172936
Content-Length: 306

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "OLb4We284Y",
      "account_id": "MvbX00jbRm",
      "ticket_id": "ePJl7YN9ar",
      "contact_id": "nMJLoyk9vZ",
      "type": "sale",
      "context": "Wanted one hat ($10) and upsold warranty ($5.50)",
      "revenue": 15.5,
      "element_id": "RkAJvDlb0o",
      "element_type": "CustomEvent",
      "sent_at": 1537204790.289412
    }
  }
}

Fetch Events

Using your auth id + secret you can fetch Events in a Ticket based on Ticket ids

Endpoint

GET /v1/tickets/:ids/events

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Ticket ids to fetch the event stream
page Page to request

Request

Route

GET /v1/tickets/d6Jmzxe87m/events?auth_id=WAnJQDa9y1&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=WAnJQDa9y1
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/tickets/d6Jmzxe87m/events?auth_id=WAnJQDa9y1&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 7a0976a5-4ef1-4dfc-882d-60c57b39de94
X-Runtime: 0.052974
Content-Length: 1798

Body

{
  "status": 200,
  "data": {
    "events": [
      {
        "account_id": "Rg80KKeJj0",
        "ticket_id": "d6Jmzxe87m",
        "user_id": "e6bea7EbXw",
        "status": "Closed",
        "element_id": "43y83OD8VN",
        "element_type": "StatusChange",
        "sent_at": 1537204789.725899
      },
      {
        "account_id": "Rg80KKeJj0",
        "call_from": "+15551234567",
        "call_to": "+15558888888",
        "voicemail": null,
        "direction": "in",
        "call_status": "completed",
        "ended_at": null,
        "duration": 119,
        "segments": 2,
        "element_id": "PweboGWbXm",
        "element_type": "Call",
        "sent_at": 1537204789.720269
      },
      {
        "uuid": "6b2912c3-4340-47db-aee8-a59c38e3439c",
        "account_id": "Rg80KKeJj0",
        "contact_id": "AnJQ2Lm8y1",
        "ticket_id": "d6Jmzxe87m",
        "sender": "Bob McTest",
        "direction": "out",
        "status": "queued",
        "error_code": 0,
        "segments": 1,
        "message": "Sorry in a meeting but can call afterwards",
        "element_id": "QL9WLB7JWq",
        "element_type": "SmsMessage",
        "sent_at": 1537204789.7144341
      },
      {
        "uuid": "bbe25f56-4bf7-4226-925e-a46abd5fef2d",
        "account_id": "Rg80KKeJj0",
        "contact_id": "AnJQ2Lm8y1",
        "ticket_id": "d6Jmzxe87m",
        "sender": "user@avochato.com",
        "direction": "out",
        "status": "queued",
        "error_code": 0,
        "segments": 1,
        "message": "Hey there Bob let me know when we can talk!",
        "element_id": "ZA9Pl759rw",
        "element_type": "SmsMessage",
        "sent_at": 1537204789.708191
      },
      {
        "account_id": "Rg80KKeJj0",
        "call_from": "+15558888888",
        "call_to": "+15551234567",
        "voicemail": null,
        "direction": "out",
        "call_status": "completed",
        "ended_at": null,
        "duration": 10,
        "segments": 1,
        "element_id": "zPG9yNWJaO",
        "element_type": "Call",
        "sent_at": 1537204789.6986508
      },
      {
        "account_id": "Rg80KKeJj0",
        "ticket_id": "d6Jmzxe87m",
        "user_id": "e6bea7EbXw",
        "status": "Open",
        "element_id": "xoWbqGWJqn",
        "element_type": "StatusChange",
        "sent_at": 1537204789.6918652
      },
      {
        "account_id": "Rg80KKeJj0",
        "ticket_id": "d6Jmzxe87m",
        "user_id": "e6bea7EbXw",
        "owner_id": "e6bea7EbXw",
        "element_id": "2jRbkdV91P",
        "element_type": "OwnerChange",
        "sent_at": 1537204789.684858
      }
    ]
  }
}

Messages

Search Messages

Using your auth id + secret you can search for matching Messages based on a query

Endpoint

GET /v1/messages

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
query String to search Messages for (default: iterate through all messages)
page Page to request
direction String, Direction of the message ("in" for received messages, "out" for sent messages)
status String, Message delivery status (queued, delivered, undelivered, failed)
created_at[from] Unix timestamp, Select contacts created after this date
created_at[to] Unix timestamp, Select contacts created before this date (default: now)

Request

Route

GET /v1/messages?auth_id=PwebowabXm&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction=in&status=delivered&created_at%5Bfrom%5D=1537204718.47101&created_at%5Bto%5D=1537204838.471082

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=PwebowabXm
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=hear
page=1
direction=in
status=delivered
created_at%5Bfrom%5D=1537204718.47101
created_at%5Bto%5D=1537204838.471082

cURL

curl "https://www.avochato.com/v1/messages?auth_id=PwebowabXm&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction=in&status=delivered&created_at%5Bfrom%5D=1537204718.47101&created_at%5Bto%5D=1537204838.471082" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: fe374b7b-444d-46e8-8ce8-492435f76c00
X-Runtime: 0.037647
Content-Length: 402

Body

{
  "status": 200,
  "data": {
    "messages": [
      {
        "uuid": "49f6cdeb-e7a6-4c14-80e7-724ef5a134c4",
        "account_id": "oWbqppM8qn",
        "contact_id": "Dz9nGY2Je3",
        "ticket_id": "eAbZvnYbDM",
        "sender": "+15551234567",
        "direction": "in",
        "status": "delivered",
        "error_code": 0,
        "segments": 1,
        "message": "I kept hearing that you had great service 😀!",
        "element_id": "K2b2x3vJWR",
        "element_type": "SmsMessage",
        "sent_at": 1537204778.468778
      }
    ]
  },
  "page": 1
}

Send Message

Using your auth id + secret you can send a Message to any Contact based on their phone

Endpoint

POST /v1/messages

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
phone required Phone number to send
message required Text to send in SMS
media_url Url of media to send in MMS (500kb limit)
tags Comma-separated list of tags to apply to this contact
status_callback Domain to send callback http POST requests when the status is updated
tags CSV of tags to apply

Request

Route

POST /v1/messages

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "zPG9yjZJaO",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+14155553333",
  "message": "test message",
  "tags": "Some Tag, Another Tag",
  "status_callback": "http://my.domain.com"
}

cURL

curl "https://www.avochato.com/v1/messages" -d '{"auth_id":"zPG9yjZJaO","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+14155553333","message":"test message","tags":"Some Tag, Another Tag","status_callback":"http://my.domain.com"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 9a36b96d-b4c4-4e86-ad78-cb78c4b0b282
X-Runtime: 0.740327
Content-Length: 439

Body

{
  "status": 200,
  "data": {
    "message": {
      "uuid": "cc747e59-0546-442a-bf1a-9421779a3dc2",
      "account_id": "eAbZvvnbDM",
      "contact_id": "LxJDnQKbn2",
      "ticket_id": "weboamyJXm",
      "sender": "Test User",
      "direction": "out",
      "status": "queued",
      "error_code": 0,
      "segments": 1,
      "carrier": "twilio",
      "message": "test message",
      "content_type": "text/plain",
      "status_callback": "http://my.domain.com",
      "element_id": "Dr8GnokJPl",
      "element_type": "SmsMessage",
      "sent_at": 1537204777.6796129
    }
  }
}

Tags

Add Tag (Contact id)

Using your auth id + secret you can add a new tag to Contacts

Endpoint

POST /v1/contacts/:ids/tags

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Comma separated list of Contact ids to tag
tag required Tag to add to Contacts

Request

Route

POST /v1/contacts/1N8xOL2J37,Dr8GDMkbPl/tags

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "xoWbqVM9qn",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "tag": "my-new-tag"
}

cURL

curl "https://www.avochato.com/v1/contacts/1N8xOL2J37,Dr8GDMkbPl/tags" -d '{"auth_id":"xoWbqVM9qn","auth_secret":"YYYYYYYYYYYYYYYYYYYY","tag":"my-new-tag"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 21f16b78-5c73-4193-912c-e0de8830c70c
X-Runtime: 0.112486
Content-Length: 94

Body

{
  "status": 200,
  "data": {
    "action": "tagged",
    "tag": "my-new-tag",
    "ids": [
      "1N8xOL2J37",
      "Dr8GDMkbPl"
    ]
  }
}

Add Tag (Phone)

Using your auth id + secret you can add a new tag to a Contact based on phone number

Endpoint

POST /v1/tags

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
phone required Phone number of the Contact
tag required Tag to add to Contacts

Request

Route

POST /v1/tags

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "GeAbZznbDM",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+15551234567",
  "tag": "my-new-tag"
}

cURL

curl "https://www.avochato.com/v1/tags" -d '{"auth_id":"GeAbZznbDM","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+15551234567","tag":"my-new-tag"}' -X POST \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 088dca72-2cca-4af7-8079-9659f041249f
X-Runtime: 0.215686
Content-Length: 81

Body

{
  "status": 200,
  "data": {
    "action": "tagged",
    "tag": "my-new-tag",
    "ids": [
      "OobKyndJ7E"
    ]
  }
}

Remove Tag (Contact id)

Using your auth id + secret you can remove an old tag from Contacts

Endpoint

DELETE /v1/contacts/:ids/tags

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Comma separated list of Contact ids to untag
tag required Tag to remove from Contacts

Request

Route

DELETE /v1/contacts/e6bernz9Xw,OLb42qYJ4Y/tags

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "wEG8jM0JQl",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "tag": "my-old-tag"
}

cURL

curl "https://www.avochato.com/v1/contacts/e6bernz9Xw,OLb42qYJ4Y/tags" -d '{"auth_id":"wEG8jM0JQl","auth_secret":"YYYYYYYYYYYYYYYYYYYY","tag":"my-old-tag"}' -X DELETE \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 42f9bdaa-cdc8-40dc-b30a-298711db4878
X-Runtime: 0.122095
Content-Length: 96

Body

{
  "status": 200,
  "data": {
    "action": "untagged",
    "tag": "my-old-tag",
    "ids": [
      "e6bernz9Xw",
      "OLb42qYJ4Y"
    ]
  }
}

Remove Tag (Phone)

Using your auth id + secret you can remove an old tag from a Contact based on phone number

Endpoint

DELETE /v1/tags

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
phone required Phone number of the Contact
tag required Tag to remove from Contacts

Request

Route

DELETE /v1/tags

Headers

Content-Type: application/json
Host: www.avochato.com

Body

{
  "auth_id": "43y83eO9VN",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+15551234567",
  "tag": "my-old-tag"
}

cURL

curl "https://www.avochato.com/v1/tags" -d '{"auth_id":"43y83eO9VN","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+15551234567","tag":"my-old-tag"}' -X DELETE \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: e079a80d-3355-49fd-b3b3-077a6c180c6f
X-Runtime: 0.119309
Content-Length: 83

Body

{
  "status": 200,
  "data": {
    "action": "untagged",
    "tag": "my-old-tag",
    "ids": [
      "DR8zy14JA2"
    ]
  }
}

Tickets

Fetch Tickets

Using your auth id + secret you can fetch Tickets by ids

Endpoint

GET /v1/tickets/:ids

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
ids required (URL) Comma separated list of Ticket ids
page Page to request

Request

Route

GET /v1/tickets/3y832WGJVN,EG8jAnrJQl?auth_id=enL8aRxb7N&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=enL8aRxb7N
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/tickets/3y832WGJVN,EG8jAnrJQl?auth_id=enL8aRxb7N&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 12f80209-c244-4b1f-a720-407a9c0f5381
X-Runtime: 0.083281
Content-Length: 361

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "uuid": "ba9d1973-cbdc-4a26-ae6b-91b1fadf80d1",
        "contact": "jRbkGR6b1P",
        "user_id": "Dr8GneMJPl",
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1537204787.185601
      },
      {
        "uuid": "3cfcc929-060b-40e7-b63c-5ed62aaeabf3",
        "contact": "DjJBRnRJoO",
        "user_id": null,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1537204787.176008
      }
    ]
  },
  "page": 1
}

Search Tickets

Using your auth id + secret you can search for matching Tickets based on a query

Endpoint

GET /v1/tickets

Parameters

Name Description
auth_id required Auth Id field
auth_secret required Authentication Secret field
query String to search Tickets with (default: iterate through all tickets)
page Page to request

Request

Route

GET /v1/tickets?auth_id=PxB9N2Y9YO&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=status%3AOpen&page=1

Headers

Content-Type: application/json
Host: www.avochato.com

Query Parameters

auth_id=PxB9N2Y9YO
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=status:Open
page=1

cURL

curl "https://www.avochato.com/v1/tickets?auth_id=PxB9N2Y9YO&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=status%3AOpen&page=1" -X GET \
	-H "Content-Type: application/json" \
	-H "Host: www.avochato.com"

Response

Simulated Response

Status

200

Headers

Content-Type: application/json; charset=utf-8
X-Request-Id: 71f51112-ab70-4228-8351-4c0269314c9f
X-Runtime: 0.076197
Content-Length: 205

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "uuid": "05426b25-76f4-4800-82a7-23614cd455ea",
        "contact": "xB9NqQVbYO",
        "user_id": "DR8zMjMJA2",
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1537204787.989352
      }
    ]
  },
  "page": 1
}