Skip to content

Instantly share code, notes, and snippets.

@KevinDJones
Created October 25, 2018 05:19
Show Gist options
  • Save KevinDJones/c4bdcab8ababedfbb66666aa20f74508 to your computer and use it in GitHub Desktop.
Save KevinDJones/c4bdcab8ababedfbb66666aa20f74508 to your computer and use it in GitHub Desktop.
[FunctionName("A_SendTwilioText")]
public static async Task SendTwilioText(
[ActivityTrigger] MessageInput input,
[TwilioSms] IAsyncCollector<CreateMessageOptions> message,
ILogger log)
{
log.LogWarning($"Twilio Activity. Sending message");
CreateMessageOptions smsText = new CreateMessageOptions(new PhoneNumber(input.Phone))
{
From = new PhoneNumber(Environment.GetEnvironmentVariable("TwilioNumber")),
Body = input.Message,
StatusCallback = new Uri(Environment.GetEnvironmentVariable("Host") + "/api/TwilioHandler/" + input.SmsKey)
};
await message.AddAsync(smsText);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment