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_19?auth_id=RkAJvlb0oL&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=RkAJvlb0oL
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/accounts/test-account,account_19?auth_id=RkAJvlb0oL&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: 4e8ec8a4-c996-4302-ad8e-11d0c5907d83
X-Runtime: 0.067697
Content-Length: 295

Body

{
  "status": 200,
  "data": {
    "accounts": [
      {
        "id": "RkAJvlb0oL",
        "subdomain": "account_19",
        "name": "Account 19",
        "phone": null,
        "created_at": "2019-01-30T12:07:38.911-08:00"
      },
      {
        "id": "3YnbgeJae2",
        "subdomain": "test-account",
        "name": "Test Account",
        "phone": null,
        "created_at": "2019-01-30T12:07:38.935-08: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=3YnbgeJae2&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=3YnbgeJae2
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/accounts?auth_id=3YnbgeJae2&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: 32688428-a8a3-4e10-bf37-16aee6fa6a7c
X-Runtime: 0.031091
Content-Length: 295

Body

{
  "status": 200,
  "data": {
    "accounts": [
      {
        "id": "1LxJDK9n26",
        "subdomain": "account_20",
        "name": "Account 20",
        "phone": null,
        "created_at": "2019-01-30T12:07:39.026-08:00"
      },
      {
        "id": "PDz9n29e3m",
        "subdomain": "test-account",
        "name": "Test Account",
        "phone": null,
        "created_at": "2019-01-30T12:07:39.044-08: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 ,street ,city ,state ,country ,zip ,priority ,opted_out, 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": "PxB9NV9YOy",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "message": "new test message",
  "media_url": "https://somesite.com/pretty.jpg",
  "via_tags": "tag1,tag2",
  "via_contact_ids": "0N6bwR8DML",
  "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":"PxB9NV9YOy","auth_secret":"YYYYYYYYYYYYYYYYYYYY","message":"new test message","media_url":"https://somesite.com/pretty.jpg","via_tags":"tag1,tag2","via_contact_ids":"0N6bwR8DML","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: 1f16ec5d-98b1-458a-960c-561f3d3ec52c
X-Runtime: 0.110266
Content-Length: 278

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "2jRbk681Pv",
      "message": "new test message",
      "media_url": "https://somesite.com/pretty.jpg",
      "status": "initialized",
      "contacts_count": 0,
      "user": {
        "email": "person_7@example.com",
        "id": "PxB9NV9YOy",
        "name": "Person 7"
      },
      "pending_contacts_count": null
    }
  }
}

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/wd6Jmz87m3,VePJlY8ar6?auth_id=enL8alJ7Nw&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=enL8alJ7Nw
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/broadcasts/wd6Jmz87m3,VePJlY8ar6?auth_id=enL8alJ7Nw&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: d081ffb9-7de3-4d58-b7be-6223b4ae73e6
X-Runtime: 0.066281
Content-Length: 337

Body

{
  "status": 200,
  "data": {
    "broadcasts": [
      {
        "id": "wd6Jmz87m3",
        "message": "1",
        "status": "initialized",
        "contacts_count": 1,
        "user": {
          "email": "person_6@example.com",
          "id": "enL8alJ7Nw",
          "name": "Person 6"
        }
      },
      {
        "id": "VePJlY8ar6",
        "message": "2",
        "status": "queued",
        "contacts_count": 0,
        "user": {
          "email": "person_6@example.com",
          "id": "enL8alJ7Nw",
          "name": "Person 6"
        }
      }
    ]
  }
}

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/BLP9Me9qYX/publish

Headers

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

Body

{
  "auth_id": "WAnJQmJy1v",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "schedule_for": 1548842856.437218,
  "asap": true
}

cURL

curl "https://www.avochato.com/v1/broadcasts/BLP9Me9qYX/publish" -d '{"auth_id":"WAnJQmJy1v","auth_secret":"YYYYYYYYYYYYYYYYYYYY","schedule_for":1548842856.437218,"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: 0de9f905-57e6-4eae-bd54-e7428e5f32f9
X-Runtime: 0.054570
Content-Length: 182

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "BLP9Me9qYX",
      "message": "7",
      "status": "queued",
      "contacts_count": 1,
      "user": {
        "email": "person_9@example.com",
        "id": "WAnJQmJy1v",
        "name": "Person 9"
      }
    }
  }
}

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, :street, :city, :state, :country, :zip, :priority, :opted_out], 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/enL8alJ7Nw

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/broadcasts/enL8alJ7Nw" -d '{"auth_id":"BLP9Me9qYX","auth_secret":"YYYYYYYYYYYYYYYYYYYY","message":"new test message","media_url":"https://somesite.com/pretty2.jpg","via_tags":"tag2,tag3","via_contact_ids":"qxk9EVJRKA","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: 104a766f-38f2-4dd2-b642-988f34a73218
X-Runtime: 0.088017
Content-Length: 276

Body

{
  "status": 200,
  "data": {
    "broadcast": {
      "id": "enL8alJ7Nw",
      "message": "new test message",
      "media_url": "https://somesite.com/pretty2.jpg",
      "status": "initialized",
      "contacts_count": 1,
      "user": {
        "email": "person_8@example.com",
        "id": "BLP9Me9qYX",
        "name": "Person 8"
      },
      "pending_contacts_count": 3
    }
  }
}

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": "1LxJDK9n26",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY"
}

cURL

curl "https://www.avochato.com/v1/calls" -d '{"auth_id":"1LxJDK9n26","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: 61bce060-9497-44c8-85d1-ed9a132a0f4c
X-Runtime: 0.058281
Content-Length: 324

Body

{
  "status": 200,
  "data": {
    "call_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InNjb3BlOmNsaWVudDpvdXRnb2luZz9hcHBTaWQ9bm90cmVhbCBzY29wZTpjbGllbnQ6aW5jb21pbmc_Y2xpZW50TmFtZT0zbzQ4T2c4ZUF2IiwiaXNzIjoidHdpbGlvX2FjY291bnRfc2lkIiwibmJmIjoxNTQ4ODc4ODU5LCJleHAiOjE1NDg5NjUyNTl9.HGa5bcX_PzyPlyliNcaoytwuLWS_smAK2VFqcIjstI4"
  }
}

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/enL8alJ7Nw,PxB9NV9YOy?auth_id=ezjJ7L85yZ&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=ezjJ7L85yZ
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/contacts/enL8alJ7Nw,PxB9NV9YOy?auth_id=ezjJ7L85yZ&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: 13e068ea-3004-4fdb-ae85-f596cc564cd5
X-Runtime: 0.023440
Content-Length: 434

Body

{
  "status": 200,
  "data": {
    "contacts": [
      {
        "id": "enL8alJ7Nw",
        "name": "Bob Mc Test",
        "phone": "+15551234567",
        "email": "bob@mctest.com",
        "city": "Los Angeles",
        "state": "CA",
        "zip": "99999",
        "company": "McTest Inc",
        "created_at": 1548878854.4040809
      },
      {
        "id": "PxB9NV9YOy",
        "name": "Other Contact",
        "phone": "+15551234568",
        "email": "bob@contact.com",
        "city": "San Francisco",
        "state": "CA",
        "zip": "88888",
        "company": "Contact Inc",
        "created_at": 1548878854.408746
      }
    ]
  },
  "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=VePJlY8ar6&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=name%3ABob+OR+%27San+Fran%27&created_at%5Bfrom%5D=1548878794.2249181&created_at%5Bto%5D=1548878914.2249868&page=1

Headers

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

Query Parameters

auth_id=VePJlY8ar6
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=name:Bob OR 'San Fran'
created_at%5Bfrom%5D=1548878794.2249181
created_at%5Bto%5D=1548878914.2249868
page=1

cURL

curl "https://www.avochato.com/v1/contacts?auth_id=VePJlY8ar6&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=name%3ABob+OR+%27San+Fran%27&created_at%5Bfrom%5D=1548878794.2249181&created_at%5Bto%5D=1548878914.2249868&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: c3f10d79-3508-4cb5-8756-89e6c0c917a4
X-Runtime: 0.039859
Content-Length: 433

Body

{
  "status": 200,
  "data": {
    "contacts": [
      {
        "id": "xDjJBRJoOe",
        "name": "Bob Mc Test",
        "phone": "+15551234567",
        "email": "bob@mctest.com",
        "city": "Los Angeles",
        "state": "CA",
        "zip": "99999",
        "company": "McTest Inc",
        "created_at": 1548878854.184614
      },
      {
        "id": "2jRbk681Pv",
        "name": "Other Contact",
        "phone": "+15551234568",
        "email": "bob@contact.com",
        "city": "San Francisco",
        "state": "CA",
        "zip": "88888",
        "company": "Contact Inc",
        "created_at": 1548878854.193384
      }
    ]
  },
  "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": "wd6Jmz87m3",
  "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":"wd6Jmz87m3","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: d33a23ac-e02e-42d1-b387-00e0bda6b281
X-Runtime: 0.500783
Content-Length: 263

Body

{
  "status": 200,
  "data": {
    "contact": {
      "id": "ezjJ7L85yZ",
      "name": "New Contact",
      "phone": "+14155553333",
      "email": "contact@example.com",
      "city": "SF",
      "state": "CA",
      "company": "Example Inc.",
      "created_at": 1548878853.8954082,
      "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/1LxJDK9n26/events

Headers

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

Body

{
  "auth_id": "qQR9178geK",
  "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/1LxJDK9n26/events" -d '{"auth_id":"qQR9178geK","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: 0b82553c-a388-45ef-b92b-7a4464cc6083
X-Runtime: 0.105083
Content-Length: 304

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "qQR9178geK",
      "account_id": "qQR9178geK",
      "ticket_id": "PxB9NV9YOy",
      "contact_id": "1LxJDK9n26",
      "type": "sale",
      "context": "Wanted a new watch ($99.99) with no warranty",
      "revenue": 99.99,
      "element_id": "VePJlY8ar6",
      "element_type": "CustomEvent",
      "sent_at": 1548878857.3707762
    }
  }
}

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": "0nMJLk9vZ2",
  "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":"0nMJLk9vZ2","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: 76b28252-0fd5-46e7-b5db-ff6d571e9032
X-Runtime: 0.232471
Content-Length: 317

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "0nMJLk9vZ2",
      "account_id": "0nMJLk9vZ2",
      "ticket_id": "2jRbk681Pv",
      "contact_id": "RkAJvlb0oL",
      "type": "sale",
      "context": "Bought an avocado ($2) and was interested in a subscription",
      "revenue": 2.0,
      "element_id": "wd6Jmz87m3",
      "element_type": "CustomEvent",
      "sent_at": 1548878856.8063092
    }
  }
}

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/BLP9Me9qYX/events

Headers

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

Body

{
  "auth_id": "0N6bwR8DML",
  "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/BLP9Me9qYX/events" -d '{"auth_id":"0N6bwR8DML","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: 7eedd050-1609-42b5-b5af-e93fb8bb7eca
X-Runtime: 0.084355
Content-Length: 306

Body

{
  "status": 200,
  "data": {
    "event": {
      "user_id": "0N6bwR8DML",
      "account_id": "0N6bwR8DML",
      "ticket_id": "BLP9Me9qYX",
      "contact_id": "PDz9n29e3m",
      "type": "sale",
      "context": "Wanted one hat ($10) and upsold warranty ($5.50)",
      "revenue": 15.5,
      "element_id": "ezjJ7L85yZ",
      "element_type": "CustomEvent",
      "sent_at": 1548878857.654586
    }
  }
}

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/enL8alJ7Nw/events?auth_id=KRg80abj0q&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=KRg80abj0q
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/tickets/enL8alJ7Nw/events?auth_id=KRg80abj0q&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: 91a3176e-7abe-4011-afba-af7a065ed553
X-Runtime: 0.052502
Content-Length: 1747

Body

{
  "status": 200,
  "data": {
    "events": [
      {
        "account_id": "KRg80abj0q",
        "ticket_id": "enL8alJ7Nw",
        "user_id": "KRg80abj0q",
        "status": "Closed",
        "element_id": "xDjJBRJoOe",
        "element_type": "StatusChange",
        "sent_at": 1548878857.1978822
      },
      {
        "account_id": "KRg80abj0q",
        "call_from": "+15551234567",
        "call_to": "+15558888888",
        "voicemail": null,
        "direction": "in",
        "call_status": "completed",
        "ended_at": null,
        "duration": 119,
        "segments": 2,
        "element_id": "xDjJBRJoOe",
        "element_type": "Call",
        "sent_at": 1548878857.192014
      },
      {
        "uuid": "e548d1e7-4137-4179-ba96-b079478da6e1",
        "account_id": "KRg80abj0q",
        "contact_id": "3YnbgeJae2",
        "ticket_id": "enL8alJ7Nw",
        "direction": "out",
        "status": "queued",
        "error_code": 0,
        "segments": 1,
        "message": "Sorry in a meeting but can call afterwards",
        "element_id": "xDjJBRJoOe",
        "element_type": "SmsMessage",
        "sent_at": 1548878857.185983
      },
      {
        "uuid": "e341d728-3f8a-44f5-9f02-523fc28f6279",
        "account_id": "KRg80abj0q",
        "contact_id": "3YnbgeJae2",
        "ticket_id": "enL8alJ7Nw",
        "direction": "out",
        "status": "queued",
        "error_code": 0,
        "segments": 1,
        "message": "Hey there Bob let me know when we can talk!",
        "element_id": "ezjJ7L85yZ",
        "element_type": "SmsMessage",
        "sent_at": 1548878857.1804469
      },
      {
        "account_id": "KRg80abj0q",
        "call_from": "+15558888888",
        "call_to": "+15551234567",
        "voicemail": null,
        "direction": "out",
        "call_status": "completed",
        "ended_at": null,
        "duration": 10,
        "segments": 1,
        "element_id": "ezjJ7L85yZ",
        "element_type": "Call",
        "sent_at": 1548878857.173882
      },
      {
        "account_id": "KRg80abj0q",
        "ticket_id": "enL8alJ7Nw",
        "user_id": "KRg80abj0q",
        "status": "Open",
        "element_id": "ezjJ7L85yZ",
        "element_type": "StatusChange",
        "sent_at": 1548878857.167148
      },
      {
        "account_id": "KRg80abj0q",
        "ticket_id": "enL8alJ7Nw",
        "user_id": "KRg80abj0q",
        "owner_id": "KRg80abj0q",
        "element_id": "VePJlY8ar6",
        "element_type": "OwnerChange",
        "sent_at": 1548878857.1473348
      }
    ]
  }
}

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=AwebYoJaEr&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction=in&status=delivered&created_at%5Bfrom%5D=1548878798.827393&created_at%5Bto%5D=1548878918.827455

Headers

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

Query Parameters

auth_id=AwebYoJaEr
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=hear
page=1
direction=in
status=delivered
created_at%5Bfrom%5D=1548878798.827393
created_at%5Bto%5D=1548878918.827455

cURL

curl "https://www.avochato.com/v1/messages?auth_id=AwebYoJaEr&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=hear&page=1&direction=in&status=delivered&created_at%5Bfrom%5D=1548878798.827393&created_at%5Bto%5D=1548878918.827455" -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: c95770d0-7de7-40ae-82a0-79ca7ca3e4d2
X-Runtime: 0.046421
Content-Length: 402

Body

{
  "status": 200,
  "data": {
    "messages": [
      {
        "uuid": "4b7315d1-2aa4-456d-94c2-65d1a05f815c",
        "account_id": "AwebYoJaEr",
        "contact_id": "z1N8x2937L",
        "ticket_id": "qQR9178geK",
        "sender": "+15551234567",
        "direction": "in",
        "status": "delivered",
        "error_code": 0,
        "segments": 1,
        "message": "I kept hearing that you had great service 😀!",
        "element_id": "0N6bwR8DML",
        "element_type": "SmsMessage",
        "sent_at": 1548878858.825367
      }
    ]
  },
  "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
from Phone number in the account to try to send from
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": "NEnJdQ8RmO",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+14155553333",
  "message": "test message",
  "from": "+15105551234",
  "tags": "Some Tag, Another Tag",
  "status_callback": "http://my.domain.com"
}

cURL

curl "https://www.avochato.com/v1/messages" -d '{"auth_id":"NEnJdQ8RmO","auth_secret":"YYYYYYYYYYYYYYYYYYYY","phone":"+14155553333","message":"test message","from":"+15105551234","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: 5a6fb32d-1e82-4fd0-9c1e-865575d7e697
X-Runtime: 0.162420
Content-Length: 438

Body

{
  "status": 200,
  "data": {
    "message": {
      "uuid": "864b1854-e0a1-4510-b35c-5782595b2f65",
      "account_id": "NEnJdQ8RmO",
      "contact_id": "v7Mb6NbERA",
      "ticket_id": "KRg80abj0q",
      "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": "KRg80abj0q",
      "element_type": "SmsMessage",
      "sent_at": 1548878858.484388
    }
  }
}

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/Pe6bez9Xwy,3OLb4Y94Ym/tags

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/contacts/Pe6bez9Xwy,3OLb4Y94Ym/tags" -d '{"auth_id":"3o48Og8eAv","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: 5e24a8a2-8f44-4a55-8445-404ac2a54993
X-Runtime: 0.047438
Content-Length: 94

Body

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

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": "PDz9n29e3m",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+15551234567",
  "tag": "my-new-tag"
}

cURL

curl "https://www.avochato.com/v1/tags" -d '{"auth_id":"PDz9n29e3m","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: 72549098-6c0a-470b-b8fa-8e16662df0c2
X-Runtime: 0.100941
Content-Length: 81

Body

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

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/EZA9P5Jrwg,mQL9W79Wqz/tags

Headers

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

Body

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

cURL

curl "https://www.avochato.com/v1/contacts/EZA9P5Jrwg,mQL9W79Wqz/tags" -d '{"auth_id":"YOobKd97E4","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: 06e0a21a-3cca-4bb5-ba5e-14bd84415d00
X-Runtime: 0.056581
Content-Length: 96

Body

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

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": "v7Mb6NbERA",
  "auth_secret": "YYYYYYYYYYYYYYYYYYYY",
  "phone": "+15551234567",
  "tag": "my-old-tag"
}

cURL

curl "https://www.avochato.com/v1/tags" -d '{"auth_id":"v7Mb6NbERA","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: a673d75d-326e-47ac-b65d-c0078b3d7b29
X-Runtime: 0.054675
Content-Length: 83

Body

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

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/VePJlY8ar6,wd6Jmz87m3?auth_id=xDjJBRJoOe&auth_secret=YYYYYYYYYYYYYYYYYYYY&page=1

Headers

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

Query Parameters

auth_id=xDjJBRJoOe
auth_secret=YYYYYYYYYYYYYYYYYYYY
page=1

cURL

curl "https://www.avochato.com/v1/tickets/VePJlY8ar6,wd6Jmz87m3?auth_id=xDjJBRJoOe&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: ebb4e53d-59a6-4f0a-8280-83a106ad7a7c
X-Runtime: 0.058979
Content-Length: 362

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "uuid": "8699cb73-399a-43f3-b3cd-992476f73dfb",
        "contact": "WAnJQmJy1v",
        "user_id": "xDjJBRJoOe",
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1548878854.693644
      },
      {
        "uuid": "c850c6ea-db45-42fd-88d2-0a7ca81e3e11",
        "contact": "BLP9Me9qYX",
        "user_id": null,
        "status": "Pending",
        "origin": "Avochato",
        "created_at": 1548878854.6848252
      }
    ]
  },
  "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=2jRbk681Pv&auth_secret=YYYYYYYYYYYYYYYYYYYY&query=status%3AOpen&page=1

Headers

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

Query Parameters

auth_id=2jRbk681Pv
auth_secret=YYYYYYYYYYYYYYYYYYYY
query=status:Open
page=1

cURL

curl "https://www.avochato.com/v1/tickets?auth_id=2jRbk681Pv&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: 02b55e85-eed6-45cd-b487-7d8c7ed45218
X-Runtime: 0.025337
Content-Length: 205

Body

{
  "status": 200,
  "data": {
    "tickets": [
      {
        "uuid": "c8acce49-c16a-4de8-a178-4230bba5a68d",
        "contact": "KRg80abj0q",
        "user_id": "2jRbk681Pv",
        "status": "Open",
        "origin": "Avochato",
        "created_at": 1548878855.128639
      }
    ]
  },
  "page": 1
}