Textme.lk SMS SDK and Sample Apps

Overview

TextMe

TextME Javascript SDK

Builder License Twitter

Table of Content

Introduction

Mauris iaculis pede, tellus commodo justo. Ligula in tortmris libero lectus libero aliquet, vestibulum aut nullloret ac sictus, id pede quis quisque lacinia consectetuer. uere eros velit eu nec arcu, repellat urna ad odio nunc. Doletiarcu eginrdum tiunt morbi, aenean dui amet at mapro Sed quis nunc est justo, in in, elit lorem vulputate, suspendisse pellentesque pede tpluptatem ut mattis, eros diam litora nullam. Ac cras, mollis quis maecenas urna ullamper eros.

Prerequisite

Create an account in TextMe if you don't already have one. The sender ID you choose will be referred to as <sender_id> throughout this documentation.

Install

Install the library from the npm registry.

npm install @iconicto/textme-js-sdk

Or simply load the SDK by importing the script into the header of your HTML file.

<script src="https://unpkg.com/@iconicto/[email protected]/dist/textme.production.js"></script>

<script>
    const smsclient = new TextMeClient.TextMeClient({
      apiKey: "4|rg6coE8RIS6lQeQf6IbvAna52f4gZqELZ3Bvl1Tp",
      senderID: "<sender_id>"
    });
</script>

Getting Started

ExpressJS Example

// The SDK provides a client that can be used to carry out the functionalities.
const { TextMeClient } = require('@iconicto/textme-js-sdk');

// Create a config object containing the necessary configurations.
const config = {
    apiKey: "API Key" ,
    senderID: "<sender_id>"
};

// Instantiate the TextMeClient and pass the config object as an argument into the constructor.
const textmeClient = new TextMeClient(config);

//If you are using ExpressJS, you may try something like this.
app.post("/send", (req, res) => {
  textmeClient
    .sendSMS(req.body.to, req.body.message)
    .then((response) => {
      console.log(response);
      res.status(200).send(response);
    })
    .catch((err) => {
      console.error(err);
      res.status(500).send(err);
    });
  });
});

ReactJS Example

// The SDK provides a client that can be used to carry out the functionalities.
import { TextMeClient } from "@iconicto/textme-js-sdk";

// Create a config object containing the necessary configurations.
const config = {
    apiKey: "API Key" ,
    senderID: "<sender_id>"
};
// Instantiate the TextMeClient and pass the config object as an argument into the constructor.
const smsclient = new TextMeClient(config);

//Send an SMS
const sendSMS = () => {
  smsclient
    .sendSMS("94771655198", "Hello World")
    .then((response) => {
      console.log(response);
    })
    .catch((err) => {
      console.log(err);
    });
};

sendSMS();

APIs

The SDK provides a client class called TextMeClient that provides you with the necessary methods to implement the functionalities. You can instantiate the class and use the object to access the provided methods.

constructor

new TextMeClient(config: ClientConfig);

Arguments

  1. config: ClientConfig

    This contains the configuration information needed to implement the functionalities.

    Example

    const config = {
         apiKey: "API Key" ,
         senderID: "<sender_id>"
     };

sendSMS

sendSMS(to: string, message: string): Promise<SMSResponse>

Arguments

  1. to: string

    This is the recipient's phone number. Please note that special characters (Eg: +, -) are not allowed. The correct format is as follows. 94777111111 (Sri Lanka)

  2. message: string

    This SMS text you want to send in.

Returns

A Promise that resolves with a Promise that resolves with the SMSResponse object.

Description

This method can be used to send a single SMS to a specific user.

Example (Express JS)

textmeClient
    .sendSMS(req.body.to, req.body.message)
    .then((response) => {
        console.log(response);
        res.status(200).send(response);
    })
    .catch((err) => {
        console.log(err);
        res.status(500).send(err);
});

viewSMS

viewSMS(uid: string): Promise<SMSResponse>

Arguments

  1. uid: string

    The UID of the particular message that needs to be viewed.

Returns

A Promise that resolves with a Promise that resolves with the SMSResponse object.

Description

This method can be used to view a specific message. It takes the UID of a messsage as the argument and returns a SMSResponse object of the relevant SMS.

Example (Express JS)

textmeClient
    .viewSMS(req.query.uid)
    .then((response) => {
        console.log(response);
        res.status(200).send(response);
    })
    .catch((err) => {
        console.log(err);
        res.status(500).send(err);
    });

viewAllSMS

viewAllSMS(): Promise<ViewAllSMSResponse>

Returns

A Promise that resolves with a Promise that resolves with the ViewAllSMSResponse object.

Description

This method returns all the SMSs that have been sent from the user's account.

Example (Express JS)

textmeClient
    .viewAllSMS()
    .then((response) => {
        console.log(response);
        res.status(200).send(response);
    })
    .catch((err) => {
        console.log(err);
        res.status(500).send(err);
    });

Models

ClientConfig

This model has the following attributes.

Attribute Type Description
apiKey string The API Key for the TextMe platform.
senderId string The sender ID associated with TextMe account.

SMSResponse

This model has the following attributes.

Attribute Type Description
status string The status code of the response.
message string The status message of the response.
data SMSResponseData The data portion of the response.

SMSResponseData

This model has the following attributes.

Attribute Type Description
uid string The UID of the message.
to string The recipient of the message.
from SMSResponseData The sender of the message.
message SMSResponseData The message string.
status SMSResponseData The message status.
cost SMSResponseData The cost of the message.

ViewAllSMSResponse

This model has the following attributes.

Attribute Type Description
status string The status code of the response.
message string The status message of the response.
data AllSMSData The data portion of the response.

AllSMSData

This model has the following attributes.

Attribute Type Description
current_page number The current index of the page.
data SMSResponseData[] The data array of the response.
first_page_url string The URL of the first page of the results.
from string The sender.
last_page number The index of the last page of results.
links AllSMSLink Pagination URL list.
next_page_url string The URL of the next page of the results.
path string The base URL of the API request.
per_page number Results per page.
prev_page_url string The URL of the previous page of the results.
to number The recipient of the message.
total string The total number of pages.

AllSMSLink

This model has the following attributes.

Attribute Type Description
url `null string`
label string The pagination page number.
active boolean If the URL is active or not

Develop

Prerequisites

  • Node.js (version 10 or above).
  • npm package manager.

Installing Dependencies

The repository is a mono repository. The SDK repository is found in the lib directory. You can install the dependencies by running the following command at the root.

npm run build

Contribute

Please read Contributing to the Code Base for details on our code of conduct, and the process for submitting pull requests to us.

Reporting issues

We encourage you to report issues, improvements, and feature requests creating Github Issues.

Important: And please be advised that security issues must be reported to [email protected], not as GitHub issues, in order to reach the proper audience. We strongly advise following the Iconicto Security Vulnerability Reporting Guidelines when reporting the security issues.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

You might also like...

why make apps to increase focus -- when you can make apps to reduce focus

impossifocus 🕺 What is this? ImpossiFocus will measure focus by reading your brainwaves -- and if you're in the zone, it'll ensure that changes with

Nov 30, 2022

A Serverless GraphQL Sample project using Apollo and Serverless Framework with TypeScript and Webpack.

Serverless GraphQL Boilerplate This is a base project with a structure that includes Serverless Framework, Apollo, TypeScript and Webpack. It can be d

Aug 23, 2022

Three.js boilerplate project configured with typescript, webpack and css/style loader, HTTPS local server, and a sample test codes !!

Three.js boilerplate project configured with typescript, webpack and css/style loader, HTTPS local server, and a sample test codes !!

three.js-boilerplate Welcome, this is a three.js boilerplate project where you can clone it and start to work !!! Installed and Configured Items: Type

Jul 6, 2022

Short sample and instructions for configuring a Flutter Web application to deploy-on-push to Firebase Hosting

Short sample and instructions for configuring a Flutter Web application to deploy-on-push to Firebase Hosting

Nov 17, 2022

JavaScript Express.js app serving static vanilla JS. This sample app is used in Microsoft Docs to demonstrate how to integrate Azure Storage, Azure Cosmos DB, and Azure Active Directory.

JavaScript on Azure Learn Path - Module 2 - Deploying a basic app to Azure This Learn module requires the following Azure resources to deploy correctl

Dec 31, 2022

Utility for authorizing user in a connected app, creating JWT to authenticate against it, and perform a sample callout.

Question: What is this for? Answer: When configuring a Salesforce Connected app to use certificates to authenticate you will use JSON Web Tokens to a

Jun 15, 2022

A sample CICD Deployment Pipeline for your Alexa Skills, using AWS CDK, CodeBuild and CodePipeline

A sample CICD Deployment Pipeline for your Alexa Skills, using AWS CDK, CodeBuild and CodePipeline

Alexa Skils - CI/CD CDK Pipeline This repository will help you setting up a CI/CD pipeline for your Alexa Skills. This pipeline is powered by AWS Clou

Nov 23, 2022

A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM deffiniation and appropriate file structure.

Welcome to function-stencil 👋 A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM

Jun 20, 2022

A simple site to generate useful resources for Gitpodification, including "open in gitpod" buttons and sample configuration scripts

Gitpodify A simple portal to generate "open in Gitpod" links Contributing There is a list of suggested repositories in app/routes/index.tsx. Feel free

Nov 7, 2022
Owner
Iconicto
Iconicto
Monitor incoming SMS for SMS-codes, add them to clipboard

MacOs only. Monitors SMS for codes, adds them to the clipboard. Monitors Messages SQLite file ~/Library/Messages/chat.db for new messages, uses regexp

Ilya Kantor 3 Sep 23, 2022
Sample apps showing how to build music and video apps for Xbox using a WebView.

description languages name page_type products urlFragment Sample showing how to build music and video apps using primarily web technologies for Xbox.

Microsoft 11 Dec 14, 2022
Twilio sample codes for inbound and outbound using sdk.

Description Twilio inbound outbound framework boilerplate. This boilerplate contains features like outbound calls, inbound calls, recordings, get reco

Harris Gurung 5 Sep 22, 2022
Verify your E-Mail and Phone Number using link sent over mail and sms.

Phone-and-Mail-Verification-With-Link Verify your E-Mail and Phone Number using link sent over mail and sms. Endpoints POST /user/create Body { "n

Prasoon Soni 5 Sep 14, 2022
Verify your E-Mail and Phone Number using link sent over mail and sms.

Send Verification Link ✅ Explore the docs » • Report Bug • Request Feature • About The Project Verify your E-Mail and Phone Number using link sent ove

Prasoon Soni 4 Jun 28, 2022
Movehat is a TypeScript SDK for Move on Sui built on top of Sui's TypeScript SDK and our fork of Ian Macalinao's `move-ts`.

Movehat Movehat is a TypeScript SDK for Move on Sui built on top of Sui's TypeScript SDK and our fork of Ian Macalinao's move-ts. Movehat aspires to b

Pentagon 10 Sep 30, 2022
A full NodeJS sms-activate.org api wrapper up to date in Typescript

Sms-Activate.org This package fully supports all the https://sms-activate.org/ API with Typescript types. Installation Install the package using npm

SegFault 52 Dec 26, 2022
The iofod SDK provides developers with the ability to interact with the main iofod interface within the Web worker, enabling rapid development of iofod extensions through the SDK.

iofod-sdk English | 简体中文 The iofod SDK provides developers with the ability to interact with the main iofod interface within the Web worker, enabling

iofod, Inc. 47 Oct 17, 2022
This repository contains an Advanced Zoom Apps Sample. It should serve as a starting point for you to build and test your own Zoom App in development.

Advanced Zoom Apps Sample Advanced Sample covers most complex scenarios that you might be needed in apps. App has reference implementation for: Authen

Zoom 11 Dec 17, 2022
Open apps directly in GNOME Software by clicking Install from Flathub and apps.gnome.

Flatline Open apps directly in GNOME Software by clicking Install from Flathub and apps.gnome. Load the extension in Firefox Clone the repository Open

Cleo Menezes Jr. 43 Nov 7, 2022