Skip to content

Instantly share code, notes, and snippets.

@atomkirk
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atomkirk/9813245 to your computer and use it in GitHub Desktop.
Save atomkirk/9813245 to your computer and use it in GitHub Desktop.

###Endpoint:

POST /companies/:company_token/interactions

JSON:

{ "interaction":
  {
    "channel": "chat",
    "body": "blah",
    "username": "scj2kaskwub"
  }
}

username can be blank if the channel is chat, but if it is a new customer is created and the return payload will contain a randomly generated username token. All subsequent chats that should be associated with that customer should have that token as the username.

Headers

If it has an Authorization: Token token="…" header, you'll want to forward that to the rails app. That is how the rails app will know if it is outgoing or incoming.

Response

The response JSON will contain all the fields of the above example plus many more (typical Interaction#json format) and without the parent wrapper. e.g.:

{
	"body" : "Maxime placeat corporis. Sint aut ullam. Fuga odit debitis dolor est aut. Explicabo nisi accusantium veniam iure. Iure odit ipsum voluptatem necessitatibus assumenda.",
	"channel" : "twitter",
	"created_at" : "2014-03-27T22:48:09Z",
	"id" : 3,
	"outgoing" : true,
	"received_at" : "2014-03-27T22:48:09Z",
	"resolved" : true,
	"response_draft" : null,
	"token" : "04643d546049",
	"private_url" : "http://localhost:4006/04643d546049",
	"customer_account" : {
		"created_at" : "2014-03-27T22:48:09Z",
		"followers_count" : 0,
		"following_us" : false,
		"id" : 3,
		"image_url" : null,
		"username" : "mtrou_test_1"
	},
	"twitter_interaction" : {
		"favorited" : false,
		"from_user_id" : "1161720218",
		"in_reply_to_screen_name" : null,
		"in_reply_to_status_id" : null,
		"retweet_count" : 0,
		"to_user_id" : null,
		"tweet_id" : "449316976649728000",
		"tweet_source" : "Firehose Help Desk",
		"twitter_account" : {
			"id" : 2,
			"image_url" : "http://a3.twimg.com/profile_images/1258392332/pants2_normal.png",
			"screen_name" : "firehoseapptest",
			"twitter_user_id" : "1161720218"
		}
	},
	"response_interactions" : [
		
	],
	"notes" : [
		
	],
	"tags" : [
		
	],
	"flagged_agents" : [
		
	]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment