So we're busy with an ABP project and struggling to specify the http parameter to map to the app service parameter. Mailgun's Webhook uses "Message-Id" as the http parameter and we are struggling to access that from an app service.
Here is our app service:
public async Task MailDelivered(int timestamp, string token, string signature, string MessageId)
{
var isValid = IsMailGunSignatureValid(timestamp, token, signature);
if (isValid)
{
Console.WriteLine($"Message id: {MessageId}");
var entity = await communicationEventRepository.FirstOrDefaultAsync(entry => entry.MessageId == $"{MessageId}");
if (entity != null)
{
var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
entity.DeliveredTime = unixEpoch.AddSeconds(timestamp);
await communicationEventRepository.UpdateAsync(entity);
}
else
{
throw new UserFriendlyException("Invalid message-id.");
}
}
else
{
throw new UserFriendlyException("Invalid signature.");
}
}
However, we get a blank string back for MessageId. We cannot name the function parameter Message-Id due to C# naming rules. We also cannot get data from the POST body as JSON, as Mailgun only supports x-www-form-urlencoded for it's webhook calls. Any ideas?