/// <summary> /// create /// </summary> /// <param name="pathServiceSid"> The SID of the Service to create the resource under </param> /// <param name="pathChannelSid"> The SID of the Channel the new resource belongs to </param> /// <param name="type"> The type of webhook </param> /// <param name="configurationUrl"> The URL of the webhook to call </param> /// <param name="configurationMethod"> The HTTP method used to call `configuration.url` </param> /// <param name="configurationFilters"> The events that cause us to call the Channel Webhook </param> /// <param name="configurationTriggers"> A string that will cause us to call the webhook when it is found in a message /// body </param> /// <param name="configurationFlowSid"> The SID of the Studio Flow to call when an event occurs </param> /// <param name="configurationRetryCount"> The number of times to retry the webhook if the first attempt fails </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Webhook </returns> public static async System.Threading.Tasks.Task <WebhookResource> CreateAsync(string pathServiceSid, string pathChannelSid, WebhookResource.TypeEnum type, string configurationUrl = null, WebhookResource.MethodEnum configurationMethod = null, List <string> configurationFilters = null, List <string> configurationTriggers = null, string configurationFlowSid = null, int?configurationRetryCount = null, ITwilioRestClient client = null) { var options = new CreateWebhookOptions(pathServiceSid, pathChannelSid, type) { ConfigurationUrl = configurationUrl, ConfigurationMethod = configurationMethod, ConfigurationFilters = configurationFilters, ConfigurationTriggers = configurationTriggers, ConfigurationFlowSid = configurationFlowSid, ConfigurationRetryCount = configurationRetryCount }; return(await CreateAsync(options, client)); }
/// <summary> /// create /// </summary> /// <param name="options"> Create Webhook parameters </param> /// <param name="client"> Client to make requests to Twilio </param> /// <returns> Task that resolves to A single instance of Webhook </returns> public static async System.Threading.Tasks.Task <WebhookResource> CreateAsync(CreateWebhookOptions options, ITwilioRestClient client = null) { client = client ?? TwilioClient.GetRestClient(); var response = await client.RequestAsync(BuildCreateRequest(options, client)); return(FromJson(response.Content)); }