railroad / maropost
Maropost API For Laravel
Installs: 25 241
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: ~7
- guzzlehttp/guzzle: ~6.0
- laravel/framework: 5.6.*
Requires (Dev)
- orchestra/testbench: ~3.5
- phpunit/php-code-coverage: ~6.0
- phpunit/phpunit: ~7.0
This package is auto-updated.
Last update: 2025-03-01 00:28:53 UTC
README
Maropost API For Laravel
ContactService
All methods below are public.
Inject the Railroad\Maropost\Services\ContactService
class where needed.
/** @var Railroad\Maropost\Services\ContactService $contactService */ protected $contactService; public function __constructor(Railroad\Maropost\Services\ContactService $contactService){ $this->contactService = $contactService; }
Include namespace at top of file:
use Railroad\Maropost\Services\ContactService;
... to save yourself having to specify the namespace everywhere:
/** @var ContactService $contactService */ protected $contactService; public function __constructor(ContactService $contactService){ $this->contactService = $contactService; }
createOrUpdate
Creates a contact without a list. Updates if already existing email is passed.
Usage Example
$content = $this->contactService->createOrUpdate(ContactVO $contact);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | contact | yes | ContactVO object | The contact object that should be create/update. |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#281 +"id": 430 +"account_id": 2124 +"email": "roxana@drumeo.com" +"first_name": "" +"last_name": "" +"created_at": "2019-08-20T09:30:17.000-04:00" +"updated_at": "2019-08-21T04:18:53.000-04:00" +"uid": null +"orders": [] +"list_subscriptions": [] +"workflows": [] +"tags": [] } |
update
Update a contact without a list, based on id. This method should be used when update the email address.
Usage Example
$content = $this->contactService->update($contactId, ContactVO $contact);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | contactId | yes | integer | Contact id |
2 | contact | yes | ContactVO object | The contact object that should be update. |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#281 +"id": 430 +"account_id": 2124 +"email": "roxana@drumeo.com" +"first_name": "" +"last_name": "" +"created_at": "2019-08-20T09:30:17.000-04:00" +"updated_at": "2019-08-21T04:18:53.000-04:00" +"uid": null +"orders": [] +"list_subscriptions": [] +"workflows": [] +"tags": [] } |
findOneByEmail
Gets the contact according to email address
Usage Example
$content = $this->contactService->findOneByEmail($email);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | yes | string | Email address of the contact |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#281 +"id": 430 +"account_id": 2124 +"email": "roxana@drumeo.com" +"first_name": "" +"last_name": "" +"created_at": "2019-08-20T09:30:17.000-04:00" +"updated_at": "2019-08-21T04:18:53.000-04:00" +"uid": null +"orders": [] +"list_subscriptions": [] +"workflows": [] +"tags": [] } |
findOneById
Gets the contact based on id
Usage Example
$content = $this->contactService->findOneById($id);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | id | yes | integer | Contact id |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#281 +"id": 430 +"account_id": 2124 +"email": "roxana@drumeo.com" +"first_name": "" +"last_name": "" +"created_at": "2019-08-20T09:30:17.000-04:00" +"updated_at": "2019-08-21T04:18:53.000-04:00" +"uid": null +"orders": [] +"list_subscriptions": [] +"workflows": [] +"tags": [] } |
addContactToLists
Add contact to specified lists.
Usage Example
$content = $this->contactService->addContactToLists($listIds, $contactId);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | listIds | yes | array | The lists ids where the contact will be assigned |
2 | contactId | yes | integer | The contact id |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#248 +"id": 430 +"account_id": 2124 +"email": "roxana@drumeo.com" +"first_name": "" +"last_name": "" +"created_at": "2019-08-20T09:30:17.000-04:00" +"updated_at": "2019-08-21T04:18:53.000-04:00" +"uid": null +"orders": [] +"list_subscriptions": array:1 [ 0 => {#270 +"list_id": 1 +"name": "test" +"status": "Subscribed" +"created_at": "2019-08-23T07:43:58.000-04:00" +"updated_at": "2019-08-23T07:43:58.000-04:00" } ] +"workflows": [] +"tags": [] } |
removeContactFromLists
Remove contact from specified lists.
Usage Example
$content = $this->contactService->removeContactFromLists($listIds, $contactId);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | listIds | yes | array | The lists ids |
2 | contactId | yes | integer | The contact id. |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#248 +"id": 430 +"account_id": 2124 +"email": "roxana@drumeo.com" +"first_name": "" +"last_name": "" +"created_at": "2019-08-20T09:30:17.000-04:00" +"updated_at": "2019-08-21T04:18:53.000-04:00" +"uid": null +"orders": [] +"list_subscriptions": array:1 [ 0 => {#270 +"list_id": 1 +"name": "test" +"status": "Unsubscribed" +"created_at": "2019-08-23T07:43:58.000-04:00" +"updated_at": "2019-08-23T08:56:30.000-04:00" } ] +"workflows": [] +"tags": [] } |
getListContacts
Gets the list of contacts for the specified list
Usage Example
$content = $this->contactService->getListContacts($listId);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | listId | yes | integer | The list id |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | array | array:3 [ 0 => {#281 +"id": 427 +"account_id": 2124 +"email": "caleb+testmanual@drumeo.com" +"first_name": null +"last_name": null +"created_at": "2019-08-08T18:00:33.000-04:00" +"updated_at": "2019-08-08T18:00:33.000-04:00" +"uid": null +"subscription": {#279 +"status": "Subscribed" +"subscribed_at": "2019-08-08T18:00:33.000-04:00" +"updated_at": "2019-08-08T18:00:33.000-04:00" } +"total_pages": 1 } 1 => {#250 +"id": 426 +"account_id": 2124 +"email": "caleb+test1@drumeo.com" +"first_name": "caleb" +"last_name": "favor" +"created_at": "2019-08-08T17:33:48.000-04:00" +"updated_at": "2019-08-22T07:23:55.000-04:00" +"uid": null +"subscription": {#276 +"status": "Subscribed" +"subscribed_at": "2019-08-08T18:12:56.000-04:00" +"updated_at": "2019-08-08T18:12:56.000-04:00" } +"total_pages": 1 } 2 => {#269 +"id": 430 +"account_id": 2124 +"email": "roxana@drumeo.com" +"first_name": null +"last_name": null +"created_at": "2019-08-20T09:30:17.000-04:00" +"updated_at": "2019-08-21T04:18:53.000-04:00" +"uid": null +"subscription": {#248 +"status": "Unsubscribed" +"subscribed_at": "2019-08-23T07:43:58.000-04:00" +"updated_at": "2019-08-23T08:56:30.000-04:00" } +"total_pages": 1 } ] |
deleteContactByEmail
Deletes specified contact from all the lists.
Usage Example
$content = $this->contactService->deleteContactByEmail($email);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | yes | string | Email address of the contact |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#249 +"id": 430 +"account_id": 2124 +"email": "roxana@drumeo.com" +"first_name": "" +"last_name": "" +"created_at": "2019-08-20T09:30:17.000-04:00" +"updated_at": "2019-08-21T04:18:53.000-04:00" +"uid": null +"orders": [] +"list_subscriptions": [] +"workflows": [] +"tags": [] } |
addTagsToContact
Add tags to contact
Usage Example
$content = $this->contactService->addTagsToContact($contactId, $tags);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | contactId | yes | integer | The contact id |
2 | tags | yes | array | An array with the tags name that should be added |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | array | {#249 +"id": 430 +"account_id": 2124 +"email": "roxana@drumeo.com" +"first_name": "" +"last_name": "" +"created_at": "2019-08-20T09:30:17.000-04:00" +"updated_at": "2019-08-21T04:18:53.000-04:00" +"uid": null +"orders": [] +"list_subscriptions": [] +"workflows": [] +"tags": array:1 [ 0 => {#270 +"name": "test_tag" +"created_at": "2019-08-23T09:21:22.000-04:00" } ] } |
removeTagsFromContact
Remove specified tags from contact
Usage Example
$content = $this->contactService->removeTagsFromContact($contactId, $tags);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | contactId | yes | integer | The contact id |
2 | tags | yes | array | An array with the tags name that should be removed |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | array | {#249 +"id": 430 +"account_id": 2124 +"email": "roxana@drumeo.com" +"first_name": "" +"last_name": "" +"created_at": "2019-08-20T09:30:17.000-04:00" +"updated_at": "2019-08-21T04:18:53.000-04:00" +"uid": null +"orders": [] +"list_subscriptions": [] +"workflows": [] +"tags": [] } |
ListService
All methods below are public.
Inject the Railroad\Maropost\Services\ListService
class where needed
/** @var Railroad\Maropost\Services\ListService $listService */ protected $listService; public function __constructor(Railroad\Maropost\Services\ListService $listService){ $this->listService = $listService; }
Include namespace at top of file:
use Railroad\Maropost\Services\ListService;
... to save yourself having to specify the namespace everywhere:
/** @var ListService $listService */ protected $listService; public function __constructor(ListService $listService){ $this->listService = $listService; }
index
Gets the lists
Usage Example
$content = $this->listService->index();
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | noCounts | no | boolean | Default set 'no'. Set true to get description of lists other than counts, for faster results |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | array | array:[ 0 => {#281 +"id": 1 +"account_id": 2124 +"name": "test" +"address": """ 93208 Pansy Knolls\n East Annemouth, MT 95156-7534 """ +"language": "st" +"from_name": "" +"from_email": "" +"reply_to_email": "" +"add_to_unsubscribe_page": false +"refreshed_at": "2019-08-08T22:55:29.000-04:00" +"subscribers": 2 +"unsubscribes": 0 +"soft_bounces": 0 +"hard_bounces": 0 +"post_url": null +"list_type": "normal" +"folder_id": null +"brand_id": null +"crm_entity_id": null +"created_at": "2019-08-08T17:37:38.000-04:00" +"updated_at": "2019-08-22T07:25:12.000-04:00" +"display_name": "" +"description": "" +"total_revenue": 0.0 +"complaints_count": 0 +"total_contacts_count": 2 +"total_pages": 1 } 1 => {#279 +"id": 2 +"account_id": 2124 +"name": "Maropost_test" +"address": "31265 Wheel Avenue, #107 Abbotsford British Columbia V2T 6H2 Canada" +"language": "en" +"from_name": "" +"from_email": "" +"reply_to_email": "" +"add_to_unsubscribe_page": false +"refreshed_at": "2019-08-14T16:35:37.000-04:00" +"subscribers": 2 +"unsubscribes": 0 +"soft_bounces": 0 +"hard_bounces": 0 +"post_url": null +"list_type": "normal" +"folder_id": null +"brand_id": null +"crm_entity_id": null +"created_at": "2019-08-14T11:48:29.000-04:00" +"updated_at": "2019-08-14T16:35:39.000-04:00" +"display_name": "" +"description": "" +"total_revenue": 0.0 +"complaints_count": 0 +"total_contacts_count": 2 +"total_pages": 1 } ] |
create
Create a new list.
Usage Example
$content = $this->listService->create(ListVO $list);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | list | yes | ListVO object | The list object that should be create. |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#282 +"id": 14 +"account_id": 2124 +"name": "quos" +"address": """ 9996 Gerhard Port\n South Baron, IN 85715 """ +"language": "sw" +"from_name": "" +"from_email": "" +"reply_to_email": "" +"contacts_count": 0 +"add_to_unsubscribe_page": false +"refreshed_at": "2019-08-23T09:38:59.654-04:00" +"subscribers": null +"unsubscribes": null +"soft_bounces": null +"hard_bounces": null +"post_url": null +"list_type": "normal" +"folder_id": null +"brand_id": null +"crm_entity_id": null +"created_at": "2019-08-23T09:38:59.655-04:00" +"updated_at": "2019-08-23T09:38:59.655-04:00" +"display_name": "" +"description": "" +"total_revenue": null } |
update
Modify a list.
Usage Example
$content = $this->listService->update($id, ListVO $list);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | id | yes | integer | The list id |
2 | list | yes | ListVO object | The list object with the new values |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#282 +"id": 14 +"account_id": 2124 +"name": "quos" +"address": """ 82810 Eldred Station Apt. 770\n West Gwen, ND 58734-8710 """ +"language": "en" +"from_name": "" +"from_email": "" +"reply_to_email": "" +"contacts_count": 0 +"add_to_unsubscribe_page": false +"refreshed_at": "2019-08-23T09:38:59.654-04:00" +"subscribers": null +"unsubscribes": null +"soft_bounces": null +"hard_bounces": null +"post_url": null +"list_type": "normal" +"folder_id": null +"brand_id": null +"crm_entity_id": null +"created_at": "2019-08-08T17:37:38.000-04:00" +"updated_at": "2019-08-23T09:42:38.009-04:00" +"display_name": "" +"description": "" +"total_revenue": null } |
delete
Delete a list.
Usage Example
$content = $this->listService->delete($listId);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | listId | yes | integer | The list id. |
Responses
Null
show
Pull list with specified id.
Usage Example
$content = $this->listService->show($listId);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | listId | yes | integer | The list id. |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#282 +"id": 14 +"account_id": 2124 +"name": "quos" +"address": """ 82810 Eldred Station Apt. 770\n West Gwen, ND 58734-8710 """ +"language": "en" +"from_name": "" +"from_email": "" +"reply_to_email": "" +"contacts_count": 0 +"add_to_unsubscribe_page": false +"refreshed_at": "2019-08-23T09:38:59.654-04:00" +"subscribers": null +"unsubscribes": null +"soft_bounces": null +"hard_bounces": null +"post_url": null +"list_type": "normal" +"folder_id": null +"brand_id": null +"crm_entity_id": null +"created_at": "2019-08-08T17:37:38.000-04:00" +"updated_at": "2019-08-23T09:42:38.009-04:00" +"display_name": "" +"description": "" +"total_revenue": null } |
TagService
All methods below are public.
Inject the Railroad\Maropost\Services\TagService
class where needed
/** @var Railroad\Maropost\Services\TagService $tagService */ protected $tagService; public function __constructor(Railroad\Maropost\Services\TagService $tagService){ $this->tagService = $tagService; }
Include namespace at top of file:
use Railroad\Maropost\Services\TagService;
... to save yourself having to specify the namespace everywhere:
/** @var TagService $tagService */ protected $tagService; public function __constructor(TagService $tagService){ $this->tagService = $tagService; }
create
Create a new tag.
Usage Example
$content = $this->tagService->create(TagVO $tag);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | tag | yes | TagVO object | The TagVO object that should be created. |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#282 +"id": 25 +"name": "culpa" +"account_id": 2124 +"created_at": "2019-08-23T09:51:50.293-04:00" +"updated_at": "2019-08-23T09:51:50.293-04:00" +"folder_id": null } |
findByName
Find a tag by name.
Usage Example
$content = $this->tagService->findByName($name);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | name | yes | string | The tag name. |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#282 +"id": 25 +"name": "culpa" +"account_id": 2124 +"created_at": "2019-08-23T09:51:50.293-04:00" +"updated_at": "2019-08-23T09:51:50.293-04:00" +"folder_id": null } |
findById
Find a tag by id.
Usage Example
$content = $this->tagService->findById($tagId);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | tagId | yes | integer | The tag id. |
Responses
outcome | return data type | return data value | notes |
---|---|---|---|
failed | null | null | |
succeded | stdClass | {#282 +"id": 25 +"name": "culpa" +"account_id": 2124 +"created_at": "2019-08-23T09:51:50.293-04:00" +"updated_at": "2019-08-23T09:51:50.293-04:00" +"folder_id": null } |
delete
Delete tag
Usage Example
$content = $this->tagService->delete($tagId);
Parameters
# | name | required | type | description |
---|---|---|---|---|
1 | tagId | yes | integer | The tag id. |
Responses
Null