Code Monkey home page Code Monkey logo

mailwizz-php-sdk's Introduction

Mailwizz PHP SDK

This repository contains the PHP SDK for MailWizz EMA.
You'll find proper example on how to manage lists, subscribers, campaigns, templates and more.

The documentation website at https://api-docs.mailwizz.com/ showcases all the API endpoints.
You can find them in the examples folder as well.

Implementations using MailWizz PHP SDK:

Looking for Node.js implementations instead?

Install

You can either download latest version of the code or you can install it via composer as follows:
composer require twisted1919/mailwizz-php-sdk
Then follow the instructions from examples/setup.php file.

Test

Following environment variables have to be set, with their proper values:
MAILWIZZ_API_URL
MAILWIZZ_API_PUBLIC_KEY
MAILWIZZ_API_PRIVATE_KEY

Then you can run the tests:

$ composer test

mailwizz-php-sdk's People

Contributors

ghimes avatar josevega avatar twisted1919 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mailwizz-php-sdk's Issues

Method to Terminate Customer Account

Hi, i'm developing a module to integrate our crm with mailwizz and i successfully integrate de create customer function.
Is it possibly to add a function to terminate an account with the email address using the API.
Thanks

API Adds Email Multiple Times Duplicated

The MailWizz API adds the same email multiple times.
maxthonsnap20171222132457

This is my code for adding an email:
//MailWizz require_once dirname(__FILE__) . '/mailwizz.init.php'; $endpoint = new MailWizzApi_Endpoint_ListSubscribers(); //App New Users $response = $endpoint->create('wj730zl99w094', array( 'EMAIL' => $email ));

Doesn't MailWizz automatically check if a subscriber is already added and if so, not add that subscriber again?

Update SDK to meet new mailwizz feature

Please update SDK, example to meet new mailwizz feature like Preheader,Actions against subscribers upon campaign open, Change subscriber custom field value upon campaign open, Max. subscribers, Randomize subscribers, Send this campaign only to subscribers that have opened or have not opened a certain campaign...

Thanks

request timeout

In getting segments, the request is getting timeout error. How we can increase the timeout parameter of request?
In code its set to 30 seconds. Without hard coding how can I set it?
image

Get Subscriber ID

Hi,

Is it possible to get Subscriber ID returned on "create" endpoint? I tried dumping returned data and I can't seem to find in there, any solution where I can get Subscriber ID?

The idea is I wanted to get subscriber ID on newly added user.

Thanks

PHP 8.0+ curl_init issue

Hello,

Following are the details of the issue.

Generate:

  • Error: Throws Exception with message "Cannot initialize curl!"
  • File: MailWizzApi/Http/Request.php:113
  • PHP Version: 8.0.0+ (my local is 8.0.3)
  • Initiator: Call any CURL request from "MailWizzApi/Http/Request" class
  • Error Image:
    issue

API Issue

I have written Script to process bounce from PowerMTA log files.
What's my script doing ?

  1. It extract campaign id , subscriber uid from bounce record
    My bounce address is [SUBSCRIBER_UID]-[CAMPAIGN_UID]@domain.com

  2. Catch bounce dsn from powermta log files and then split into soft or hard bounce.

  3. Using API call i will "Create a bounce " and it will update on mailwizz data base " mw_campaign_bounce_log "

  4. Mailwizz automatically mark " Hard " bounce as " Blacklisted ". So i never needs to do anything about that.

Summary

I use PIPE pmta logs and extract Campaign UID and Sunscriber UID from bounce address & bounce type and dsn. Then add bounce record using API call.

$response = $endpoint->create('CAMPAIGN-UNIQUE-ID', array(
'message' => 'The reason why this email bounced', // max 250 chars
'bounce_type' => 'hard', // hard, soft or internal
'subscriber_uid' => 'SUBSCRIBER-UNIQUE-ID' // 13 chars unique subscriber identifier
));

What are the issues that I have ?

  1. With this script it only possible handle single customer account. If i want to handle another user account then i have to replace that second customer API keys or have to create seperate script for him.

That means if i have 50 customers i have to host 50 scripts or have to edit it each time when they blast. It's difficult / impossible task.

What I tried ?

  1. I tried to use same API key for all customers. I edited data base and even i used same API key for each user it's not works reason i think it's due to // customer_id// on table "mw_customer_api_key"

What are the errors that i'm getting ?

  1. When i use customer A account API key and tried to process bounce for Customer B then i can see all the process runs and finally API reject " The campaign does not exist! "

What am i request ?

  1. Is there any way to get generate API key for user admin that we can handle each and every customer campaigns from it ? ( API key for backend ? )

  2. or How can i get import my data into table "mw_campaign_bounce_log" without using API ?

Installation

I followed the instructions and didn't understand the installation part. Can I get the explanation in brief?

Rest API Call Issue

I'm trying to call subscribe api on Postman.
But i'm always getting error response.

I attached the screenshots too. please help me as soon as possible.
Screenshot 2019-11-16 at 6 46 41 AM
Screenshot 2019-11-16 at 6 46 00 AM

Option to provide bounce-status when unsubscribing from lists?

I am using unsubscribeByEmailFromAllLists / unsubscribeByEmail / unsubscribe when processing bounces through Port25 and other mechanisms. Is there an option where unsubscribes can be marked as a "bounce" and this then be attributed to running campaigns?

Add to email blacklist?

Is there any way to add an email to the email blacklist? Does unsubscribeByEmailFromAllLists add that email to the blacklist or just unsubscribe to all currently subscribed lists?

what is URL Hash in tracking campaign ?

hello ,
i want to track campaign and i have got following code
// Track subscriber click for campaign click
$response = $endpoint->trackUrl('CAMPAIGN-UNIQUE-ID', 'SUBSCRIBER-UNIQUE-ID', 'URL-HASH');
what is URL-Hash field and what value should i pass for same?

Signature issue

"error":"Invalid API request signature. Please refer to the documentation."

am testing the examples but sounds like signing is not being done successfully, also the python documentation is removed

Customer registration issue

If you follow example customers.php file it register a user without default group and also register as an active customer rather pending-confirm.

Can you look into this and update the SDK?

thanks

How to get a campaign's opens/bounces/unsubscribes via API?

Sorry for not asking this on the forums, but a third party has access to our MailWizz key, so I am unable to make an account.

I am currently implementing the API/SDK into our software, and I would like to be able to get the clicks, opens, bounces, and unsubscribes from a campaign. When using the Campaigns endpoint, it returns information such as "name", "type", "status", etc., but no opens/bounces/unsubs. CampaignsTracking allows me to get this information, but only passing in a subscriber ID, which is unhelpful because at that stage I will not know who has opened the emails. I can see the information clearly shown when I click on a certain campaign in the web panel, but cannot seem to find a way to export that data. Is there something I am missing, or is this not possible at this time? I may or may not be able to get access to the MailWizz files via SSH, so I would prefer a route that doesn't have me making my own server-side controllers.

Create API for list segments(Endpoint - MailWizzApi_Endpoint_ListSegments )

Hello there,
I want to create an API for the MailWizzApi_Endpoint_ListSegments endpoint, for that, I have added the below code and getting an error reponse, Please review it and let me know if I am doing wrong.

class MailWizzApi_Endpoint_ListSegments extends MailWizzApi_Base
{
/**
* Create a new subscriber in the given list
*
* @param string $listUid
* @param array $data
* @return MailWizzApi_Http_Response
* @throws Exception
*/
public function create($listUid, array $data)
{
$client = new MailWizzApi_Http_Client(array(
'method' => MailWizzApi_Http_Client::METHOD_POST,
'url' => $this->getConfig()->getApiUrl(sprintf('lists/%s/segments', (string)$listUid)),
'paramsPost' => $data,
));

    return $response = $client->request();
} 

}

Passing Request -
URL - http://localhost/mailwizz/features/list_segments.php?listUid=kq918octzy43a
Parameters -
{"ListSegment":{"name":"segment1","operator_match":"all"}}

Response-
Array
(
[status] => error
[error] => Page not found.
)

Thanks in advance.

Generating API Keys

There is no indication anywhere as to how one might generate API keys. Would you mind updating your documentation?

Campaign Content Returned Error

I am requesting that the error that is sent back be updated. If the user submits html that does not include html or body tags the error should reflect this.

Invalid API request signature. Please refer to the documentation while creating subscribers in Mailwizz sdk

hello ,
when i create subscription it gives me this error "Invalid API request signature. Please refer to the documentation".
i have used Mailwizz php-sdk for create lists,campaign.All are getting created successfully except only subscriber is not getting created.
I am using Lumen framework.
this is my code for creating subscription->

                     // CREATE THE ENDPOINT
			$endpoint = new \MailWizzApi_Endpoint_ListSubscribers();
			// ADD SUBSCRIBER
			$response = $endpoint->create($list_uid, array(
			    'EMAIL'    =>'[email protected]', //$data['email'], // the confirmation email will be sent!!! Use valid email address
			    'FNAME'    => 'ABC',
			    'LNAME'    => 'XYZ'//$data['name']
			));

var_dump($response);exit;

This is my construct function

public function __construct() {

	// configuration object
	$this->config = new \MailWizzApi_Config(array(
		'apiUrl'        => config('api_c.apiUrl'),
		'publicKey'     =>config('api_c.publicKey'),
		'privateKey'    => config('api_c.privateKey'),

	// components
		'components' => array(
				'cache' => array(
					'class'     => 'MailWizzApi_Cache_File',
					'filesPath' => dirname(__FILE__) . '/../../../vendor/twisted1919/mailwizz-php-sdk/MailWizzApi/Cache/data/cache', // make sure it is writable by webserver
				)
		),
	));
	// now inject the configuration and we are ready to make api calls
	\MailWizzApi_Base::setConfig($this->config);
	MailWizzApi_Autoloader::register();
}

When i dump client request ->

object(MailWizzApi_Http_Client)#2191 (11) {
["paramsGet"]=>
object(MailWizzApi_Params)#2184 (2) {
["_data":"MailWizzApi_Params":private]=>
array(0) {
}
["_readOnly":"MailWizzApi_Params":private]=>
bool(false)
}
["paramsPost"]=>
object(MailWizzApi_Params)#2194 (2) {
["_data":"MailWizzApi_Params":private]=>
array(3) {
["EMAIL"]=>
string(24) "[email protected]"
["FNAME"]=>
string(6) "ABC"
["LNAME"]=>
string(5) "XYZ"
}
["_readOnly":"MailWizzApi_Params":private]=>
bool(false)
}
["paramsPut"]=>
object(MailWizzApi_Params)#2196 (2) {
["_data":"MailWizzApi_Params":private]=>
array(0) {
}
["_readOnly":"MailWizzApi_Params":private]=>
bool(false)
}
["paramsDelete"]=>
object(MailWizzApi_Params)#2197 (2) {
["_data":"MailWizzApi_Params":private]=>
array(0) {
}
["_readOnly":"MailWizzApi_Params":private]=>
bool(false)
}
["headers"]=>
object(MailWizzApi_Params)#2198 (2) {
["_data":"MailWizzApi_Params":private]=>
array(0) {
}
["_readOnly":"MailWizzApi_Params":private]=>
bool(false)
}
["url"]=>
string(69) "http://massmail.xxxxx.com/api/lists/aq39684ebr853/subscribers"
["timeout"]=>
int(30)
["signRequest"]=>
bool(true)
["getResponseHeaders"]=>
bool(false)
["enableCache"]=>
bool(false)
["method"]=>
string(4) "POST"
}

I got following response from server-

object(MailWizzApi_Http_Response)#2204 (11) {
["url"]=>
string(69) "http://massmail.xxxxx.com/api/lists/kh966r7z84cb9/subscribers"
["headers"]=>
NULL
["contentType"]=>
string(31) "application/json; charset=UTF-8"
["httpMessage"]=>
string(11) "Bad Request"
["curlCode"]=>
int(0)
["curlMessage"]=>
string(0) ""
["storeCurlInfo"]=>
bool(false)
["curlInfo"]=>
NULL
["body"]=>
object(MailWizzApi_Params)#2202 (2) {
["_data":"MailWizzApi_Params":private]=>
array(2) {
["status"]=>
string(5) "error"
["error"]=>
string(65) "Invalid API request signature. Please refer to the documentation."
}
["_readOnly":"MailWizzApi_Params":private]=>
bool(false)
}
["request"]=>
NULL
["_httpCode":"MailWizzApi_Http_Response":private]=>
int(400)
}
Please help me out .

Thanks in Advance.

Changing Class names to customers needs

Hey there,

I have the extended license and wanted to change the class names (MailWizzApi_{NAME}) to something different.

I used Sublimes Replace function but it seems to break everything because it tells me:

MacBook-Pro:examples torstenhogel$ php lists.php

Fatal error: Uncaught Error: Class 'GoMailApi_Config' not found in /Users/torstenhogel/Library/CloudStorage/iCloud Drive/Documents/gomail-php-sdk/examples/setup.php:23
Stack trace:
#0 /Users/torstenhogel/Library/CloudStorage/iCloud Drive/Documents/gomail-php-sdk/examples/lists.php(11): require_once()
#1 {main}
  thrown in /Users/torstenhogel/Library/CloudStorage/iCloud Drive/Documents/gomail-php-sdk/examples/setup.php on line 23

I've also tried running cleanups via composer like cache e.g. but it didn't work.

Do you have any idea why this happens?

how to create bulk subscribers using mailwizz php sdk

hello,
when i create audience and while creating around 700-800 subscribers, it is taking time like 10-15min. so i want to create bulk subscribers because we have more than 10k subscribers and so want to reduce the time on server.
is that possible using php sdk?

Thanks in Advance.

This email address is blacklisted

Hey, it's me bothering again. Is any other blacklist than the one under "Lists" => "Email blacklist" ? Beucase I can only see one email blacklisted and it's not the same as the ones I'm adding thought the API.

Full response

MailWizzApi_Params Object
(
	[_data:MailWizzApi_Params:private] => Array
		(
			[status] => error
			[error] => This email address is blacklisted.
		)

	[_readOnly:MailWizzApi_Params:private] => 
)

Delete list forbidden

I'm getting a forbidden error when I try to delete a list.

I confirmed It exists and I also tried to delete one manually and worked. I've tried with 50 different lists and I always got the same response.

MailWizzApi_Params Object ( [_data:MailWizzApi_Params:private] => Array ( [status] => error [error] => Forbidden ) [_readOnly:MailWizzApi_Params:private] => ) 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.