Skip to content

Commit 83f8d09

Browse files
authored
feat: Add function getSMS to get the info of a sent SMS
1 parent 3c6625f commit 83f8d09

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

models/TwilioClient.cfc

+13
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ component singleton accessors="true" {
7171
.setBody( { "From": arguments.from, "To": arguments.to, "Body": escapeNewlineCharacters( arguments.body ) } );
7272
}
7373

74+
/**
75+
* Get the info of a SMS from Twilio
76+
*
77+
* @sid Id of the SMS
78+
*
79+
* @returns A configured HyperRequest instance. The return data is in field: data
80+
*/
81+
function getSMS( required string sid ) {
82+
return newRequest()
83+
.setMethod( "GET" )
84+
.setUrl( "/Accounts/#variables.accountSID#/Messages/#arguments.sid#.json")
85+
}
86+
7487
/**
7588
* Initiate a phone call
7689
*

readme.md

+16
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ Send an sms message. Returns a configured `HyperRequest` instance.
5353
| from | String | `true` | | The phone number the sms is from. This must be a valid Twilio number. |
5454
| body | String | `true` | | The body of the sms message. |
5555

56+
#### getSMS
57+
58+
Get information of a SMS sent with Twilio
59+
60+
| Name | Type | Required? | Default | Description |
61+
| ---- | ------ | --------- | ------- | --------------------------------------------------------------------- |
62+
| sid | String | `true` | | Sid of the Message |
63+
64+
The information of the sms is in the field `data` as json of the returned object.
65+
To get that information you need to deserialize it:
66+
67+
```
68+
responseObj = getSMS(sid);
69+
smsData = deserializejson( responseObj.data );
70+
```
71+
5672
### Hyper Integration
5773

5874
The Twilio SDK uses the Hyper HTTP Client under the hood. This entire power is

0 commit comments

Comments
 (0)