The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Detailed using the Twilio tool to send messages with 3rd party apps incl. WhatsApp (#6562)
Muhammad Vaidae81b96b60c9
diff --git a/docs/extras/modules/agents/tools/integrations/twilio.ipynb b/docs/extras/modules/agents/tools/integrations/twilio.ipynbindex 98461a0ac5..0e0411a13d 100644--- a/docs/extras/modules/agents/tools/integrations/twilio.ipynb+++ b/docs/extras/modules/agents/tools/integrations/twilio.ipynb@@ -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": {},@@ -31,6 +35,7 @@]},{+ "attachments": {},"cell_type": "markdown","id": "f7e883ae","metadata": {},@@ -41,11 +46,12 @@]},{+ "attachments": {},"cell_type": "markdown","id": "36c133be","metadata": {},"source": [- "## Sending a message"+ "## Sending an SMS"]},{@@ -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": {diff --git a/langchain/utilities/twilio.py b/langchain/utilities/twilio.pyindex bf231b489f..45e009bb2b 100644--- a/langchain/utilities/twilio.py+++ b/langchain/utilities/twilio.py@@ -7,7 +7,7 @@ from langchain.utils import get_from_dict_or_envclass 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