chore: Merge master to develop (#3653)

This commit is contained in:
Oliver Windall Juhl authored and GitHub committed 2023-03-31 13:09:57 +02:00
1 parent b2e2eddcea
commit 809ab2e0eb
120 files changed
+2240 -585

No files matched your search

+54 -18
View File
@@ -1,26 +1,62 @@
# medusa-plugin-twilio-sms
# Twilio SMS
Twilio SMS / Messaging plugin.
Utilize Twilio's SMS APIs to send customers SMS notifications.
Learn more about how you can use this plugin in the [documentaion](https://docs.medusajs.com/add-plugins/twilio-sms).
[Twilio SMS Plugin Documentation](https://docs.medusajs.com/plugins/notifications/twilio-sms) | [Medusa Website](https://medusajs.com) | [Medusa Repository](https://github.com/medusajs/medusa)
## Options
## Features
```js
{
account_sid: "[twilio messaging account sid]", // required
auth_token: "[twilio massaging authentication token]", // required
from_number: "[the number used as sender SMS]",
}
```
- Access Twilio's SMS APIs easily using the `TwilioSmsService`.
## Dynamic usage
---
You can resolve the Twilio SMS service to dynamically send SMS's via Twilio.
## Prerequisites
Example:
- [Medusa backend](https://docs.medusajs.com/development/backend/install)
- [Twilio account](https://www.twilio.com/sms)
```js
const twilioSmsService = scope.resolve("twilioSmsService")
twilioSmsService.sendSms({ to: "+4500112233", body: "Hello world!" })
```
---
## How to Install
1\. Run the following command in the directory of the Medusa backend:
```bash
npm install medusa-plugin-twilio-sms
```
2\. Set the following environment variable in `.env`:
```bash
TWILIO_SMS_ACCOUNT_SID=<YOUR_ACCOUNT_SID>
TWILIO_SMS_AUTH_TOKEN=<YOUR_AUTH_TOKEN>
TWILIO_SMS_FROM_NUMBER=<YOUR_TWILIO_NUMBER>
```
3\. In `medusa-config.js` add the following at the end of the `plugins` array:
```js
const plugins = [
// ...
{
resolve: `medusa-plugin-twilio-sms`,
options: {
account_sid: process.env.TWILIO_SMS_ACCOUNT_SID,
auth_token: process.env.TWILIO_SMS_AUTH_TOKEN,
from_number: process.env.TWILIO_SMS_FROM_NUMBER,
},
},
]
```
---
## Test the Plugin
In your code, use the `TwilioSmsService` where necessary to send your customers notifications.
---
## Additional Resources
- [Twilio SMS Plugin Documentation](https://docs.medusajs.com/plugins/notifications/twilio-sms)