Skip to content

messente/messente-api-csharp

Repository files navigation

Messente API Library

  • Messente API version: 2.0.0
  • C# package version: 3.2.0

Messente is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds tools to help organizations connect their services to people anywhere in the world.

Installation

Install Messente API library via NuGet Package Manager or .NET CLI.

Package Manager

Install-Package com.Messente.Api -Version 3.2.0

.NET CLI

dotnet add package com.Messente.Api --version 3.2.0

Features

Messente API has the following features:

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

BlacklistApi

  1. Adds a phone number to the blacklist AddToBlacklist
  2. Deletes a phone number from the blacklist DeleteFromBlacklist
  3. Returns all blacklisted phone numbers FetchBlacklist
  4. Checks if a phone number is blacklisted IsBlacklisted

BulkMessagingApi

  1. Sends a bulk Omnimessage SendBulkOmnimessage

ContactsApi

  1. Adds a contact to a group AddContactToGroup
  2. Creates a new contact CreateContact
  3. Deletes a contact DeleteContact
  4. Lists a contact FetchContact
  5. Lists groups of a contact FetchContactGroups
  6. Returns all contacts FetchContacts
  7. Removes a contact from a group RemoveContactFromGroup
  8. Updates a contact UpdateContact

DeliveryReportApi

  1. Retrieves the delivery report for the Omnimessage RetrieveDeliveryReport

GroupsApi

  1. Creates a new group with the provided name CreateGroup
  2. Deletes a group DeleteGroup
  3. Lists a group FetchGroup
  4. Returns all groups FetchGroups
  5. Updates a group with the provided name UpdateGroup

NumberLookupApi

  1. Requests info about phone numbers FetchInfo

OmnimessageApi

  1. Cancels a scheduled Omnimessage CancelScheduledMessage
  2. Sends an Omnimessage SendOmnimessage

StatisticsApi

  1. Requests statistics reports for each country CreateStatisticsReport

Auth

Type: HTTP basic authentication

Read the external getting-started article which explains API keys and Sender ID logic.

Getting started: sending an omnimessage

// PM > Install-Package com.Messente.Api

using System;
using com.Messente.Api.Api;
using com.Messente.Api.Client;
using com.Messente.Api.Model;

namespace Example
{
    public class SendOmniMessageExample
    {
        public static void Main()
        {
            Configuration conf = new Configuration
            {
                Username = "YOUR_MESSENTE_API_USERNAME",
                Password = "YOUR_MESSENTE_API_PASSWORD"
            };

            var apiInstance = new OmnimessageApi(conf);

            var sms = new SMS(sender: "<sender name (optional)>", text: "Hello SMS!");
            OmnimessageMessagesInner smsOmnimessageInner = new OmnimessageMessagesInner(sms)
            {
                ActualInstance = sms
            };

            var viber = new Viber(sender: "<sender name (optional)>", text: "Hello viber!");
            OmnimessageMessagesInner viberOmnimessageInner = new OmnimessageMessagesInner(viber)
            {
                ActualInstance = viber
            };

            WhatsAppParameter whatsAppParameter = new WhatsAppParameter(
                type: "text",
                text: "hello whatsapp"
            );

            WhatsAppComponent whatsAppComponent = new WhatsAppComponent(
                type: "body",
                parameters: new List<WhatsAppParameter> { whatsAppParameter }
            );

            WhatsAppTemplate whatsAppTemplate = new WhatsAppTemplate(
                name: "<template_name>",
                language: new WhatsAppLanguage(code: "<language_code>"),
                components: new List<WhatsAppComponent> { whatsAppComponent }
            );

            var whatsapp = new WhatsApp(
                sender: "<sender name (optional)>",
                template: whatsAppTemplate
            );

            OmnimessageMessagesInner whatsAppOmnimessageInner = new OmnimessageMessagesInner(whatsapp)
            {
                ActualInstance = whatsapp
            };

            var omnimessage = new Omnimessage(
                to: "<recipient_phone_number>",
                messages: new List<OmnimessageMessagesInner> {
                    smsOmnimessageInner,
                    viberOmnimessageInner,
                    whatsAppOmnimessageInner
                }
            );

            try
            {
                var result = apiInstance.SendOmnimessage(omnimessage);
                Console.WriteLine(result.ToJson());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling SendOmnimessage: " + e.Message);
            }
        }
    }
}

License

Apache-2.0

Terms

https://messente.com/terms-and-conditions