Skip to content

Commit

Permalink
Adding SMS, MMS and WhatsApp messages
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-lethargic committed Apr 29, 2022
1 parent 93829cc commit 7befd35
Show file tree
Hide file tree
Showing 60 changed files with 1,213 additions and 89 deletions.
8 changes: 4 additions & 4 deletions Vonage.Test.Unit/ApplicationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void CreateApplication(bool passCreds)
var messagesWebhooks = new Dictionary<Common.Webhook.Type, Common.Webhook>();
messagesWebhooks.Add(Common.Webhook.Type.inbound_url , new Common.Webhook { Address = "https://example.com/webhooks/inbound", Method="POST"});
messagesWebhooks.Add(Common.Webhook.Type.status_url , new Common.Webhook { Address = "https://example.com/webhooks/status", Method="POST" });
var messagesCapability = new Messages(messagesWebhooks);
var messagesCapability = new Applications.Capabilities.Messages(messagesWebhooks);

var rtcWebhooks = new Dictionary<Common.Webhook.Type, Common.Webhook>();
rtcWebhooks.Add(Common.Webhook.Type.event_url, new Common.Webhook { Address = "https://example.com/webhooks/events", Method = "POST" });
Expand Down Expand Up @@ -192,7 +192,7 @@ public async void CreateApplicationAsync(bool passCreds)
var messagesWebhooks = new Dictionary<Common.Webhook.Type, Common.Webhook>();
messagesWebhooks.Add(Common.Webhook.Type.inbound_url, new Common.Webhook { Address = "https://example.com/webhooks/inbound", Method = "POST" });
messagesWebhooks.Add(Common.Webhook.Type.status_url, new Common.Webhook { Address = "https://example.com/webhooks/status", Method = "POST" });
var messagesCapability = new Messages(messagesWebhooks);
var messagesCapability = new Applications.Capabilities.Messages(messagesWebhooks);

var rtcWebhooks = new Dictionary<Common.Webhook.Type, Common.Webhook>();
rtcWebhooks.Add(Common.Webhook.Type.event_url, new Common.Webhook { Address = "https://example.com/webhooks/events", Method = "POST" });
Expand Down Expand Up @@ -308,7 +308,7 @@ public void UpdateApplication(bool passCredentials)
var messagesWebhooks = new Dictionary<Common.Webhook.Type, Common.Webhook>();
messagesWebhooks.Add(Common.Webhook.Type.inbound_url, new Common.Webhook { Address = "https://example.com/webhooks/inbound", Method = "POST" });
messagesWebhooks.Add(Common.Webhook.Type.status_url, new Common.Webhook { Address = "https://example.com/webhooks/status", Method = "POST" });
var messagesCapability = new Messages(messagesWebhooks);
var messagesCapability = new Applications.Capabilities.Messages(messagesWebhooks);

var rtcWebhooks = new Dictionary<Common.Webhook.Type, Common.Webhook>();
rtcWebhooks.Add(Common.Webhook.Type.event_url, new Common.Webhook { Address = "https://example.com/webhooks/events", Method = "POST" });
Expand Down Expand Up @@ -424,7 +424,7 @@ public async void UpdateApplicationAsync(bool passCredentials)
var messagesWebhooks = new Dictionary<Common.Webhook.Type, Common.Webhook>();
messagesWebhooks.Add(Common.Webhook.Type.inbound_url, new Common.Webhook { Address = "https://example.com/webhooks/inbound", Method = "POST" });
messagesWebhooks.Add(Common.Webhook.Type.status_url, new Common.Webhook { Address = "https://example.com/webhooks/status", Method = "POST" });
var messagesCapability = new Messages(messagesWebhooks);
var messagesCapability = new Applications.Capabilities.Messages(messagesWebhooks);

var rtcWebhooks = new Dictionary<Common.Webhook.Type, Common.Webhook>();
rtcWebhooks.Add(Common.Webhook.Type.event_url, new Common.Webhook { Address = "https://example.com/webhooks/events", Method = "POST" });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"audio": {
"url": "https://test.com/me.mp3",
"caption": "Sounds I make"
},
"channel": "mms",
"message_type": "audio",
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"image": {
"url": "https://test.com/image.png"
},
"channel": "mms",
"message_type": "image",
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vcard": {
"url": "https://test.com/image.png"
},
"channel": "mms",
"message_type": "vcard",
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"video": {
"url": "https://test.com/image.mp4",
"caption": "A video of me"
},
"channel": "mms",
"message_type": "video",
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"channel": "sms",
"message_type": "text",
"text": "This is a test",
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "https://developer.nexmo.com/api-errors/#unathorized",
"title": "You did not provide correct credentials.",
"detail": "Check that you're using the correct credentials, and that your account has this feature enabled",
"instance": "bf0ca0bf927b3b52e3cb03217e1a1ddf"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"channel": "sms",
"message_type": "text",
"text": "This is a test",
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"channel": "whatsapp",
"message_type": "audio",
"audio": {
"url": "https://test.com/voice.mp3"
},
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"channel": "whatsapp",
"message_type": "custom",
"custom": {
"type": "template",
"template": {
"something": "whatsapp:hsm:technology:nexmo",
"name": "parcel_location"
}
},
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"channel": "whatsapp",
"message_type": "file",
"file": {
"url": "https://test.com/me.txt",
"caption": "Me"
},
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"channel": "whatsapp",
"message_type": "image",
"image": {
"url": "https://test.com/image.png",
"caption": "Testing image caption"
},
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"channel": "whatsapp",
"message_type": "template",
"template": {
"name": "Amazing template",
"parameters": [ "Tim", "Bob" ]
},
"whatsapp": {
"policy": "deterministic",
"locale": "en-GB"
},
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"channel": "whatsapp",
"message_type": "text",
"text": "Hello mum",
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"channel": "whatsapp",
"message_type": "video",
"video": {
"url": "https://test.com/me.mp4",
"caption": "Me at the zoo"
},
"to": "441234567890",
"from": "015417543010",
"client_ref": "abcdefg"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message_uuid": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab"
}
Loading

0 comments on commit 7befd35

Please sign in to comment.