The activity API allows you and your agents to record activities from an external application or system in Freshdesk's contact timeline. Pushing information from your applications about a user can provide rich contextual information to your support agents using Freshdesk. Activities published using this API would show up on the contact timeline giving your agents a complete view of the customer’s journey.
Example:
John tried to place an order on your site and faced an issue because the payment gateway timed out and their transaction failed even though money was deducted from their account. John has now raised a ticket asking for a refund. For your agents looking at a ticket from John, the first thing they would ask for is the transaction details such as the time of the order, the items added to the cart and the transaction ID for easily tracing the failed order.
With the activity API, you can start sending this information to Freshdesk so that your agents needn’t ask for such information thereby reducing the number of interactions with your customers. You can provide an awesome support experience by reducing friction and customer frustration.
For the above use case the API can be used as follows:
Request URL: https://domain.freshdesk.com/api/v2/contact-activities
Request Method: POST
Example request body:
{ "activity": { "name": "Transaction failed", "timestamp": "2020-10-01T14:00:00Z", "description": "Transaction for Order ID on 1 Oct, 2019", "actor": { "id": "918mI2k1", "name": "Rachel", "type": "contact" }, "source": { "name": "shopify", "id": "7819e8k1119" }, "object": { "type": "transaction", "id": "1234", "link": "https://myorderstatus.orders.com/84637930" }, "context":{ "name": "Rachel", "Items" : 2, "Item description" : { "item1" : { "Item name": "Gucci White Ace Sneakers", "Size" : "10 UK", "Color" : "White", "Instock" : "Yes" }, "item2" : { "Item name": "Gucci Round Sleeve T-Shirt", "Size" : "40 UK", "Color" : "Blue", "Instock" : "Yes" } }, "Amount" : "50", "Currency" : "Dollars", "Postal code" : "12401", "Order id": "84637930", "Transaction link" : "myorderstatus.orders.com/84637930" } }, "contact": { "email": "rachel@freshdesk.com" } }
Response :
You would receive a 200 response in case of a success
Response codes:
200: Accepted
400: Bad Request Error
403: Access denied
Once the agent sees the ticket and views the customer information, they can see that the transaction failed at 2:07 PM. There is also a user-friendly description of the activity. I.e in this case “Transaction for Order ID XXXX failed”. Clicking on this activity will allow the agent to view further details about the transaction such as the number of items John has tried to order, the amount, the currency, a link to the order and any other details you choose to send.
This is how the activity looks like in the timeline:
Check our complete API documentation here.