twilio/twilio-csharp

ServiceResource - add Status property (related to error - Unprocessable Entity)

JakubHolovsky opened this issue · 2 comments

Issue Summary

When calling

await UsAppToPersonResource.CreateAsync(
                        brandRegistrationSid: brandRegistration.Sid,
                        description: input.MessageCampaignUseCase,
                        messageSamples: messageSamples,
                        usAppToPersonUsecase: "STARTER",
                        hasEmbeddedLinks: true,
                        hasEmbeddedPhone: true,
                        pathMessagingServiceSid: service.Sid,
                        client: twilioRestClient
                    );

we are getting:

Unprocessable Entity in the call to create an A2P Campaign for messaging service MGfb753ea7d7587e0a34586376c61a13b4: Can't create campaign

Can you add a status property on MessageResource with "Status" so we can check the status before submitting it to UsAppToPersonResource.CreateAsync otherwise I haven't found any other way how to check for the validity of the messaging service before we pass it on.

Steps to Reproduce

  1. Create a messaging service right before doing a UsAppToPersonResource.CreateAsync call
  2. Observe that it fails on Unprocessable Entity in the call to create an A2P Campaign for messaging service MGfb753ea7d7587e0a34586376c61a13b4: Can't create campaign

Code Snippet

await UsAppToPersonResource.CreateAsync(
                        brandRegistrationSid: brandRegistration.Sid,
                        description: input.MessageCampaignUseCase,
                        messageSamples: messageSamples,
                        usAppToPersonUsecase: "STARTER",
                        hasEmbeddedLinks: true,
                        hasEmbeddedPhone: true,
                        pathMessagingServiceSid: service.Sid,
                        client: twilioRestClient
                    );

Exception/Log

 Unprocessable Entity in the call to create an A2P Campaign for messaging service MGfb753ea7d7587e0a34586376c61a13b4: Can't create campaign

Technical details:

  • twilio-csharp version: 5.62.5
  • csharp version: 9

The MessageResource is auto generated based on the api definition. Is the issue that the particular service does not exist? How do you define validity here?

Closing due to inactivity. Please open a new github issues if you need any additional help.