mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 00:23:25 +00:00
Detailed using the Twilio tool to send messages with 3rd party apps incl. WhatsApp (#6562)
Everything needed to support sending messages over WhatsApp Business Platform (GA), Facebook Messenger (Public Beta) and Google Business Messages (Private Beta) was present. Just added some details on leveraging it.
This commit is contained in:
parent
b8d78424ab
commit
ae81b96b60
@ -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": {
|
||||
|
@ -7,7 +7,7 @@ from langchain.utils import get_from_dict_or_env
|
||||
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user