Skip to content

feat(messages): added new webhook, viber, and sms parameters #921

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
372 changes: 188 additions & 184 deletions packages/messages/__tests__/__dataSets__/messenger.ts

Large diffs are not rendered by default.

268 changes: 136 additions & 132 deletions packages/messages/__tests__/__dataSets__/mms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export default [
request: [
'/v1/messages',
'POST',
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'image',
image: {
url: 'https://example.com',
},
} as MMSImageRequest,
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'image',
image: {
url: 'https://example.com',
},
} as MMSImageRequest,
],
response: [
200,
Expand Down Expand Up @@ -62,17 +62,19 @@ export default [
request: [
'/v1/messages',
'POST',
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
client_ref: 'my-ref',
message_type: 'image',
image: {
url: 'https://example.com',
caption: 'A cat',
},
} as MMSImageRequest,
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
client_ref: 'my-ref',
message_type: 'image',
image: {
url: 'https://example.com',
caption: 'A cat',
},
webhook_url: 'https://example.com',
webhook_version: 'v1',
} as MMSImageRequest,
],
response: [
200,
Expand All @@ -91,6 +93,8 @@ export default [
url: 'https://example.com',
caption: 'A cat',
},
webhookUrl: 'https://example.com',
webhookVersion: 'v1',
} as MessageParamsImage),
],
expected: {
Expand All @@ -102,17 +106,17 @@ export default [
request: [
'/v1/messages',
'POST',
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
client_ref: 'my-ref',
message_type: 'image',
image: {
url: 'https://example.com',
caption: 'A cat',
},
} as MMSImageRequest,
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
client_ref: 'my-ref',
message_type: 'image',
image: {
url: 'https://example.com',
caption: 'A cat',
},
} as MMSImageRequest,
],
response: [
200,
Expand All @@ -130,7 +134,7 @@ export default [
}, // Image
'14152739164', // to
'12126875309', // from
'my-ref', // client ref
'my-ref' // client ref
),
],
expected: {
Expand All @@ -142,15 +146,15 @@ export default [
request: [
'/v1/messages',
'POST',
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'audio',
audio: {
url: 'https://example.com',
},
} as MMSAudioRequest,
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'audio',
audio: {
url: 'https://example.com',
},
} as MMSAudioRequest,
],
response: [
200,
Expand Down Expand Up @@ -178,17 +182,17 @@ export default [
request: [
'/v1/messages',
'POST',
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'audio',
client_ref: 'my-ref',
audio: {
url: 'https://example.com',
caption: 'A cool track',
},
} as MMSAudioRequest,
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'audio',
client_ref: 'my-ref',
audio: {
url: 'https://example.com',
caption: 'A cool track',
},
} as MMSAudioRequest,
],
response: [
200,
Expand Down Expand Up @@ -218,17 +222,17 @@ export default [
request: [
'/v1/messages',
'POST',
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'audio',
client_ref: 'my-ref',
audio: {
url: 'https://example.com',
caption: 'A cool track',
},
} as MMSAudioRequest,
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'audio',
client_ref: 'my-ref',
audio: {
url: 'https://example.com',
caption: 'A cool track',
},
} as MMSAudioRequest,
],
response: [
200,
Expand All @@ -240,13 +244,13 @@ export default [
clientMethod: 'send',
parameters: [
new Audio(
{
url: 'https://example.com',
caption: 'A cool track',
} as AudioObject, // Audio
'14152739164', // To
'12126875309', // From
'my-ref', // Client Ref
{
url: 'https://example.com',
caption: 'A cool track',
} as AudioObject, // Audio
'14152739164', // To
'12126875309', // From
'my-ref' // Client Ref
),
],
expected: {
Expand All @@ -258,15 +262,15 @@ export default [
request: [
'/v1/messages',
'POST',
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'video',
video: {
url: 'https://example.com',
},
} as MMSVideoRequest,
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'video',
video: {
url: 'https://example.com',
},
} as MMSVideoRequest,
],
response: [
200,
Expand Down Expand Up @@ -294,17 +298,17 @@ export default [
request: [
'/v1/messages',
'POST',
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'video',
client_ref: 'my-ref',
video: {
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
caption: 'Click me',
},
} as MMSVideoRequest,
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'video',
client_ref: 'my-ref',
video: {
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
caption: 'Click me',
},
} as MMSVideoRequest,
],
response: [
200,
Expand Down Expand Up @@ -334,17 +338,17 @@ export default [
request: [
'/v1/messages',
'POST',
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'video',
client_ref: 'my-ref',
video: {
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
caption: 'Click me',
},
} as MMSVideoRequest,
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'video',
client_ref: 'my-ref',
video: {
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
caption: 'Click me',
},
} as MMSVideoRequest,
],
response: [
200,
Expand All @@ -362,7 +366,7 @@ export default [
},
'14152739164', // to
'12126875309', // from
'my-ref', // client ref
'my-ref' // client ref
),
],
expected: {
Expand All @@ -374,15 +378,15 @@ export default [
request: [
'/v1/messages',
'POST',
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'vcard',
vcard: {
url: 'https://example.com',
},
} as MMSVcardRequest,
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'vcard',
vcard: {
url: 'https://example.com',
},
} as MMSVcardRequest,
],
response: [
200,
Expand Down Expand Up @@ -410,16 +414,16 @@ export default [
request: [
'/v1/messages',
'POST',
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'vcard',
vcard: {
url: 'https://example.com',
},
client_ref: 'my-ref',
} as MMSVcardRequest,
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'vcard',
vcard: {
url: 'https://example.com',
},
client_ref: 'my-ref',
} as MMSVcardRequest,
],
response: [
200,
Expand Down Expand Up @@ -448,16 +452,16 @@ export default [
request: [
'/v1/messages',
'POST',
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'vcard',
vcard: {
url: 'https://example.com',
},
client_ref: 'my-ref',
} as MMSVcardRequest,
{
from: '12126875309',
to: '14152739164',
channel: 'mms',
message_type: 'vcard',
vcard: {
url: 'https://example.com',
},
client_ref: 'my-ref',
} as MMSVcardRequest,
],
response: [
200,
Expand All @@ -472,7 +476,7 @@ export default [
'https://example.com',
'14152739164', // to
'12126875309', // from
'my-ref', // client ref
'my-ref' // client ref
),
],
expected: {
Expand Down
Loading