-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
977d149
commit 1c94038
Showing
16 changed files
with
563 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'dotenv/load' | ||
require 'vonage' | ||
|
||
VONAGE_APPLICATION_ID = ENV['VONAGE_APPLICATION_ID'] | ||
VONAGE_APPLICATION_PRIVATE_KEY_PATH = ENV['VONAGE_APPLICATION_PRIVATE_KEY_PATH'] | ||
GEOSPECIFIC_VONAGE_API_HOST = ENV['GEOSPECIFIC_VONAGE_API_HOST'] | ||
MESSAGE_UUID = ENV['MESSAGE_UUID'] | ||
|
||
client = Vonage::Client.new( | ||
application_id: VONAGE_APPLICATION_ID, | ||
private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH), | ||
api_host: GEOSPECIFIC_VONAGE_API_HOST | ||
) | ||
|
||
client.messaging.update( | ||
message_uuid: MESSAGE_UUID, | ||
status: 'revoked' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require 'dotenv/load' | ||
require 'vonage' | ||
|
||
VONAGE_APPLICATION_ID = ENV['VONAGE_APPLICATION_ID'] | ||
VONAGE_APPLICATION_PRIVATE_KEY_PATH = ENV['VONAGE_APPLICATION_PRIVATE_KEY_PATH'] | ||
RCS_SENDER_ID = ENV['RCS_SENDER_ID'] | ||
TO_NUMBER = ENV['TO_NUMBER'] | ||
FILE_URL = ENV['FILE_URL'] | ||
|
||
client = Vonage::Client.new( | ||
application_id: VONAGE_APPLICATION_ID, | ||
private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH) | ||
) | ||
|
||
message = client.messaging.rcs( | ||
type: 'file', | ||
message: { | ||
url: ENV['FILE_URL'], | ||
} | ||
) | ||
|
||
client.messaging.send( | ||
from: RCS_SENDER_ID, | ||
to: TO_NUMBER, | ||
**message | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require 'dotenv/load' | ||
require 'vonage' | ||
|
||
VONAGE_APPLICATION_ID = ENV['VONAGE_APPLICATION_ID'] | ||
VONAGE_APPLICATION_PRIVATE_KEY_PATH = ENV['VONAGE_APPLICATION_PRIVATE_KEY_PATH'] | ||
RCS_SENDER_ID = ENV['RCS_SENDER_ID'] | ||
TO_NUMBER = ENV['TO_NUMBER'] | ||
IMAGE_URL = ENV['IMAGE_URL'] | ||
|
||
client = Vonage::Client.new( | ||
application_id: VONAGE_APPLICATION_ID, | ||
private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH) | ||
) | ||
|
||
message = client.messaging.rcs( | ||
type: 'image', | ||
message: { | ||
url: ENV['IMAGE_URL'], | ||
} | ||
) | ||
|
||
client.messaging.send( | ||
from: RCS_SENDER_ID, | ||
to: TO_NUMBER, | ||
**message | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
require 'dotenv/load' | ||
require 'vonage' | ||
|
||
VONAGE_APPLICATION_ID = ENV['VONAGE_APPLICATION_ID'] | ||
VONAGE_APPLICATION_PRIVATE_KEY_PATH = ENV['VONAGE_APPLICATION_PRIVATE_KEY_PATH'] | ||
RCS_SENDER_ID = ENV['RCS_SENDER_ID'] | ||
TO_NUMBER = ENV['TO_NUMBER'] | ||
IMAGE_URL = ENV['IMAGE_URL'] | ||
VIDEO_URL = ENV['VIDEO_URL'] | ||
|
||
client = Vonage::Client.new( | ||
application_id: VONAGE_APPLICATION_ID, | ||
private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH) | ||
) | ||
|
||
message = client.messaging.rcs( | ||
type: 'custom', | ||
message: { | ||
contentMessage: { | ||
richCard: { | ||
carouselCard: { | ||
cardWidth: "MEDIUM", | ||
cardContents: [ | ||
{ | ||
title: "Option 1: Photo", | ||
description: "Do you prefer this photo?", | ||
media: { | ||
height: "MEDIUM", | ||
contentInfo: { | ||
fileUrl: ENV['IMAGE_URL'], | ||
forceRefresh: false | ||
} | ||
}, | ||
suggestions: [ | ||
{ | ||
reply: { | ||
text: "Option 1", | ||
postbackData: "card_1" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
title: "Option 1: Video", | ||
description: "Or this video?", | ||
media: { | ||
height: "MEDIUM", | ||
contentInfo: { | ||
fileUrl: ENV['VIDEO_URL'], | ||
forceRefresh: false | ||
} | ||
}, | ||
suggestions: [ | ||
{ | ||
reply: { | ||
text: "Option 2", | ||
postbackData: "card_2" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
) | ||
|
||
client.messaging.send( | ||
from: RCS_SENDER_ID, | ||
to: TO_NUMBER, | ||
**message | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
require 'dotenv/load' | ||
require 'vonage' | ||
|
||
VONAGE_APPLICATION_ID = ENV['VONAGE_APPLICATION_ID'] | ||
VONAGE_APPLICATION_PRIVATE_KEY_PATH = ENV['VONAGE_APPLICATION_PRIVATE_KEY_PATH'] | ||
RCS_SENDER_ID = ENV['RCS_SENDER_ID'] | ||
TO_NUMBER = ENV['TO_NUMBER'] | ||
IMAGE_URL = ENV['IMAGE_URL'] | ||
|
||
client = Vonage::Client.new( | ||
application_id: VONAGE_APPLICATION_ID, | ||
private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH) | ||
) | ||
|
||
message = client.messaging.rcs( | ||
type: 'custom', | ||
message: { | ||
contentMessage: { | ||
richCard: { | ||
standaloneCard: { | ||
thumbnailImageAlignment: "RIGHT", | ||
cardOrientation: "VERTICAL", | ||
cardContent: { | ||
title: "Quick question", | ||
description: "Do you like this picture?", | ||
media: { | ||
height: "TALL", | ||
contentInfo: { | ||
fileUrl: ENV['IMAGE_URL'], | ||
forceRefresh: false | ||
} | ||
}, | ||
suggestions: [ | ||
{ | ||
reply: { | ||
text: "Yes", | ||
postbackData: "suggestion_1" | ||
} | ||
}, | ||
{ | ||
reply: { | ||
text: "I love it!", | ||
postbackData: "suggestion_2" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
) | ||
|
||
client.messaging.send( | ||
from: RCS_SENDER_ID, | ||
to: TO_NUMBER, | ||
**message | ||
) |
42 changes: 42 additions & 0 deletions
42
messages/rcs/send-suggested-action-create-calendar-event.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require 'dotenv/load' | ||
require 'vonage' | ||
|
||
VONAGE_APPLICATION_ID = ENV['VONAGE_APPLICATION_ID'] | ||
VONAGE_APPLICATION_PRIVATE_KEY_PATH = ENV['VONAGE_APPLICATION_PRIVATE_KEY_PATH'] | ||
RCS_SENDER_ID = ENV['RCS_SENDER_ID'] | ||
TO_NUMBER = ENV['TO_NUMBER'] | ||
|
||
client = Vonage::Client.new( | ||
application_id: VONAGE_APPLICATION_ID, | ||
private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH) | ||
) | ||
|
||
message = client.messaging.rcs( | ||
type: 'custom', | ||
message: { | ||
contentMessage: { | ||
text: "Product Launch: Save the date!", | ||
suggestions: [ | ||
{ | ||
action: { | ||
text: "Save to calendar", | ||
postbackData: "postback_data_1234", | ||
fallbackUrl: "https://www.google.com/calendar", | ||
createCalendarEventAction: { | ||
startTime: "2024-08-24T20:00:00Z", | ||
endTime: "2024-08-24T22:00:00Z", | ||
title: "Vonage API Product Launch", | ||
description: "Join us for the launch of our latest product!", | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
) | ||
|
||
client.messaging.send( | ||
from: RCS_SENDER_ID, | ||
to: TO_NUMBER, | ||
**message | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require 'dotenv/load' | ||
require 'vonage' | ||
|
||
VONAGE_APPLICATION_ID = ENV['VONAGE_APPLICATION_ID'] | ||
VONAGE_APPLICATION_PRIVATE_KEY_PATH = ENV['VONAGE_APPLICATION_PRIVATE_KEY_PATH'] | ||
RCS_SENDER_ID = ENV['RCS_SENDER_ID'] | ||
TO_NUMBER = ENV['TO_NUMBER'] | ||
|
||
client = Vonage::Client.new( | ||
application_id: VONAGE_APPLICATION_ID, | ||
private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH) | ||
) | ||
|
||
message = client.messaging.rcs( | ||
type: 'custom', | ||
message: { | ||
contentMessage: { | ||
text: "Call us to claim your free gift!", | ||
suggestions: [ | ||
{ | ||
action: { | ||
text: "Call now!", | ||
postbackData: "postback_data_1234", | ||
fallbackUrl: "https://www.example.com/contact/", | ||
dialAction: { | ||
phoneNumber: "+447900000000" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
) | ||
|
||
client.messaging.send( | ||
from: RCS_SENDER_ID, | ||
to: TO_NUMBER, | ||
**message | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require 'dotenv/load' | ||
require 'vonage' | ||
|
||
VONAGE_APPLICATION_ID = ENV['VONAGE_APPLICATION_ID'] | ||
VONAGE_APPLICATION_PRIVATE_KEY_PATH = ENV['VONAGE_APPLICATION_PRIVATE_KEY_PATH'] | ||
RCS_SENDER_ID = ENV['RCS_SENDER_ID'] | ||
TO_NUMBER = ENV['TO_NUMBER'] | ||
|
||
client = Vonage::Client.new( | ||
application_id: VONAGE_APPLICATION_ID, | ||
private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH) | ||
) | ||
|
||
message = client.messaging.rcs( | ||
type: 'custom', | ||
message: { | ||
contentMessage: { | ||
text: "Need some help? Call us now or visit our website for more information.", | ||
suggestions: [ | ||
{ | ||
action: { | ||
text: "Call us", | ||
postbackData: "postback_data_1234", | ||
fallbackUrl: "https://www.example.com/contact/", | ||
dialAction: { | ||
phoneNumber: "+447900000000" | ||
} | ||
} | ||
}, | ||
{ | ||
action: { | ||
text: "Visit site", | ||
postbackData: "postback_data_1234", | ||
openUrlAction: { | ||
url: "http://example.com/" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
) | ||
|
||
client.messaging.send( | ||
from: RCS_SENDER_ID, | ||
to: TO_NUMBER, | ||
**message | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'dotenv/load' | ||
require 'vonage' | ||
|
||
VONAGE_APPLICATION_ID = ENV['VONAGE_APPLICATION_ID'] | ||
VONAGE_APPLICATION_PRIVATE_KEY_PATH = ENV['VONAGE_APPLICATION_PRIVATE_KEY_PATH'] | ||
RCS_SENDER_ID = ENV['RCS_SENDER_ID'] | ||
TO_NUMBER = ENV['TO_NUMBER'] | ||
|
||
client = Vonage::Client.new( | ||
application_id: VONAGE_APPLICATION_ID, | ||
private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH) | ||
) | ||
|
||
message = client.messaging.rcs( | ||
type: 'custom', | ||
message: { | ||
contentMessage: { | ||
text: "Check out our latest offers!", | ||
suggestions: [ | ||
{ | ||
action: { | ||
text: "Open product page", | ||
postbackData: "postback_data_1234", | ||
openUrlAction: { | ||
url: "http://example.com/" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
) | ||
|
||
client.messaging.send( | ||
from: RCS_SENDER_ID, | ||
to: TO_NUMBER, | ||
**message | ||
) |
Oops, something went wrong.