Recent searches


No recent searches

Tatsuya Ogasawara's Avatar

Tatsuya Ogasawara

Joined Feb 03, 2022

·

Last activity Nov 13, 2024

Following

0

Followers

0

Total activity

2

Votes

0

Subscription

1

ACTIVITY OVERVIEW

Latest activity by Tatsuya Ogasawara

Tatsuya Ogasawara created a post,

Post Developer - Zendesk Apps Framework (ZAF)

I am a developer working on a Zendesk app that we provide to our customers. In this post, I would like to ask about an issue occurring in one of our customer's environments.

We have a function that creates a user based on a given phone number and returns the user ID. Here is an example of the function:

export const createNewUser = async (phoneNumber: string) => {
  const data: ZendeskApiUserCreate = {
    user: {
      name: phoneNumber,
      phone: phoneNumber,
      verified: true,
    },
  };
  const options: ZendeskApiOptions = {
    url: "/api/v2/users.json",
    type: "POST",
    contentType: "application/json",
    data: JSON.stringify(data),
  };

  const response = await client.request(options);

  return response?.user?.id;
};

When passing a string like 0901234567 to the phoneNumber parameter of this createNewUser function, it works fine in most Zendesk instances. However, in a specific customer's instance, we encounter the following error:

{
    “readyState”: 4,
    “responseJSON”: {
        “error”: “RecordInvalid”,
        “description”: “Record validation errors”,
        “details”: {
            “phone”: [
                {
                    “description”: “Phone 09012345678のフォーマットを確認してください。正しい国際電話番号E.164は、国番号、通常は地域番号、および契約者番号から構成されます。例: +1 (555) 123-4567。“,
                    “error”: “InvalidFormat”
                }
            ]
        }
    },
    “responseText”: “{\“error\“:\“RecordInvalid\“,\“description\“:\“Record validation errors\“,\“details\“:{\“phone\“:[{\“description\“:\“Phone 09012345678のフォーマットを確認してください。正しい国際電話番号E.164は、国番号、通常は地域番号、および契約者番号から構成されます。例: +1 (555) 123-4567。\“,\“error\“:\“InvalidFormat\“}]}}“,
    “status”: 422,
    “statusText”: “error”
}

Interestingly, in my development instance (d3v environment), I was able to create a user even when using a phone number string like "!-'~'()$%&_=^|[]{};:,<>@" without encountering any errors.

Is this problem caused by a difference in some specific configuration of the customer's instance? Or could there be another possible reason for this behavior?

Any insights would be greatly appreciated. Thank you in advance for your help.

Edited Nov 13, 2024 · Tatsuya Ogasawara

0

Followers

2

Votes

1

Comment