RJPearson94 / terraform-provider-twilio

Terraform Twilio provider
https://registry.terraform.io/providers/RJPearson94/twilio/latest/docs
Mozilla Public License 2.0
32 stars 7 forks source link

Add Twilio Pay connectors via Terraform #89

Closed exussum12 closed 11 months ago

exussum12 commented 11 months ago

Is your feature request related to a problem

No a nice to have

Describe the solution you'd like

Ideally we would be able to set up the pay connections in twilio via terraform, so they could be versioned

https://www.twilio.com/docs/voice/twiml/pay/pay-connectors#install-pay-connectors

RJPearson94 commented 11 months ago

Hi @exussum12,

Thanks for the feature request and for using the provider.

Are you able to provide a little more context around what you are looking to be added to the provider, is it the ability to setup a pay connector or modify an existing one or get the details of a pay connector?

I have previously setup pay using stripe and the linking of the twilio account to stripe could only be done via the console. So just trying to understand a little bit more about your use case.

I’m not aware of an that can be used to configure this (unless it falls under the addon apis) when I know more about your use case I can investigate whether this can be done by the public APIs

Kind Regards Rob

exussum12 commented 11 months ago

Hi Rob

Thanks for the provider. Ideally want the account to be fully set up by running terraform on a new account so all of the account settings are documented.

I have looked in the API's that I can see and can not find the creation of Pay connectors, so this would not be possible. Closing this for now

Thanks again

RJPearson94 commented 11 months ago

Hi @exussum12,

I was having a quick look at this, and Twilio does have a preview API for Marketplace Addons, this includes 3rd party integrations such as Pay Connectors, Virtual Agents, etc.

The API docs can be found at https://github.com/twilio/twilio-oai/blob/b6a05f4078e85203b9a24495cb86b330293deb99/spec/yaml/twilio_preview.yaml#L4543

Unfortunately, I can't currently add support for this, as it looks like Twilio generates and saves credentials as part of the setup (as seen by the credentialSid in the example JSON below).

{
    "unique_name": "Stripe_Connector",
    "description": "Accept payments over the phone, web, and in person with Stripe",
    "date_updated": "2023-11-17T19:14:08Z",
    "friendly_name": "Stripe Connector",
    "account_sid": "ACxxxxxxxxxxxxxxxxxx",
    "url": "https://preview.twilio.com/marketplace/InstalledAddOns/XEa8ef3cd0b292b722379a8d766e31f962",
    "sid": "XEa8ef3cd0b292b722379a8d766e31f962",
    "date_created": "2023-11-17T19:13:34Z",
    "configuration": {
        "connect_account_id": "acct_xxxxxxxxxxxxx",
        "credentialSid": "CRxxxxxxxxxxxxx",
        "mode": "test"
    },
    "links": {
        "extensions": "https://preview.twilio.com/marketplace/InstalledAddOns/XEa8ef3cd0b292b722379a8d766e31f962/Extensions",
        "available_add_on": "https://preview.twilio.com/marketplace/AvailableAddOns/XB304ed87c2c2b2b87c93fa7d31a6ac883"
    }
}

API Request GET https://preview.twilio.com/marketplace/InstalledAddOns/XEa8ef3cd0b292b722379a8d766e31f962

I am currently unable to find a way to generate these credentials. So I would only be able to allow the add on to be partially configured. I don't know if you have anyone you can ask at Twilio to see if there is a way to do this. Otherwise, you will have to configure the connectors via the console

Kind Regards Rob