Beskrivning
Check out the Github Repository ♥
Limitless Communication: All-in-one, super scalable, messaging Solution for WordPress.
Ok hold on! ✋. So, many words in one line.
Let’s understand each one-by-one.
- All-in-one: What do you want? – Email, SMS, push-notification? Get all-in-one.
- But I don’t want to use
xyz
provider for SMS, I want to usepqr
, can I have that? Yes it provides you with lot of pre implemented providers for all email, sms and push-notification.
- But I don’t want to use
- Super Scalable: But I want to use an email provider named
yxr
you haven’t heard the name of. Now what? 🧐- No worries! Are you a developer? If yes, just write your own plugin and implement your own adapter and see it nicely hooked-up with ”WordPress messaging”. Please refer to this section for implementing adapters.
And that’s how it provides Limitless communication! 🚀
Quick Links
Setup ⚙️ | Issues | Services and functions 🧩 | Create your own Adapter 🛠️
Coming soon ⏳
- Push notifications
- Email Testing page
- SMS Testing page
- Push notifications Testing page
Examples
Email 📧📨
Send an email through a particular adapter (with headers 😉) –
\Souptik\AllPathMessaging\Email\send(
[ 'dev2@souptik.dev' ],
'Yay its working!',
'This is some long mail body.',
'Souptik',
'dev1@souptik.dev',
[
'cc' => [
[
'name' => 'CC Test',
'email' => 'cc@souptik.dev',
],
],
'attachments' => [
trailingslashit( WP_CONTENT_DIR ) . '/mu-plugins/test-all-path-messaging.php',
'SameFileDifferentName.php' => trailingslashit( WP_CONTENT_DIR ) . '/mu-plugins/test-all-path-messaging.php',
],
],
'mailgun'
);
Just remove the last parameter! And now it uses the default selected adapter –
\Souptik\AllPathMessaging\Email\send(
[ 'dev2@souptik.dev' ],
'Yay its working!',
'This is some long mail body.',
'Souptik',
'dev1@souptik.dev',
[
'cc' => [
[
'name' => 'CC Test',
'email' => 'cc@souptik.dev',
],
],
'attachments' => [
trailingslashit( WP_CONTENT_DIR ) . '/mu-plugins/test-all-path-messaging.php',
'SameFileDifferentName.php' => trailingslashit( WP_CONTENT_DIR ) . '/mu-plugins/test-all-path-messaging.php',
],
],
);
Checked the override wp_mail
checkbox? Try a simple wp_mail
! –
wp_mail(
[ 'dev2@souptik.dev' ],
'Yay its working!',
'This is some long mail body - from <strong>wp_mail</strong>.',
[],
[]
);
SMS 📲
Send a SMS through a particular adapter –
\Souptik\AllPathMessaging\SMS\send( [ '+xxxxxxxxxxxx' ], 'Yay its working!', 'twilio' );
Just remove the last parameter! And now it uses the default selected adapter –
\Souptik\AllPathMessaging\SMS\send( [ '+xxxxxxxxxxxx' ], 'Yay its working!' );
Creating your own adapter 🛠️
Here comes the cool part fellow developers! 💻
Tip: I have provided a dummy adapter for each service at inc/<service>/adapters/dummy/
.
Consider that as the starting point and let’s understand what each file does.
- Let’s start with
namespace.php
. It is the entry point of your adapter.- In that you will see a simple
bootstrap
function. - In that function we are hooking into
EMAIL_SLUG . '_adapters'
and registering our adapter. - We pass the following data –
slug
name
adapter
class object.options
– An array defining the settings required for this adapter, which will be used to automatically display the options on the settings page.
- In that you will see a simple
- Next is
class-adapter.php
, which is the Adapter class, which we initialized in the above file and passed it toadapter
. It contains three simple functions –get_settings_fields
– This is the function which returns the array of options, which we used in the above file foroptions
. Each option, will have –- The key as the name of the option.
- And three values –
label
– Label to display in the settings page beside the input.type
– Type of the field.sanitize_callback
get_settings
– This function returns an associative array, whose keys are the name of the options and the value as the value of the options.get_adapter
– This function will just return the core provider class, which is responsible for processing the message.- First check if
Utopia Messaging
already provides the provider or not here, for exampleUtopia\Messaging\Adapter\Email\Mailgun
. - If it is present just use it. Easy peasy! ✨
- But if not, let’s code it ourself, because
Utopia Messaging
makes it so easy to create a new adapter!
class-dummy.php
is for that purpose, assuming you don’t get a provider already present inUtopia Messaging
.- It’s basically a child class of
EmailAdapter
orSMSAdapter
, which abstract a lot of stuff for us! - Let me explain two main functions,
_construct
andprocess
. Rest of the functions and properties are self-explanatory! 😉 - In the
_construct
function just put the arguments which you want to accept. That’s it! And now they will be available everywhere else as$this->param_name
! - The
process
function is the place where you have to write the main logic of calling your providers API to send the message.- As said above all the credentials/data you accepted through constructor are available as
$this->param_name
. - Build the
body
and theheaders
. - And then you can use the
$this->request
function as demonstrated in the dummy! - Create a response using Utopia’s
Response
class. - Handle the errors, populate the response, return! Done! 🚀
- As said above all the credentials/data you accepted through constructor are available as
- It’s basically a child class of
External services
Brevo
This plugin connect’s to Brevo’s API to send emails through Brevo. This is the API it sends the request to.
The request is send everytime a mail is sent, and Brevo is selected as the default adapter from the plugin settings (or the function to send email through Brevo is directly invoked in the code).
Here is the Terms of Use and Privacy Policy of the service.
AWS SES
This plugin connect’s to AWS SES’s API to send emails through AWS SES.
The request is send everytime a mail is sent, and AWS SES is selected as the default adapter from the plugin settings (or the function to send email through AWS SES is directly invoked in the code).
Here is the Terms of Use and Privacy Policy of the service.
Mailgun
This plugin connect’s to Mailgun’s API to send emails through Mailgun.
The request is send everytime a mail is sent, and Mailgun is selected as the default adapter from the plugin settings (or the function to send email through Mailgun is directly invoked in the code).
Here is the Terms of Use and Privacy Policy of the service.
Telesign
This plugin connect’s to Telesign’s API to send SMS through Telesign.
The request is send everytime the function to send SMS is invoked with the Adapter as Telesign or the default adapter is set as Telesign.
Here is the Terms of Use and Privacy Policy of the service.
Twilio
This plugin connect’s to Twilio’s API to send SMS through Twilio.
The request is send everytime the function to send SMS is invoked with the Adapter as Twilio or the default adapter is set as Twilio.
Here is the Terms of Use and Privacy Policy of the service.
Skärmdumpar
Installation
Upload ’all-path-messaging’ to the ’/wp-content/plugins/’ directory.
Activate the plugin through the ’Plugins’ menu in WordPress.
Vanliga frågor
-
I have a codebase, where I have used `wp_mail`. Do I need to make any changes to the codebase after installing this plugin?
-
Good news – no!
You just have to check theOverride wp_mail functionality checkbox
in the settings and that’s it! All your mails you are triggering throughwp_mail
will be sent through your selected provider! -
I am already using an email marketing plugin. Can I use this plugin to use as the email sending service?
-
Absolutely!
The plugin is made for that only! Keep using your existing email marketing plugin and just set the email provider as default (i.e it should usewp_mail
). And that’s it the emails will be send through the desired provider you select in this plugin. -
I need a provider called `xyz`, which is not present currently in this plugin. Do I have to ask you to integrate that?
-
If you know coding! – You don’t have to wait for it! Go ahead and create your own adapter in your plugin by extending this plugin.
If you are non-tech! – Please create an issue over here, and I will try to integrate the provider ASAP.
Recensioner
Detta tillägg har inga recensioner.
Bidragsgivare och utvecklare
”All Path Messaging” är programvara med öppen källkod. Följande personer har bidragit till detta tillägg.
Bidragande personerÖversätt ”All Path Messaging” till ditt språk.
Intresserad av programutveckling?
Läs programkoden, kika på SVN-filförvaret eller prenumerera på utvecklarloggen via RSS.
Ändringslogg
1.0.0
- First stable release.