Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
62 changes: 60 additions & 2 deletions docs/extras/modules/agents/tools/integrations/twilio.ipynb
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "dc23c48e",
"metadata": {},
"source": [
"# Twilio\n",
"\n",
"This notebook goes over how to use the [Twilio](https://www.twilio.com) API wrapper to send a text message."
"This notebook goes over how to use the [Twilio](https://www.twilio.com) API wrapper to send a message through SMS or [Twilio Messaging Channels](https://www.twilio.com/docs/messaging/channels).\n",
"\n",
"Twilio Messaging Channels facilitates integrations with 3rd party messaging apps and lets you send messages through WhatsApp Business Platform (GA), Facebook Messenger (Public Beta) and Google Business Messages (Private Beta)."
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "c1a33b13",
"metadata": {},
Expand All @@ -31,6 +35,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "f7e883ae",
"metadata": {},
Expand All @@ -41,11 +46,12 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "36c133be",
"metadata": {},
"source": [
"## Sending a message"
"## Sending an SMS"
]
},
{
Expand Down Expand Up @@ -81,6 +87,58 @@
"source": [
"twilio.run(\"hello world\", \"+16162904619\")"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "de022dc9",
"metadata": {},
"source": [
"## Sending a WhatsApp Message"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "a594d0bc",
"metadata": {},
"source": [
"You'll need to link your WhatsApp Business Account with Twilio. You'll also need to make sure that the number to send messages from is configured as a WhatsApp Enabled Sender on Twilio and registered with WhatsApp."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "94508aa0",
"metadata": {},
"outputs": [],
"source": [
"from langchain.utilities.twilio import TwilioAPIWrapper"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e4b81750",
"metadata": {},
"outputs": [],
"source": [
"twilio = TwilioAPIWrapper(\n",
" # account_sid=\"foo\",\n",
" # auth_token=\"bar\",\n",
" # from_number=\"whatsapp: baz,\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1181041b",
"metadata": {},
"outputs": [],
"source": [
"twilio.run(\"hello world\", \"whatsapp: +16162904619\")"
]
}
],
"metadata": {
Expand Down
2 changes: 1 addition & 1 deletion langchain/utilities/twilio.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class TwilioAPIWrapper(BaseModel):
"""Sms Client using Twilio.
"""Messaging Client using Twilio.

To use, you should have the ``twilio`` python package installed,
and the environment variables ``TWILIO_ACCOUNT_SID``, ``TWILIO_AUTH_TOKEN``, and
Expand Down