###Endpoint:
POST /companies/:company_token/interactions
{ "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
.
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.
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" : [
]
}