Skip to content

Commit

Permalink
1.0.0 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Räni authored Apr 24, 2019
1 parent 8ea5a1c commit 089abb3
Show file tree
Hide file tree
Showing 127 changed files with 23,636 additions and 2 deletions.
23 changes: 23 additions & 0 deletions .openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
1 change: 1 addition & 0 deletions .openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.0-beta2
23 changes: 23 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

return PhpCsFixer\Config::create()
->setUsingCache(true)
->setRules([
'@PSR2' => true,
'ordered_imports' => true,
'phpdoc_order' => true,
'array_syntax' => [ 'syntax' => 'short' ],
'strict_comparison' => true,
'strict_param' => true,
'no_trailing_whitespace' => false,
'no_trailing_whitespace_in_comment' => false,
'braces' => false,
'single_blank_line_at_eof' => false,
'blank_line_after_namespace' => false,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('test')
->exclude('tests')
->in(__DIR__)
);
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: php
sudo: false
php:
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
before_install: "composer install"
script: "vendor/bin/phpunit"
127 changes: 125 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,125 @@
# messente-api-php
Messente public API libraries merged into one PHP library
# Messente API Library

- Messente API version: 1.0.0
- PHP artifact version: 1.0.0

[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber and WhatsApp messages, blacklist phone numbers to make sure you&#39;re not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.

## Installation

Install Messente API library with `composer require messente/messente-api-php`.

## Features

Messente API has the following features:

- Omnichannel ([external docs](https://messente.com/documentation/omnichannel-api)),
- Phonebook ([external docs](https://messente.com/documentation/phonebook-api)).

Messente API Library provides the operations described below to access the features.

### BlacklistApi

1. Adds a phone number to the blacklist. [`addToBlacklist`](docs/Api/BlacklistApi.md#addtoblacklist)
1. Deletes a phone number from the blacklist. [`deleteFromBlacklist`](docs/Api/BlacklistApi.md#deletefromblacklist)
1. Returns all blacklisted phone numbers. [`fetchBlacklist`](docs/Api/BlacklistApi.md#fetchblacklist)
1. Checks if a phone number is blacklisted. [`isBlacklisted`](docs/Api/BlacklistApi.md#isblacklisted)

### ContactsApi

1. Adds a contact to a group. [`addContactToGroup`](docs/Api/ContactsApi.md#addcontacttogroup)
1. Creates a new contact. [`createContact`](docs/Api/ContactsApi.md#createcontact)
1. Deletes a contact. [`deleteContact`](docs/Api/ContactsApi.md#deletecontact)
1. Lists a contact. [`fetchContact`](docs/Api/ContactsApi.md#fetchcontact)
1. Lists groups of a contact. [`fetchContactGroups`](docs/Api/ContactsApi.md#fetchcontactgroups)
1. Returns all contacts. [`fetchContacts`](docs/Api/ContactsApi.md#fetchcontacts)
1. Removes a contact from a group. [`removeContactFromGroup`](docs/Api/ContactsApi.md#removecontactfromgroup)
1. Updates a contact. [`updateContact`](docs/Api/ContactsApi.md#updatecontact)

### DeliveryReportApi

1. Retrieves the delivery report for the Omnimessage. [`retrieveDeliveryReport`](docs/Api/DeliveryReportApi.md#retrievedeliveryreport)

### GroupsApi

1. Creates a new group with the provided name. [`createGroup`](docs/Api/GroupsApi.md#creategroup)
1. Deletes a group. [`deleteGroup`](docs/Api/GroupsApi.md#deletegroup)
1. Lists a group. [`fetchGroup`](docs/Api/GroupsApi.md#fetchgroup)
1. Returns all groups. [`fetchGroups`](docs/Api/GroupsApi.md#fetchgroups)
1. Updates a group with the provided name. [`updateGroup`](docs/Api/GroupsApi.md#updategroup)

### OmnimessageApi

1. Cancels a scheduled Omnimessage. [`cancelScheduledMessage`](docs/Api/OmnimessageApi.md#cancelscheduledmessage)
1. Sends an Omnimessage. [`sendOmnimessage`](docs/Api/OmnimessageApi.md#sendomnimessage)

## Auth

**Type**: HTTP basic authentication

Read the [external getting-started article](https://messente.com/documentation/getting-started) which explains API keys and Sender ID logic.

## Getting started: sending an omnimessage

```php
<?php
require_once(__DIR__ . '/../vendor/autoload.php');

use \Messente\Api\Api\OmnimessageApi;
use \Messente\Api\Configuration;
use \Messente\Api\Model\Omnimessage;
use \Messente\Api\Model\Viber;
use \Messente\Api\Model\SMS;
use \Messente\Api\Model\WhatsApp;
use \Messente\Api\Model\WhatsAppText;


// Configure HTTP basic authorization: basicAuth
$config = Configuration::getDefaultConfiguration()
->setUsername('<MESSENTE_API_USERNAME>')
->setPassword('<MESSENTE_API_PASSWORD>');

$apiInstance = new OmnimessageApi(
new GuzzleHttp\Client(),
$config
);

$omnimessage = new Omnimessage([
"to" => "<phone number in e.164 format>"
]);

$viber = new Viber(
["text" => "Hello Viber!", "sender" => "MyViberSender"]
);

$sms = new SMS(
["text" => "Hello SMS!", "sender" => "MySmsSender"]
);


$whatsAppText = new WhatsAppText(["body" => "Hello WhatsApp!"]);

$whatsapp = new WhatsApp(
['text' => $whatsAppText, "sender" => "MyWhatsAppSender"]
);

$omnimessage->setMessages([$whatsapp, $viber, $sms]);


try {
$result = $apiInstance->sendOmnimessage($omnimessage);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling sendOmnimessage: ', $e->getMessage(), PHP_EOL;
}
?>

```

## License

[Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)

## Terms

[https://messente.com/terms-and-conditions](https://messente.com/terms-and-conditions)
38 changes: 38 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "messente/messente-api-php",
"version": "1.0.0",
"description": "[Messente](https://messente.com) is a global provider of messaging and user verification services. Use Messente API library to send and receive SMS, Viber and WhatsApp messages, blacklist phone numbers to make sure you're not sending any unwanted messages, manage contacts and groups. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.",
"keywords": ["viber", "sms", "whatsapp", "phonebook", "openapitools",
"openapi-generator",
"php",
"sdk",
"rest",
"api"
],
"homepage": "https://messente.com",
"license": "proprietary",
"authors": [
{
"name": "Messente",
"homepage": "https://messente.com"
}
],
"require": {
"php": ">=7.1",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"guzzlehttp/guzzle": "^6.2"
},
"require-dev": {
"phpunit/phpunit": "^7.4",
"squizlabs/php_codesniffer": "~2.6",
"friendsofphp/php-cs-fixer": "~2.12"
},
"autoload": {
"psr-4": { "Messente\\Api\\" : "lib/" }
},
"autoload-dev": {
"psr-4": { "Messente\\Api\\" : "test/" }
}
}
Loading

0 comments on commit 089abb3

Please sign in to comment.