Tag

Tag

The tag verb adds properties to the standard call attributes that Zerpia includes on every action or call status HTTP POST request.

Note: Due to the possible richness of the data, only subsequent POST requests will include this data. It will not be included in HTTP GET requests.

The purpose is to simplify applications by eliminating the need to store state information if it can simply be echoed back to the application on each HTTP request for the call.

For example, consider an application that wants to apply some privacy settings on outdials based on attributes in the initial incoming call. The application could parse information from the SIP INVITE provided in the web callback when the call arrives. Rather than storing that information for later use, it could simply use the tag verb to associate that information with the call. Later, when an action or call status triggers the need for the application to outdial, it can simply access the information from the HTTP POST body, instead of having to retrieve it from some sort of cache.

Note that every time the tag verb is used, the collection of customer data is completely replaced with the new data provided. This information will be provided back in all action or status notifications if the POST method is used. It will appear in a property named customerData in the JSON payload.

{
  "verb": "tag",
  "data": {
    "foo": "bar",
    "counter": 100,
    "list": [1, 2, "three"]
  }
}

After the above tag verb has executed, web callbacks using POST would have a payload similar to this:

{
  "call_sid": "df09e8d4-7ffd-492b-94d9-51a60318552c",
  "direction": "inbound",
  "from": "+15083084809",
  "to": "+15083728299",
  "call_id": "f0414693-bdb6-1238-6185-06d91d68c9b0",
  "sip_status": 200,
  "call_status": "in-progress",
  "caller_id": "f0414693-bdb6-1238-6185-06d91d68c9b0",
  "account_sid": "fef61e75-cec3-496c-a7bc-8368e4d02a04",
  "application_sid": "0e0681b0-d49f-4fb8-b973-b5a3c6758de1",
  "originating_sip_ip": "54.172.60.1:5060",
  "originating_sip_trunk_name": "twilio",
  "customerData": {
    "foo": "bar",
    "counter": 100,
    "list": [1, 2, "three"]
  }
}
```

You can use the following attribute with the tag command:

Option Description Required
data A JSON object containing values to be saved and included in future action or call status notifications (HTTP POST only) for this call. Yes

Ready To Get Started?