Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: incorrect parameter serialization in ContentCreateRequest #815

Open
jeslopcru opened this issue Oct 22, 2024 · 0 comments
Open

Bug: incorrect parameter serialization in ContentCreateRequest #815

jeslopcru opened this issue Oct 22, 2024 · 0 comments

Comments

@jeslopcru
Copy link

Issue Summary

It is not possible to create a Template with friendly name using PHP library version 8.3.4

Steps to Reproduce

  1. Create a template using PHP library
                $sid = getenv("TWILIO_ACCOUNT_SID");
                $token = getenv("TWILIO_AUTH_TOKEN");
                $twilio = new Client($sid, $token);

                $twilio->content->v1->contents->create(
                    ContentModels::createContentCreateRequest(
                        [
                            'friendlyName' => 'my_template_friendly_name,
                            'language' => 'en',
                            'types' => [
                                'twilio/text' => [
                                    'body' => 'this is a example body,
                                ],
                            ],
                        ],
                    ),
  1. When checking the template in Content Template Builder then friendly_name not provided appears as a name

Technical details:

  • twilio-php version: 8.3.4
  • php version: 8.3

Hints

I think that the problem is in ContentCreateRequest file because the serialization is with camelCase instead snake_case

problem

public function jsonSerialize(): array
    {
        return [
            'friendlyName' => $this->friendlyName,
            'variables' => $this->variables,
            'language' => $this->language,
            'types' => $this->types
        ];
    }

solution

public function jsonSerialize(): array
    {
        return [
            'friendly_name' => $this->friendlyName,
            'variables' => $this->variables,
            'language' => $this->language,
            'types' => $this->types
        ];
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant