File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ require 'dotenv/load'
2
+ require 'vonage'
3
+
4
+ VONAGE_APPLICATION_ID = ENV [ 'VONAGE_APPLICATION_ID' ]
5
+ VONAGE_PRIVATE_KEY = ENV [ 'VONAGE_PRIVATE_KEY' ]
6
+ RCS_SENDER_ID = ENV [ 'RCS_SENDER_ID' ]
7
+ SMS_SENDER_ID = ENV [ 'SMS_SENDER_ID' ]
8
+ MESSAGES_TO_NUMBER = ENV [ 'MESSAGES_TO_NUMBER' ]
9
+
10
+ client = Vonage ::Client . new (
11
+ application_id : VONAGE_APPLICATION_ID ,
12
+ private_key : VONAGE_PRIVATE_KEY
13
+ )
14
+
15
+ rcs_message = client . messaging . rcs (
16
+ to : MESSAGES_TO_NUMBER ,
17
+ from : RCS_SENDER_ID ,
18
+ type : 'text' ,
19
+ message : 'This is an RCS text message sent via the Vonage Messages API'
20
+ )
21
+
22
+ sms_message = client . messaging . sms (
23
+ to : MESSAGES_TO_NUMBER ,
24
+ from : SMS_SENDER_ID ,
25
+ message : 'This is a failover SMS message in case the RCS message is rejected.'
26
+ )
27
+
28
+ client . messaging . send (
29
+ **rcs_message ,
30
+ failover : [ sms_message ]
31
+ )
You can’t perform that action at this time.
0 commit comments