zzbomb/groupme

This package is abandoned and no longer maintained. The author suggests using the jspaetzel/groupme package instead.

Groupme Library for PHP

1.0.0 2021-04-29 06:42 UTC

This package is auto-updated.

Last update: 2021-04-29 06:43:08 UTC


README

Build Packagist Version

Install with Composer

composer require jspaetzel/groupme

Then use the autoloader to load this library in your code

require './vendor/autoload.php';

Examples

These are some basic examples for how to interact with the api via the library. The APIKEY in these examples is the API key of a user, not a groupme bot key or application key.

For all requests you'll need create a Client

$client = new \GroupMePHP\Client('APIKEY');

Send a message to a group

$message_to_send = "Hello Group!"
$messages_service = new \GroupMePHP\Services\MessagesService($client);
$messages_service->create(12345678, ["THISISAGUID123", $message_to_send]);

Send a direct message to a user

$direct_message_service = new \GroupMePHP\Services\DirectMessagesService($client);
$direct_message_service->create([
    "source_guid" => "THISISAGUID123",
    "recipient_id" => 12345678,
    "text" => 'Hello User'
]);

Get index of groups for authenticated user

$group_service = new \GroupMePHP\Services\GroupsService($client);
$response = $group_service->index();

Get only the members of a group as json

$group_service = new \GroupMePHP\Services\GroupsService($client);
$response = $group_service->show(1234567);
$members = json_decode($response)['response']['members'];

Want to contribute?

See the contribution guide