twilio / twilio-node

Node.js helper library
MIT License
1.37k stars 495 forks source link

ServiceInstance#usecase throws when providing known values during Messaging ServiceInstance creation #937

Open TwinkieLover opened 1 year ago

TwinkieLover commented 1 year ago

Environment:

There are 2 issues at play here.

  1. I am trying to create a new ServiceInstance for SMS following the Twilio Node client example here. This is the code fragment under review:
const res = await this._client.messaging.v1.services.create({
friendlyName: "someFriendlyName",
usecase: "marketing",
stickySender: true,
fallbackToLongCode: true
});

The "marketing" usecase value works. Removal of attribute usecase works. None of the other usecase values found in Twilio documentation work, i.e. "customer care", "2fa", "mixed", etc. Here is the thrown exception:

Usecase is invalid

122 |     const res = await this._client.messaging.v1.services.create(options);
    |                 ^

The specific lines (303 - 306) can be found in the type definition file at twilio/lib/rest/messaging/v1/service.d.ts.

  1. There is no Messaging ServiceInstance usecase GET covered in the API docs showing all supported values, although there is an affordance for US A2P Campaign usecase values here. Is this a disconnect or I was not able to discover the API doc? If so, please provide it.

Thank you!