Solved

Events payloads for rules

  • 15 December 2022
  • 1 reply
  • 45 views

Badge +2

What are the differences in events payloads for “move” events between rules and manual user actions?

icon

Best answer by Javier - Developer Relations 15 December 2022, 21:11

View original

1 reply

Userlevel 5
Badge +8

To give you a quick overview of events you receive at webhooks, they will have the following top-level attributes:

 

  • _links - Metadata object containing API URLs to fetch some related resources
  • id - The ID of "this" event
  • type - The type of event
  • emitted_at - Unix timestamp showing the time this event was generated (Example value: 1670345808.944)
  • conversation - Information about the conversation this event occurred on
  • source - The resource responsible for this event. This might be a teammate, rule, company or the API. 
  • target - Details of this event. For example, for a Move event, we show the inbox the conversation was moved to. For a Message event, we show the sent/received message. For a Tag event, we show the tag details, etc. 

 

So while events all have the same top-level payload structure, the objects contained within the source and target objects will differ for every type of event, and may differ depending on what/who triggered the event. 

 

In the case of a move performed by a human, the "source" object will look like this, showing us which teammate was responsible for performing the move:

{  

  "source": {

    "_meta": {

      "type": "teammate"

    },

  "data": {    

    "id": "tea_...",

    "first_name": ...

    ...

  }

}

 

In the case of a rule performing the move, the event source will show details of the rule that performed the move;

{  

  "source": {

    "_meta": {

      "type": "rule"

    },

  "data": {    

    "id": "rul_...",

    "name": "RVM DNC",

    ...

  }

}

 

I hope this part helps clarify the difference between the payloads you might receive. 

 

--Jason

Reply