webhooks for mapping customer orgenization field to customer ticket field

7 Kommentare

  • Ahmed Zaid
    User Group Leader Community Moderator

    Hi Abhishek Govani,

    If you are not using drop down custom fields, then the .title method in the placeholder is not applicable.

    In case you are indeed using drop down custom fields, you do now need to use the API. Simply use the same option tags for both the organization and ticket custom fields. It doesn't matter if the value strings are different as long as they are mapped using identical tags.

    Thus, any ticket created by any user in the organization will include the option tag of the organization custom field value, which will automatically populate the ticket custom field value.

    I hope that solves your problem.

    0
  • Abhishek Govani

    Hello Ahmed Zaid,

    Appreciate your response. I will certainly check it out. I also have one complex requirement

    The organization has multiple custom fields such as 300001(numerical), 300002(numerical), 300003(numerical). 

    The customer filed present on the Agent workspace is only one. Based on the customer field "location" the customer will select the respective organization field that should be populate in the customer field. 

     

    For example,

    Organization 1 has these three fields. PROD[300001(numerical)]=123456789, UAT[300002(numerical)]=987654321, and Sandbox[300003(numerical)]=5647889123. 

    The customer field on the agent dashboard is accountID[456123457(numerical))

    Location(dropdown): PROD, UAT, Sandbox

    if customers select prod in location, accountID[456123457(numerical))= 123456789 should be shown on the ticket. 

     

    I hope this make sense. Please let me know if you need more information. 

     

    Thank you,

    Abhishek Govani

    0
  • Ahmed Zaid
    User Group Leader Community Moderator

    Hi Abhishek Govani,

    I thought about nested placeholder where the custom field key is another placeholder of the value of another field. e.g.

    {{ticket.organization.custom_fields.{{ticket.ticket_field_option_title_123456789}}}}

    Unfortunately, it could not be parsed when I tested it (Maybe Zendesk can tell us if it there is a workaround for nested placeholders).

    I guess you will have to create 3 different triggers based on each possible value of the location and request the corresponding organization field value.

    For example,

    Trigger when ticket is updated and location is "prod". Call ticket end point with:

    {
      "ticket": {
        "custom_fields": [
            {
              "id": 456123457,
              "value": {{ticket.organization.custom_fields.300001}}
            }
            ]
        }
    }

    and so on for UAT and Sandbox.

    Hope that helps. Best of luck!

    0
  • Abhishek Govani

    Hello Ahmed Zaid,

    Thank you for the update. I suspected that it will require me to create three different triggers(better than creating it for all the organizations) but the JSON is not working as expected for me. Looks like the API call is taking {{ticket.organization.custom_fields.300001}} as a value and not as a placeholder thus giving me 422 error(because the "id": 456123457 fields is configured to be numeric and the value passed contains characters). If you can help me get the below JSON to work, I am ok with creating multiple triggers. 

    {
      "ticket": {
        "custom_fields": [
            {
              "id": 456123457,
              "value": {{ticket.organization.custom_fields.300001}}
            }
            ]
        }
    }

    Thank you,

    Abhishek Govani

    0
  • Ahmed Zaid
    User Group Leader Community Moderator

    @Abhishek Govani

    The liquid placeholder cannot be parsed from the webhook testing function in admin center. It will give you 422 error. You need to test it on an actual ticket where the trigger will parse the placeholder before sending the payload with the correct numerical value. 
    0
  • Abhishek Govani

    Hello Ahmed Zaid,

    Thank you for your quick response. I am using postman to make these calls. Below is the cURL I am using. 

    The customer field ID is 6008820290459, the Organization customer field name is "copilotid" and the id is 6008825162139. Both customer fields are numeric.

    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic YWJoaXNoZWtnb3ZhbmkyN0BnbWFpbC5jb206QWJoaXZpc2gwMjE3QA==' \
    --header 'Cookie: __cfruid=cb748e0da69b71d25e223aee772a50b58aa84272-1652810031; _zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--459ed01949a36415c1716b5711271c3d08918307' \
    --data-raw '{
      "ticket": {
        "custom_fields": [
                {
                    "id": 6008820290459,
                    "value": "{{ticket.organization.custom_fields.copilotid}}"
                    }
                    ]
                    }
    }'
     
    Below is the image that shows the response as well as the API call that I made from the postman.
     
     
    Organization custom field
     
    ticket custom field 
     
    Test organization
     
     
    Ticket
     
    Thank you,
    Abhishek Govani
     
    0
  • Ahmed Zaid
    User Group Leader Community Moderator

    Abhishek Govani That will not work. The API server does not parse the placeholder. Create a trigger with the json body and remove the quotation marks from the placeholder. The webhook will receive the numeric value instead of the placeholder, send the correct payload and it will succeed.

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.

Powered by Zendesk