### Get Email Campaigns List and Details (C#) Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Fetch a list of email campaigns or the details of a specific campaign by its ID. Authentication is handled via API key and secret. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Lista campagne EmailCampaignsListResponse campaigns = client.getEmailCampaignsList(offset: 0, limit: 10); if (campaigns != null && campaigns.StatusCode >= 200 && campaigns.StatusCode <= 299) { foreach (var camp in campaigns.EmailCampaignsResult?.Campaigns ?? new List()) { Console.WriteLine($"Campagna: {camp.Title} | Stato: {camp.Status}"); } } // Dettaglio singola campagna EmailCampaignResponse campaignDetail = client.getEmailCampaign("id-campagna-001"); if (campaignDetail != null && campaignDetail.StatusCode >= 200 && campaignDetail.StatusCode <= 299) { Console.WriteLine("Aperture: " + campaignDetail.EmailCampaign?.Stats?.OpenCount); } ``` -------------------------------- ### Get User Information and Account Credit with Smshosting C# Client Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieves information about the authenticated Smshosting user, including their remaining SMS credit balance. Handles authentication errors. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); UserResponse userRes = client.getUser(); if (userRes != null && userRes.StatusCode >= 200 && userRes.StatusCode <= 299) { Console.WriteLine("Username: " + userRes.User?.Username); Console.WriteLine("Credito SMS: " + userRes.User?.SmsCredit); Console.WriteLine("Email: " + userRes.User?.Email); } else { Console.WriteLine("Errore autenticazione: " + userRes?.Message); } ``` -------------------------------- ### Get Email Details with Smshosting C# Client Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieves detailed information and tracking status for a specific sent email using its ID. This is a premium feature. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); EmailResponse emailDetail = client.getEmail("id-email-001"); if (emailDetail != null && emailDetail.StatusCode >= 200 && emailDetail.StatusCode <= 299) { Console.WriteLine($"Destinatario: {emailDetail.Email?.To}"); Console.WriteLine($"Stato: {emailDetail.Email?.Status}"); Console.WriteLine($"Aperta: {emailDetail.Email?.Opened}"); } ``` -------------------------------- ### Get Email Templates List and Details (C#) Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieve a paginated list of email templates or the details of a specific template by its ID. Requires API key and secret for authentication. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Lista template con paginazione EmailTemplatesListResponse templates = client.getEmailTemplatesList(offset: 0, limit: 20); if (templates != null && templates.StatusCode >= 200 && templates.StatusCode <= 299) { foreach (var tmpl in templates.EmailTemplatesResult?.Templates ?? new List()) { Console.WriteLine($"Template: {tmpl.Name} | ID: {tmpl.Id}"); } } // Dettaglio singolo template EmailTemplateResponse templateDetail = client.getEmailTemplate("id-template-001"); if (templateDetail != null && templateDetail.StatusCode >= 200 && templateDetail.StatusCode <= 299) { Console.WriteLine("HTML template: " + templateDetail.EmailTemplate?.Html?.Substring(0, 100)); } ``` -------------------------------- ### Get All Contact Groups Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieve a list of all groups in the phonebook. Useful for managing contacts and their associations. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Lista di tutti i gruppi GroupListResponse groups = client.getGroupList(); if (groups != null && groups.StatusCode >= 200 && groups.StatusCode <= 299) { foreach (var grp in groups.GroupList?.Groups ?? new List()) { Console.WriteLine($"Gruppo: {grp.Name} | ID: {grp.Id} | Contatti: {grp.ContactCount}"); } } ``` -------------------------------- ### Get Email Sender List using SmshClient Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieves a list of verified and enabled email senders for the account. This feature is exclusive to Premium plans with special permissions. Iterate through the list and display sender details. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); EmailSenderResponse senders = client.getEmailSenderList(); if (senders != null && senders.StatusCode >= 200 && senders.StatusCode <= 299) { foreach (var sender in senders.EmailSenderList?.Senders ?? new List()) { Console.WriteLine($"Mittente: {sender.Email} | Nome: {sender.Name}"); } } ``` -------------------------------- ### Get Specific Contact Group Details Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieve the details of a specific contact group by its ID. Requires the group ID as a parameter. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Dettaglio singolo gruppo GroupResponse singleGroup = client.getGroup("id-gruppo-123"); if (singleGroup != null && singleGroup.StatusCode >= 200 && singleGroup.StatusCode <= 299) { Console.WriteLine("Nome gruppo: " + singleGroup.Group?.Name); } ``` -------------------------------- ### Get Group Contacts using SmshClient Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieves a paginated list of contacts belonging to a specific group. Ensure the group ID is correct and handle potential null responses. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); ContactSearchResponse groupContacts = client.getGroupContacts( id: "id-gruppo-456", offset: 0, limit: 100 ); if (groupContacts != null && groupContacts.StatusCode >= 200 && groupContacts.StatusCode <= 299) { foreach (var c in groupContacts.ContactSearchResult?.Contacts ?? new List()) { Console.WriteLine($"{c.Name} {c.Lastname} | Tel: {c.Msisdn}"); } } ``` -------------------------------- ### Search and Get Contacts using SmshClient Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Searches contacts by phone number or custom fields, or retrieves a single contact by ID. If no parameters are provided to searchContacts, it returns all contacts. Handle null responses and check status codes. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Ricerca per numero di telefono ContactSearchResponse byPhone = client.searchContacts( name: null, msisdn: "393471234567", fieldKey: null, fieldValue: null, email: null, offset: null, limit: null ); // Ricerca per campo personalizzato ContactSearchResponse byField = client.searchContacts( name: null, msisdn: null, fieldKey: "codice_cliente", fieldValue: "CC-001", email: null, offset: 0, limit: 10 ); // Recupero contatto per ID ContactResponse contact = client.getContact("id-contatto-789"); if (contact != null && contact.StatusCode >= 200 && contact.StatusCode <= 299) { Console.WriteLine($"Nome: {contact.Contact?.Name} | Email: {contact.Contact?.Email}"); } ``` -------------------------------- ### SmshClient Initialization Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Demonstrates how to create an instance of the SmshClient class using API credentials. Supports both standard and custom host initialization. ```APIDOC ## Initialization Create an instance of `SmshClient` with your API key and secret. A custom host can be provided as an optional third parameter. ### Code Example ```csharp using smshosting.api.cs.client; // Standard initialization (uses https://api.smshosting.it) SmshClient client = new SmshClient("LA_MIA_API_KEY", "IL_MIO_API_SECRET"); // Initialization with a custom host SmshClient clientCustom = new SmshClient("LA_MIA_API_KEY", "IL_MIO_API_SECRET", "https://api.smshosting.it"); ``` ``` -------------------------------- ### Initialize SmshClient Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Instantiate the SmshClient with API credentials. An optional custom host can be provided. ```csharp using smshosting.api.cs.client; // Inizializzazione standard (usa https://api.smshosting.it) SmshClient client = new SmshClient("LA_MIA_API_KEY", "IL_MIO_API_SECRET"); // Inizializzazione con host personalizzato SmshClient clientCustom = new SmshClient("LA_MIA_API_KEY", "IL_MIO_API_SECRET", "https://api.smshosting.it"); ``` -------------------------------- ### getSimForReceiveSmsList Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Recupera l'elenco di tutti i servizi di inoltro SMS attivi sull'account, utile per conoscere i numeri SIM configurati per la ricezione. ```APIDOC ## `getSimForReceiveSmsList` — Lista SIM attive per ricezione SMS Recupera l'elenco di tutti i servizi di inoltro SMS attivi sull'account, utile per conoscere i numeri SIM configurati per la ricezione. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); SmsReceivedSearchResponseList simList = client.getSimForReceiveSmsList(); if (simList != null && simList.StatusCode >= 200 && simList.StatusCode <= 299) { foreach (var sim in simList.SmsReceivedSimResponseList?.SimList ?? new List()) { Console.WriteLine($"SIM ID: {sim.Id} | Numero: {sim.Msisdn}"); } } ``` ``` -------------------------------- ### Manage Sender Aliases with Smshosting C# Client Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Demonstrates creating, retrieving, and deleting sender aliases (sender names) registered on the account. Alias creation requires complete business data for legal validation. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Creazione alias AliasResponse newAlias = client.createAlias( alias: "MiaAzienda", businessname: "Mia Azienda S.r.l.", address: "Via Roma, 1", city: "Milano", postcode: "20100", province: "MI", country: "IT", vatnumber: "IT12345678901", email: "admin@miazienda.it", phone: "0212345678", taxcode: "MIAAZN80A01F205Z", pec: "miazienda@pec.it" ); Console.WriteLine("Alias creato: " + newAlias?.Alias?.AliasName); // Lista alias registrati AliasListResponse aliasList = client.getAlias(); foreach (var a in aliasList?.AliasList?.Aliases ?? new List()) { Console.WriteLine($"Alias: {a.AliasName} | ID: {a.Id}"); } // Eliminazione alias GenericResponse deletedAlias = client.deleteAlias("id-alias-001"); Console.WriteLine("Eliminazione status: " + deletedAlias?.StatusCode); ``` -------------------------------- ### searchSmsReceived Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Recupera la lista degli SMS ricevuti da una SIM configurata, filtrando per mittente, ID SIM o intervallo di date. Supporta la paginazione. ```APIDOC ## `searchSmsReceived` — Ricerca SMS ricevuti dalla SIM Recupera la lista degli SMS ricevuti da una SIM configurata, filtrando per mittente, ID SIM o intervallo di date. Supporta la paginazione. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); SmsReceivedSearchResponse receivedRes = client.searchSmsReceived( from: "393471234567", simIdRef: null, fromDate: "2024-06-01T00:00:00+0200", toDate: "2024-06-30T23:59:59+0200", offset: 0, limit: 20 ); if (receivedRes != null && receivedRes.StatusCode >= 200 && receivedRes.StatusCode <= 299) { foreach (var sms in receivedRes.SmsReceivedResult?.SmsList ?? new List()) { Console.WriteLine($"Da: {sms.From} | Testo: {sms.Text} | Ricevuto: {sms.ReceiveDate}"); } } ``` ``` -------------------------------- ### Send Email Campaign (C#) Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Send an email campaign to a group of contacts using a predefined template. Supports tracking, scheduling, and sandbox mode. Requires API credentials. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); SendEmailCampaignResponse campaignRes = client.sendEmailCampaign( templateId: "id-template-001", from: "noreply@miazienda.it", fromName: "Mia Azienda", group: "id-gruppo-clienti", subject: "Newsletter Dicembre 2024", subjectPreviewText: "Le nostre offerte di fine anno!", campaignTitle: "Newsletter_Dicembre_2024", enableOpenTracking: true, enableLinkTracking: true, date: null, // null = invio immediato sandbox: false ); if (campaignRes != null && campaignRes.StatusCode >= 200 && campaignRes.StatusCode <= 299) { Console.WriteLine("Campagna avviata. ID: " + campaignRes.EmailResult?.Id); } else { Console.WriteLine("Errore campagna: " + campaignRes?.Message); } ``` -------------------------------- ### addGroup / updateGroup / deleteGroup Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Permette di creare un nuovo gruppo nella rubrica, aggiornarne il nome o eliminarlo (con l'opzione di eliminare anche i contatti associati). ```APIDOC ## `addGroup` / `updateGroup` / `deleteGroup` — Creazione, modifica ed eliminazione di un gruppo Permette di creare un nuovo gruppo nella rubrica, aggiornarne il nome o eliminarlo (con l'opzione di eliminare anche i contatti associati). ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Creazione nuovo gruppo GroupResponse newGroup = client.addGroup("Clienti VIP"); Console.WriteLine("Nuovo gruppo ID: " + newGroup?.Group?.Id); // Aggiornamento nome gruppo GroupResponse updated = client.updateGroup("id-gruppo-123", "Clienti Premium"); Console.WriteLine("Aggiornamento status: " + updated?.StatusCode); // Eliminazione gruppo (senza eliminare i contatti) GenericResponse deleted = client.deleteGroup("id-gruppo-123", deleteContacts: false); Console.WriteLine("Eliminazione status: " + deleted?.StatusCode); ``` ``` -------------------------------- ### getGroupList / getGroup Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Recupera tutti i gruppi della rubrica telefonica o i dettagli di un gruppo specifico tramite il suo ID. ```APIDOC ## `getGroupList` / `getGroup` — Gestione gruppi della rubrica Recupera tutti i gruppi della rubrica telefonica o i dettagli di un gruppo specifico tramite il suo ID. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Lista di tutti i gruppi GroupListResponse groups = client.getGroupList(); if (groups != null && groups.StatusCode >= 200 && groups.StatusCode <= 299) { foreach (var grp in groups.GroupList?.Groups ?? new List()) { Console.WriteLine($"Gruppo: {grp.Name} | ID: {grp.Id} | Contatti: {grp.ContactCount}"); } } // Dettaglio singolo gruppo GroupResponse singleGroup = client.getGroup("id-gruppo-123"); if (singleGroup != null && singleGroup.StatusCode >= 200 && singleGroup.StatusCode <= 299) { Console.WriteLine("Nome gruppo: " + singleGroup.Group?.Name); } ``` ``` -------------------------------- ### Gestione degli errori nella risposta SMS Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Verifica il StatusCode e il Message dell'oggetto SendSmsResponse per identificare e gestire vari tipi di errori, inclusi quelli di autenticazione, credito insufficiente, testo non valido e destinatari non validi. Assicurati che la libreria sia inizializzata correttamente con le credenziali API. ```csharp using smshosting.api.cs.client; using smshosting.api.cs.client.model; using smshosting.api.cs.client.utilities; SmshClient client = new SmshClient("API_KEY", "API_SECRET"); SendSmsResponse res = client.sendSms("Mittente", "393471234567", null, "Testo SMS", null, null, false, null, "AUTO"); if (res == null) { Console.WriteLine("Errore di rete o eccezione non gestita."); } else if (res.StatusCode == Errors.STATUS_CODE_BAD_REQUEST) // 400 { // Errori di validazione lato client switch (res.Message) { case Errors.ERROR_MSG_AUTH_CREDENTIALS: // "BAD_CREDENTIALS" Console.WriteLine("Credenziali API non valide."); break; case Errors.ERROR_MSG_SEND_NO_CREDIT: // "NO_CREDIT" Console.WriteLine("Credito insufficiente."); break; case Errors.ERROR_MSG_SEND_TEXT: // "BAD_TEXT" Console.WriteLine("Testo SMS non valido."); break; case Errors.ERROR_MSG_SEND_RECIPIENT: // "NO_VALID_RECIPIENT" Console.WriteLine("Nessun destinatario valido."); break; default: Console.WriteLine("Errore validazione: " + res.Message); break; } } else if (res.StatusCode >= 200 && res.StatusCode <= 299) { Console.WriteLine("Operazione completata con successo."); } else { Console.WriteLine($"Errore server HTTP {res.StatusCode}: {res.Message}"); } ``` -------------------------------- ### getUser Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieves the authenticated Smshosting user's information, including the remaining credit available for sending messages. ```APIDOC ## getUser ### Description Retrieves the authenticated Smshosting user's information, including the remaining credit available for sending messages. ### Method ```csharp UserResponse userRes = client.getUser(); ``` ### Parameters This method does not require any parameters. ``` -------------------------------- ### Create a New Contact Group Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Create a new group in the phonebook. Requires the desired group name as a parameter. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Creazione nuovo gruppo GroupResponse newGroup = client.addGroup("Clienti VIP"); Console.WriteLine("Nuovo gruppo ID: " + newGroup?.Group?.Id); ``` -------------------------------- ### Add Contact using SmshClient Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Adds a new contact to the address book, supporting custom fields and group associations. The `customFieldUniqueKey` parameter is used to identify duplicates. Ensure to check the response status code for success or failure. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); var campiPersonalizzati = new Dictionary { { "codice_cliente", "CC-001" }, { "citta", "Milano" } }; ContactResponse newContact = client.addContact( msisdn: "393471234567", name: "Mario", lastname: "Rossi", email: "mario.rossi@esempio.it", groupsId: "gruppo-id-123,gruppo-id-456", customFields: campiPersonalizzati, customFieldUniqueKey: "msisdn" ); if (newContact != null && newContact.StatusCode >= 200 && newContact.StatusCode <= 299) { Console.WriteLine("Contatto creato con ID: " + newContact.Contact?.Id); } else { Console.WriteLine("Errore: " + newContact?.Message); } ``` -------------------------------- ### Email Campaigns Management Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieve the list of email campaigns created on the account or the details of a specific campaign. This is a Premium feature. ```APIDOC ## `getEmailCampaignsList` / `getEmailCampaign` — Gestione campagne email Recupera la lista delle campagne email create sull'account o i dettagli di una campagna specifica. Funzionalità Premium. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Lista campagne EmailCampaignsListResponse campaigns = client.getEmailCampaignsList(offset: 0, limit: 10); if (campaigns != null && campaigns.StatusCode >= 200 && campaigns.StatusCode <= 299) { foreach (var camp in campaigns.EmailCampaignsResult?.Campaigns ?? new List()) { Console.WriteLine($"Campagna: {camp.Title} | Stato: {camp.Status}"); } } // Dettaglio singola campagna EmailCampaignResponse campaignDetail = client.getEmailCampaign("id-campagna-001"); if (campaignDetail != null && campaignDetail.StatusCode >= 200 && campaignDetail.StatusCode <= 299) { Console.WriteLine("Aperture: " + campaignDetail.EmailCampaign?.Stats?.OpenCount); } ``` ``` -------------------------------- ### getEmailSenderList Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieves a list of verified and enabled email senders for the account. This feature is exclusive to Premium plans with special permissions. ```APIDOC ## getEmailSenderList — Lista mittenti email abilitati Recupera la lista dei mittenti email verificati e abilitati sull'account. Questa funzionalità è disponibile esclusivamente nei piani Premium con permessi speciali. ### Method GET (assumed, based on client method name) ### Endpoint (Not explicitly provided, inferred from client method) ### Parameters None ### Request Example ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); EmailSenderResponse senders = client.getEmailSenderList(); ``` ### Response #### Success Response (200) - **StatusCode** (integer) - HTTP status code. - **EmailSenderList** (object) - Contains the list of email senders. - **Senders** (array) - List of EmailSender objects. - **Email** (string) - The sender's email address. - **Name** (string) - The sender's name. #### Response Example ```json { "StatusCode": 200, "EmailSenderList": { "Senders": [ { "Email": "sender@example.com", "Name": "Example Sender" } ] } } ``` ``` -------------------------------- ### Send Email Campaign Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Send an email campaign to a group of contacts using a predefined template. Supports open/link tracking, scheduled sending, and sandbox mode. This is a Premium feature. ```APIDOC ## `sendEmailCampaign` — Invio campagna email a un gruppo Invia una campagna email a un intero gruppo di contatti utilizzando un template predefinito. Supporta tracking aperture/link, invio schedulato e modalità sandbox. Funzionalità Premium. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); SendEmailCampaignResponse campaignRes = client.sendEmailCampaign( templateId: "id-template-001", from: "noreply@miazienda.it", fromName: "Mia Azienda", group: "id-gruppo-clienti", subject: "Newsletter Dicembre 2024", subjectPreviewText: "Le nostre offerte di fine anno!", campaignTitle: "Newsletter_Dicembre_2024", enableOpenTracking: true, enableLinkTracking: true, date: null, // null = invio immediato sandbox: false ); if (campaignRes != null && campaignRes.StatusCode >= 200 && campaignRes.StatusCode <= 299) { Console.WriteLine("Campagna avviata. ID: " + campaignRes.EmailResult?.Id); } else { Console.WriteLine("Errore campagna: " + campaignRes?.Message); } ``` ``` -------------------------------- ### searchSms Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Recupera i dettagli degli SMS inviati filtrabili per ID, ID transazione, numero destinatario, intervallo di date e stato. Supporta la paginazione tramite `offset` e `limit`. ```APIDOC ## `searchSms` — Ricerca e dettagli degli SMS inviati Recupera i dettagli degli SMS inviati filtrabili per ID, ID transazione, numero destinatario, intervallo di date e stato. Supporta la paginazione tramite `offset` e `limit`. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Ricerca per intervallo di date e stato SmsSearchResponse searchRes = client.searchSms( id: null, transactionId: null, msisdn: null, fromDate: "2024-01-01T00:00:00+0100", toDate: "2024-01-31T23:59:59+0100", status: "DELIVERED", offset: 0, limit: 50 ); if (searchRes != null && searchRes.StatusCode >= 200 && searchRes.StatusCode <= 299) { foreach (var sms in searchRes.SmsSearchResult?.SmsList ?? new List()) { Console.WriteLine($"ID: {sms.Id} | Destinatario: {sms.Msisdn} | Stato: {sms.Status}"); } } // Ricerca per numero destinatario SmsSearchResponse byMsisdn = client.searchSms( id: null, transactionId: null, msisdn: "393471234567", fromDate: null, toDate: null, status: null, offset: null, limit: null ); ``` ``` -------------------------------- ### Email Templates Management Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieve a paginated list of available email templates or the details of a specific template by ID. This is a Premium feature. ```APIDOC ## `getEmailTemplatesList` / `getEmailTemplate` — Gestione template email Recupera la lista paginata dei template email disponibili sull'account o i dettagli di un template specifico tramite ID. Funzionalità Premium. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Lista template con paginazione EmailTemplatesListResponse templates = client.getEmailTemplatesList(offset: 0, limit: 20); if (templates != null && templates.StatusCode >= 200 && templates.StatusCode <= 299) { foreach (var tmpl in templates.EmailTemplatesResult?.Templates ?? new List()) { Console.WriteLine($"Template: {tmpl.Name} | ID: {tmpl.Id}"); } } // Dettaglio singolo template EmailTemplateResponse templateDetail = client.getEmailTemplate("id-template-001"); if (templateDetail != null && templateDetail.StatusCode >= 200 && templateDetail.StatusCode <= 299) { Console.WriteLine("HTML template: " + templateDetail.EmailTemplate?.Html?.Substring(0, 100)); } ``` ``` -------------------------------- ### Send Single Email (C#) Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Send a transactional email to a single recipient or a restricted list (up to 50) with optional per-recipient personalization. Requires API key and secret. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Invio a destinatario singolo SendEmailCampaignResponse singleRes = client.sendSingleEmail( templateId: "id-template-002", from: "noreply@miazienda.it", fromName: "Supporto Mia Azienda", to: "cliente@esempio.it", subject: "Conferma ordine #12345", subjectPreviewText: "Il tuo ordine è stato confermato", enableOpenTracking: true, enableLinkTracking: false, date: null, sandbox: false ); // Invio a lista con personalizzazione per destinatario (max 50) string destinatariJson = "[{\"to\":\"mario.rossi@esempio.it\",\"f_s_nome\":\"Mario\"},{\"to\":\"anna.verdi@esempio.it\",\"f_s_nome\":\"Anna\"}]"; SendEmailCampaignResponse multiRes = client.sendSingleEmail( templateId: "id-template-003", from: "promo@miazienda.it", fromName: "Promozioni", to: destinatariJson, subject: "Offerta personale per te", subjectPreviewText: null, enableOpenTracking: true, enableLinkTracking: true, date: "2024-12-20T09:00:00+0100", sandbox: false ); Console.WriteLine("Email singola status: " + multiRes?.StatusCode); ``` -------------------------------- ### createAlias, getAlias, deleteAlias Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Manage SMS sender aliases (sender names) registered to the account. Creation requires complete business data for legal validation. ```APIDOC ## createAlias / getAlias / deleteAlias ### Description Manages SMS sender aliases (sender names) registered to the account. Creation requires complete business data for legal validation. ### Methods #### Create Alias ```csharp AliasResponse newAlias = client.createAlias( alias: "MiaAzienda", businessname: "Mia Azienda S.r.l.", address: "Via Roma, 1", city: "Milano", postcode: "20100", province: "MI", country: "IT", vatnumber: "IT12345678901", email: "admin@miazienda.it", phone: "0212345678", taxcode: "MIAAZN80A01F205Z", pec: "miazienda@pec.it" ); ``` #### Get Aliases ```csharp AliasListResponse aliasList = client.getAlias(); ``` #### Delete Alias ```csharp GenericResponse deletedAlias = client.deleteAlias("id-alias-001"); ``` ### Parameters #### createAlias * **alias** (string) - Required - The desired alias name. * **businessname** (string) - Required - The full business name. * **address** (string) - Required - The business address. * **city** (string) - Required - The business city. * **postcode** (string) - Required - The business postcode. * **province** (string) - Required - The business province. * **country** (string) - Required - The business country. * **vatnumber** (string) - Required - The business VAT number. * **email** (string) - Required - The business email address. * **phone** (string) - Required - The business phone number. * **taxcode** (string) - Required - The business tax code. * **pec** (string) - Required - The business PEC address. #### deleteAlias * **id** (string) - Required - The ID of the alias to delete. ``` -------------------------------- ### List Active SIMs for Receiving SMS Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieve a list of all active SMS forwarding services on the account, useful for identifying configured SIM numbers for receiving messages. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); SmsReceivedSearchResponseList simList = client.getSimForReceiveSmsList(); if (simList != null && simList.StatusCode >= 200 && simList.StatusCode <= 299) { foreach (var sim in simList.SmsReceivedSimResponseList?.SimList ?? new List()) { Console.WriteLine($"SIM ID: {sim.Id} | Numero: {sim.Msisdn}"); } } ``` -------------------------------- ### cancelSms Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Annulla un SMS schedulato non ancora inviato, identificabile tramite ID messaggio o ID transazione personalizzato. ```APIDOC ## `cancelSms` — Annullamento di un SMS in attesa Annulla un SMS schedulato non ancora inviato, identificabile tramite ID messaggio o ID transazione personalizzato. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Annullamento tramite ID transazione CancelSmsResponse cancelRes = client.cancelSms( id: null, transactionId: "TXN-001" ); if (cancelRes != null && cancelRes.StatusCode >= 200 && cancelRes.StatusCode <= 299) { Console.WriteLine("SMS annullati: " + cancelRes.SmsList?.Sms?.Count); } else { Console.WriteLine("Errore annullamento: " + cancelRes?.Message); } ``` ``` -------------------------------- ### addContact Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Adds a new contact to the address book with support for custom fields and association with existing groups. The `customFieldUniqueKey` parameter specifies the field used to identify duplicates. ```APIDOC ## addContact — Creazione di un nuovo contatto Aggiunge un nuovo contatto alla rubrica con supporto per campi personalizzati (passati come dizionario chiave/valore) e associazione a gruppi esistenti. Il parametro `customFieldUniqueKey` definisce il campo usato per identificare i duplicati. ### Method POST (assumed, based on client method name for creation) ### Endpoint (Not explicitly provided, inferred from client method) ### Parameters #### Request Body - **msisdn** (string) - Required - Contact's phone number. - **name** (string) - Optional - Contact's first name. - **lastname** (string) - Optional - Contact's last name. - **email** (string) - Optional - Contact's email address. - **groupsId** (string) - Optional - Comma-separated list of group IDs to associate the contact with. - **customFields** (object) - Optional - A dictionary of custom fields (key-value pairs). - **customFieldUniqueKey** (string) - Optional - The key of the custom field to use for identifying duplicates. ### Request Example ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); var campiPersonalizzati = new Dictionary { { "codice_cliente", "CC-001" }, { "citta", "Milano" } }; ContactResponse newContact = client.addContact( msisdn: "393471234567", name: "Mario", lastname: "Rossi", email: "mario.rossi@esempio.it", groupsId: "gruppo-id-123,gruppo-id-456", customFields: campiPersonalizzati, customFieldUniqueKey: "msisdn" ); ``` ### Response #### Success Response (200) - **StatusCode** (integer) - HTTP status code. - **Contact** (object) - The newly created contact object. - **Id** (string) - The unique identifier of the created contact. #### Error Response - **StatusCode** (integer) - HTTP status code. - **Message** (string) - Error message describing the issue. #### Response Example ```json { "StatusCode": 200, "Contact": { "Id": "nuovo-id-contatto-123" } } ``` ``` -------------------------------- ### getEmail Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieves the information and tracking of a specific sent email using its ID. This is a Premium feature. ```APIDOC ## getEmail ### Description Retrieves the information and tracking of a specific sent email using its ID. This is a Premium feature. ### Method ```csharp EmailResponse emailDetail = client.getEmail("id-email-001"); ``` ### Parameters * **id** (string) - Required - The ID of the email to retrieve. ``` -------------------------------- ### searchContacts / getContact Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Searches contacts by name, phone number, email, or custom fields. If no parameters are provided, it returns a paginated list of all contacts. It can also retrieve a specific contact by its ID. ```APIDOC ## searchContacts / getContact — Ricerca e recupero contatti Cerca contatti nella rubrica per nome, numero di telefono, email o campi personalizzati. Se nessun parametro è fornito, restituisce la lista paginata di tutti i contatti. ### Method GET (assumed for search/get operations) ### Endpoint (Not explicitly provided, inferred from client method) ### Parameters for searchContacts #### Query Parameters - **name** (string) - Optional - Contact's name. - **msisdn** (string) - Optional - Contact's phone number. - **fieldKey** (string) - Optional - The key of a custom field. - **fieldValue** (string) - Optional - The value of a custom field. - **email** (string) - Optional - Contact's email address. - **offset** (integer) - Optional - The number of contacts to skip. - **limit** (integer) - Optional - The maximum number of contacts to return. ### Parameters for getContact #### Path Parameters - **id** (string) - Required - The ID of the contact to retrieve. ### Request Example (searchContacts by phone) ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); ContactSearchResponse byPhone = client.searchContacts( name: null, msisdn: "393471234567", fieldKey: null, fieldValue: null, email: null, offset: null, limit: null ); ``` ### Request Example (getContact by ID) ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); ContactResponse contact = client.getContact("id-contatto-789"); ``` ### Response (for searchContacts) #### Success Response (200) - **StatusCode** (integer) - HTTP status code. - **ContactSearchResult** (object) - Contains the list of contacts. - **Contacts** (array) - List of Contact objects. ### Response (for getContact) #### Success Response (200) - **StatusCode** (integer) - HTTP status code. - **Contact** (object) - The contact object. - **Name** (string) - Contact's name. - **Email** (string) - Contact's email address. - **Id** (string) - Contact's ID. #### Response Example (getContact) ```json { "StatusCode": 200, "Contact": { "Id": "id-contatto-789", "Name": "Mario", "Email": "mario.rossi@esempio.it" } } ``` ``` -------------------------------- ### Estimate SMS Campaign Cost Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Calculate the estimated cost of an SMS campaign before sending. Specify sender, recipients (number or group), text, and encoding. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); EstimateResponse estimate = client.estimateSendSms( from: "MioMittente", to: null, group: "gruppo-id-456", text: "Testo della campagna promozionale con offerta speciale.", encoding: "AUTO" ); if (estimate != null && estimate.StatusCode >= 200 && estimate.StatusCode <= 299) { Console.WriteLine("Costo stimato: " + estimate.Estimate?.Cost); Console.WriteLine("Numero destinatari: " + estimate.Estimate?.Recipients); } ``` -------------------------------- ### Send Bulk SMS Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Asynchronously send SMS to 1000+ recipients. Supports transaction and delivery status callbacks. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); SendSmsBulkResponse resBulk = client.sendSmsBulk( from: "Campagna", to: "393471234567,393487654321,393412345678", group: null, text: "Promozione esclusiva: sconto 30% fino al 31/12!", sendDate: null, transactionId: "BULK-TXN-2024-001", sandbox: false, statusCallback: "https://miosito.it/callback/sms-delivery", transactionCallback: "https://miosito.it/callback/bulk-status", encoding: "AUTO" ); if (resBulk != null && resBulk.StatusCode >= 200 && resBulk.StatusCode <= 299) { Console.WriteLine("Invio bulk avviato. ID transazione: " + resBulk.SmsBulkResult?.TransactionId); } else { Console.WriteLine("Errore invio bulk: " + resBulk?.Message); } ``` -------------------------------- ### Send Single Email Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Send a transactional email to one or more recipients (up to 50) specified individually or as a JSON array with personalization fields. This is a Premium feature. ```APIDOC ## `sendSingleEmail` — Invio email singola o a lista ristretta Invia un'email transazionale a uno o più destinatari (massimo 50) specificati singolarmente o come array JSON con campi di personalizzazione. Funzionalità Premium. ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); // Invio a destinatario singolo SendEmailCampaignResponse singleRes = client.sendSingleEmail( templateId: "id-template-002", from: "noreply@miazienda.it", fromName: "Supporto Mia Azienda", to: "cliente@esempio.it", subject: "Conferma ordine #12345", subjectPreviewText: "Il tuo ordine è stato confermato", enableOpenTracking: true, enableLinkTracking: false, date: null, sandbox: false ); // Invio a lista con personalizzazione per destinatario (max 50) string destinatariJson = "[{"to":"mario.rossi@esempio.it","f_s_nome":"Mario"},{"to":"anna.verdi@esempio.it","f_s_nome":"Anna"}]"; SendEmailCampaignResponse multiRes = client.sendSingleEmail( templateId: "id-template-003", from: "promo@miazienda.it", fromName: "Promozioni", to: destinatariJson, subject: "Offerta personale per te", subjectPreviewText: null, enableOpenTracking: true, enableLinkTracking: true, date: "2024-12-20T09:00:00+0100", sandbox: false ); Console.WriteLine("Email singola status: " + multiRes?.StatusCode); ``` ``` -------------------------------- ### estimateSendSms - Estimate SMS Campaign Cost Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Calculates the estimated cost of an SMS campaign before sending, specifying sender, recipients, text, and encoding. ```APIDOC ## estimateSendSms — Estimate SMS Campaign Cost Calculates the estimated cost of an SMS campaign before actual sending by specifying sender, recipients (direct number or group), text, and encoding. ### Parameters - **from** (string) - Required - The sender ID. - **to** (string) - Optional - The recipient's phone number. - **group** (string) - Optional - The ID of the group to send to. - **text** (string) - Required - The content of the SMS message. - **encoding** (string) - Optional - The text encoding (e.g., "AUTO", "7BIT"). ### Request Example ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); EstimateResponse estimate = client.estimateSendSms( from: "MioMittente", to: null, group: "gruppo-id-456", text: "Testo della campagna promozionale con offerta speciale.", encoding: "AUTO" ); if (estimate != null && estimate.StatusCode >= 200 && estimate.StatusCode <= 299) { Console.WriteLine("Costo stimato: " + estimate.Estimate?.Cost); Console.WriteLine("Numero destinatari: " + estimate.Estimate?.Recipients); } ``` ### Response - **StatusCode** (int) - The HTTP status code of the response. - **Message** (string) - An error message if the request failed. - **Estimate** (object) - Contains the estimated cost and number of recipients for the campaign. ``` -------------------------------- ### getGroupContacts Source: https://context7.com/smshosting/smshosting-api-cs-client/llms.txt Retrieves a paginated list of contacts belonging to a specific group. ```APIDOC ## getGroupContacts — Contatti di un gruppo Recupera la lista paginata dei contatti appartenenti a uno specifico gruppo. ### Method GET (assumed, based on client method name) ### Endpoint (Not explicitly provided, inferred from client method) ### Parameters #### Query Parameters - **id** (string) - Required - The ID of the group. - **offset** (integer) - Optional - The number of contacts to skip. - **limit** (integer) - Optional - The maximum number of contacts to return. ### Request Example ```csharp SmshClient client = new SmshClient("API_KEY", "API_SECRET"); ContactSearchResponse groupContacts = client.getGroupContacts( id: "id-gruppo-456", offset: 0, limit: 100 ); ``` ### Response #### Success Response (200) - **StatusCode** (integer) - HTTP status code. - **ContactSearchResult** (object) - Contains the list of contacts. - **Contacts** (array) - List of Contact objects. - **Name** (string) - Contact's name. - **Lastname** (string) - Contact's last name. - **Msisdn** (string) - Contact's phone number. #### Response Example ```json { "StatusCode": 200, "ContactSearchResult": { "Contacts": [ { "Name": "Mario", "Lastname": "Rossi", "Msisdn": "393471234567" } ] } } ``` ```