supermeteor/sdk-php

This librabry use to create sms and email message using HTTP request

v1.7.0 2024-04-03 16:25 UTC

This package is auto-updated.

Last update: 2025-07-01 00:15:36 UTC


README

Supermeteor is PHP SDK use to create cloud message: whatsapp, sms and email etc

How to use

install using composer

composer require supermeteor/sdk-php

include vendor/autoload.php in your file

require_once '../vendor/autoload.php';
use Supermeteor\Client;

Initialise the SDK object

$sm = new Supermeteor('<secret_key>');

1. For sending sms:

pass type, phone, message as function parameter, Here is the sample function call for send sms.

Type must be: sms

$result = $sm->SendMessage('<type>', '+XXXXXXXXX', 'your message');

2. For sending email:

IMPORTANT: Custom email sender must be preset

pass email, subject, message as function parameter, Here is the sample function call for send email.

$result = $sm->sendEmail('mail@email.com', 'subject', 'your message');

3. For sending a simple whatsapp message:

pass free message as function parameter, Here is the sample function call for send whatsapp.

$fromPhone = '+852 6444 4444'
$toPhone = '+852 6888 8888'
$result = $sm->sendWhatsapp($fromPhone, $toPhone, 'your message');

Whatsapp template message

Message types overview (example)

graph TD
    booking[booking_confirmation]
    reminder[booking_reminder]
    cb[call_back]
    free[free_text]
    
    free --> |session message| client

    booking --> |template message| client
    cb --> |template message| client
    reminder --> |template message| client

    subgraph "SESSION type (free text)"
      free
     end 

    subgraph TEMPLATE type
      booking
      reminder
      cb
     end 

    click booking "#booking_confirmation" "asd" _self
    click greeting "#greeting"
    click cb "#call_back"
    click free "#free_text"
Loading

SESSION message example

{
  "fromPhone": "+852 6111 2222",
  "secret": "{{secret}}",
  "phone": "+852 6333 4444",
  "message": "free text blah blah blah..."
}

Code sample:

$supermeteor->sendWhatsapp($fromPhone, $toPhone, 'free text blah blah blah...');

Template message example

IMPORTANT: template message must be same as predefined

example: booking_confirmation

message pre-approved

Hello {{1}} , this is a confirmation of your consultation on {{2}}. ⭐We are at {{3}}.⭐

{
  "fromPhone": "+852 6111 2222",
  "secret": "{{secret}}",
  "phone": "+852 6333 4444",
  "message": "",
  "template": {
    "name": "booking_confirmation",
    "language": {
      "policy": "deterministic",
      "code": "en"
    },
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "Krishna"
          },
          {
            "type": "text",
            "text": "2022-06-11 10:00"
          },
          {
            "type": "text",
            "text": "4214 Lynn Street, Milton, MA"
          }
        ]
      }
    ]
  }
}

Code sample

$template = new \Supermeteor\WhatsappTemplateMessage(
    'booking_confirmation',
    'en',
    ['John', '2019-01-12']
);

// send a whatsapp template message
$supermeteor->sendWhatsapp($fromPhone, $toPhone, $template);

example: call_back

message pre-approved

Hi {{1}}, Just called you but not able to reach you, when is a good time to call backat {{2}}?

{
  "fromPhone": "+852 6111 2222",
  "secret": "{{secret}}",
  "phone": "+852 6333 4444",
  "template": {
    "name": "call_back",
    "language": {
      "policy": "deterministic",
      "code": "en"
    },
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "Krishna"
          },
          {
            "type": "text",
            "text": "2022-06-11 10:00"
          }
        ]
      }
    ]
  }
}

example: reminder

message pre-approved

Hello {{1}}, this is a reminder of your consultation at {{2}}. ⭐{{3}}⭐

{
  "fromPhone": "+852 6111 2222",
  "secret": "{{secret}}",
  "phone": "+852 6333 4444",
  "template": {
    "name": "greeting",
    "language": {
      "policy": "deterministic",
      "code": "en"
    },
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "Krishna"
          },
          {
            "type": "text",
            "text": "2022-06-11 10:00"
          },
          {
            "type": "text",
            "text": "4214 Lynn Street, Milton, MA"
          }
        ]
      }
    ]
  }
}