Title: | An Interface to the Twilio API for R |
---|---|
Description: | The Twilio web service provides an API for computer programs to interact with telephony. The included functions wrap the SMS and MMS portions of Twilio's API, allowing users to send and receive text messages from R. See <https://www.twilio.com/docs/> for more information. |
Authors: | Sean Kross [aut, cre] |
Maintainer: | Sean Kross <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-12-22 03:02:13 UTC |
Source: | https://github.com/seankross/twilio |
Media items that are attached to MMS messages, including photos and videos
are stored by Twilio. This function returns a list of twilio_media
objects, one for each piece of media in an MMS. Each object contains
information about that piece of media including its URL, Media SID, and
content type.
tw_get_message_media(message_sid)
tw_get_message_media(message_sid)
message_sid |
An SID for a message that contains media. |
A list containing media information.
## Not run: # Set API credentials # You only need to do this once per R session Sys.setenv(TWILIO_SID = "M9W4Ozq8BFX94w5St5hikg7UV0lPpH8e56") Sys.setenv(TWILIO_TOKEN = "483H9lE05V0Jr362eq1814Li2N1I424t") # Get media information from a message tw_get_message_media("MMo8Jw86Lj6422NzWgb8QxXlD5c45U100v") ## End(Not run)
## Not run: # Set API credentials # You only need to do this once per R session Sys.setenv(TWILIO_SID = "M9W4Ozq8BFX94w5St5hikg7UV0lPpH8e56") Sys.setenv(TWILIO_TOKEN = "483H9lE05V0Jr362eq1814Li2N1I424t") # Get media information from a message tw_get_message_media("MMo8Jw86Lj6422NzWgb8QxXlD5c45U100v") ## End(Not run)
Retrieves a list of Twilio SMS and MMS messages sent and receieved from your account.
tw_get_messages_list(page = 0, page_size = 50)
tw_get_messages_list(page = 0, page_size = 50)
page |
The page number of the list you would like to retrieve. Starts at zero. |
page_size |
The number of messages per page. The maximum number allowed is 1000. |
A twilio_messages_list
object.
## Not run: # Set API credentials # You only need to do this once per R session Sys.setenv(TWILIO_SID = "M9W4Ozq8BFX94w5St5hikg7UV0lPpH8e56") Sys.setenv(TWILIO_TOKEN = "483H9lE05V0Jr362eq1814Li2N1I424t") # Get messages sent to your account messages <- tw_get_messages_list() ## End(Not run)
## Not run: # Set API credentials # You only need to do this once per R session Sys.setenv(TWILIO_SID = "M9W4Ozq8BFX94w5St5hikg7UV0lPpH8e56") Sys.setenv(TWILIO_TOKEN = "483H9lE05V0Jr362eq1814Li2N1I424t") # Get messages sent to your account messages <- tw_get_messages_list() ## End(Not run)
Useful for turning a twilio_messages_list
into a tidy data set.
tw_message_tbl(messages_list)
tw_message_tbl(messages_list)
messages_list |
An S3 object with the class |
A data frame.
## Not run: # Set API credentials # You only need to do this once per R session Sys.setenv(TWILIO_SID = "M9W4Ozq8BFX94w5St5hikg7UV0lPpH8e56") Sys.setenv(TWILIO_TOKEN = "483H9lE05V0Jr362eq1814Li2N1I424t") # Get messages sent to your account messages <- tw_get_messages_list() # Create data frame from log sms_data <- tw_message_tbl(messages) ## End(Not run)
## Not run: # Set API credentials # You only need to do this once per R session Sys.setenv(TWILIO_SID = "M9W4Ozq8BFX94w5St5hikg7UV0lPpH8e56") Sys.setenv(TWILIO_TOKEN = "483H9lE05V0Jr362eq1814Li2N1I424t") # Get messages sent to your account messages <- tw_get_messages_list() # Create data frame from log sms_data <- tw_message_tbl(messages) ## End(Not run)
Send an SMS or MMS Message
tw_send_message(to, from, body = NULL, media_url = NULL)
tw_send_message(to, from, body = NULL, media_url = NULL)
to |
A phone number which will receieve the message. |
from |
A phone number which will send the message. |
body |
The body of the message. |
media_url |
A url containing media to be sent in a message. |
A twilio_message
object.
## Not run: # Set API credentials # You only need to do this once per R session Sys.setenv(TWILIO_SID = "M9W4Ozq8BFX94w5St5hikg7UV0lPpH8e56") Sys.setenv(TWILIO_TOKEN = "483H9lE05V0Jr362eq1814Li2N1I424t") # Send a simple text message tw_send_message("2125557634", "9178675903", "Hello from R!") # Send a picture message tw_send_message("2125557634", "9178675903", media_url = "https://www.r-project.org/logo/Rlogo.png") # Send a picture message with text tw_send_message("2125557634", "9178675903", "Do you like the new logo?", "https://www.r-project.org/logo/Rlogo.png") ## End(Not run)
## Not run: # Set API credentials # You only need to do this once per R session Sys.setenv(TWILIO_SID = "M9W4Ozq8BFX94w5St5hikg7UV0lPpH8e56") Sys.setenv(TWILIO_TOKEN = "483H9lE05V0Jr362eq1814Li2N1I424t") # Send a simple text message tw_send_message("2125557634", "9178675903", "Hello from R!") # Send a picture message tw_send_message("2125557634", "9178675903", media_url = "https://www.r-project.org/logo/Rlogo.png") # Send a picture message with text tw_send_message("2125557634", "9178675903", "Do you like the new logo?", "https://www.r-project.org/logo/Rlogo.png") ## End(Not run)