Coder Social home page Coder Social logo

apiv3-nodejs-library's Introduction

[DEPRECATED:warning:] sib-api-v3-sdk

Here are the new SDK details:

SendinBlue's API v3 Node.js Library

SendinBlue's API exposes the entire SendinBlue features via a standardized programmatic interface. Please refer to the full documentation to learn more.

This is the wrapper for the API. It implements all the features of the API v3. It supports promises.

SendinBlue's API matches the OpenAPI v2 definition. The specification can be downloaded here.

This library is automatically generated by the Swagger Codegen project and is reviewed and maintained by SendinBlue:

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install sib-api-v3-sdk --save
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your sib-api-v3-sdk from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('sib-api-v3-sdk') in javascript files from the directory you ran the last command above from.

git

If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var SibApiV3Sdk = require('sib-api-v3-sdk');

var defaultClient = SibApiV3Sdk.ApiClient.instance;

// Configure API key authorization: api-key
var apiKey = defaultClient.authentications['api-key'];
apiKey.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix['api-key'] = "Token"

// Configure API key authorization: partner-key
var partnerKey = defaultClient.authentications['partner-key'];
partnerKey.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//partnerKey.apiKeyPrefix['partner-key'] = "Token"

var api = new SibApiV3Sdk.AccountApi()
api.getAccount().then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to https://api.sendinblue.com/v3

Class Method HTTP request Description
SibApiV3Sdk.AccountApi getAccount GET /account Get your account information, plan and credits details
SibApiV3Sdk.CompaniesApi companiesAttributesGet GET /companies/attributes Get company attributes
SibApiV3Sdk.CompaniesApi companiesGet GET /companies Get all companies
SibApiV3Sdk.CompaniesApi companiesIdDelete DELETE /companies/{id} Delete a company
SibApiV3Sdk.CompaniesApi companiesIdGet GET /companies/{id} Get a company
SibApiV3Sdk.CompaniesApi companiesIdPatch PATCH /companies/{id} Update a company
SibApiV3Sdk.CompaniesApi companiesLinkUnlinkIdPatch PATCH /companies/link-unlink/{id} Link and Unlink company with contacts and deals
SibApiV3Sdk.CompaniesApi companiesPost POST /companies Create a company
SibApiV3Sdk.ContactsApi addContactToList POST /contacts/lists/{listId}/contacts/add Add existing contacts to a list
SibApiV3Sdk.ContactsApi createAttribute POST /contacts/attributes/{attributeCategory}/{attributeName} Create contact attribute
SibApiV3Sdk.ContactsApi createContact POST /contacts Create a contact
SibApiV3Sdk.ContactsApi createDoiContact POST /contacts/doubleOptinConfirmation Create Contact via DOI (Double-Opt-In) Flow
SibApiV3Sdk.ContactsApi createFolder POST /contacts/folders Create a folder
SibApiV3Sdk.ContactsApi createList POST /contacts/lists Create a list
SibApiV3Sdk.ContactsApi deleteAttribute DELETE /contacts/attributes/{attributeCategory}/{attributeName} Delete an attribute
SibApiV3Sdk.ContactsApi deleteContact DELETE /contacts/{identifier} Delete a contact
SibApiV3Sdk.ContactsApi deleteFolder DELETE /contacts/folders/{folderId} Delete a folder (and all its lists)
SibApiV3Sdk.ContactsApi deleteList DELETE /contacts/lists/{listId} Delete a list
SibApiV3Sdk.ContactsApi getAttributes GET /contacts/attributes List all attributes
SibApiV3Sdk.ContactsApi getContactInfo GET /contacts/{identifier} Get a contact's details
SibApiV3Sdk.ContactsApi getContactStats GET /contacts/{identifier}/campaignStats Get email campaigns' statistics for a contact
SibApiV3Sdk.ContactsApi getContacts GET /contacts Get all the contacts
SibApiV3Sdk.ContactsApi getContactsFromList GET /contacts/lists/{listId}/contacts Get contacts in a list
SibApiV3Sdk.ContactsApi getFolder GET /contacts/folders/{folderId} Returns a folder's details
SibApiV3Sdk.ContactsApi getFolderLists GET /contacts/folders/{folderId}/lists Get lists in a folder
SibApiV3Sdk.ContactsApi getFolders GET /contacts/folders Get all folders
SibApiV3Sdk.ContactsApi getList GET /contacts/lists/{listId} Get a list's details
SibApiV3Sdk.ContactsApi getLists GET /contacts/lists Get all the lists
SibApiV3Sdk.ContactsApi importContacts POST /contacts/import Import contacts
SibApiV3Sdk.ContactsApi removeContactFromList POST /contacts/lists/{listId}/contacts/remove Delete a contact from a list
SibApiV3Sdk.ContactsApi requestContactExport POST /contacts/export Export contacts
SibApiV3Sdk.ContactsApi updateAttribute PUT /contacts/attributes/{attributeCategory}/{attributeName} Update contact attribute
SibApiV3Sdk.ContactsApi updateBatchContacts POST /contacts/batch Update multiple contacts
SibApiV3Sdk.ContactsApi updateContact PUT /contacts/{identifier} Update a contact
SibApiV3Sdk.ContactsApi updateFolder PUT /contacts/folders/{folderId} Update a folder
SibApiV3Sdk.ContactsApi updateList PUT /contacts/lists/{listId} Update a list
SibApiV3Sdk.ConversationsApi conversationsAgentOnlinePingPost POST /conversations/agentOnlinePing Sets agent’s status to online for 2-3 minutes
SibApiV3Sdk.ConversationsApi conversationsMessagesIdDelete DELETE /conversations/messages/{id} Delete a message sent by an agent
SibApiV3Sdk.ConversationsApi conversationsMessagesIdGet GET /conversations/messages/{id} Get a message
SibApiV3Sdk.ConversationsApi conversationsMessagesIdPut PUT /conversations/messages/{id} Update a message sent by an agent
SibApiV3Sdk.ConversationsApi conversationsMessagesPost POST /conversations/messages Send a message as an agent
SibApiV3Sdk.ConversationsApi conversationsPushedMessagesIdDelete DELETE /conversations/pushedMessages/{id} Delete an automated message
SibApiV3Sdk.ConversationsApi conversationsPushedMessagesIdGet GET /conversations/pushedMessages/{id} Get an automated message
SibApiV3Sdk.ConversationsApi conversationsPushedMessagesIdPut PUT /conversations/pushedMessages/{id} Update an automated message
SibApiV3Sdk.ConversationsApi conversationsPushedMessagesPost POST /conversations/pushedMessages Send an automated message to a visitor
SibApiV3Sdk.DealsApi crmAttributesDealsGet GET /crm/attributes/deals Get deal attributes
SibApiV3Sdk.DealsApi crmDealsGet GET /crm/deals Get all deals
SibApiV3Sdk.DealsApi crmDealsIdDelete DELETE /crm/deals/{id} Delete a deal
SibApiV3Sdk.DealsApi crmDealsIdGet GET /crm/deals/{id} Get a deal
SibApiV3Sdk.DealsApi crmDealsIdPatch PATCH /crm/deals/{id} Update a deal
SibApiV3Sdk.DealsApi crmDealsLinkUnlinkIdPatch PATCH /crm/deals/link-unlink/{id} Link and Unlink a deal with contacts and companies
SibApiV3Sdk.DealsApi crmDealsPost POST /crm/deals Create a deal
SibApiV3Sdk.DealsApi crmPipelineDetailsGet GET /crm/pipeline/details Get pipeline stages
SibApiV3Sdk.EmailCampaignsApi createEmailCampaign POST /emailCampaigns Create an email campaign
SibApiV3Sdk.EmailCampaignsApi deleteEmailCampaign DELETE /emailCampaigns/{campaignId} Delete an email campaign
SibApiV3Sdk.EmailCampaignsApi emailExportRecipients POST /emailCampaigns/{campaignId}/exportRecipients Export the recipients of an email campaign
SibApiV3Sdk.EmailCampaignsApi getAbTestCampaignResult GET /emailCampaigns/{campaignId}/abTestCampaignResult Get an A/B test email campaign results
SibApiV3Sdk.EmailCampaignsApi getEmailCampaign GET /emailCampaigns/{campaignId} Get an email campaign report
SibApiV3Sdk.EmailCampaignsApi getEmailCampaigns GET /emailCampaigns Return all your created email campaigns
SibApiV3Sdk.EmailCampaignsApi getSharedTemplateUrl GET /emailCampaigns/{campaignId}/sharedUrl Get a shared template url
SibApiV3Sdk.EmailCampaignsApi sendEmailCampaignNow POST /emailCampaigns/{campaignId}/sendNow Send an email campaign immediately, based on campaignId
SibApiV3Sdk.EmailCampaignsApi sendReport POST /emailCampaigns/{campaignId}/sendReport Send the report of a campaign
SibApiV3Sdk.EmailCampaignsApi sendTestEmail POST /emailCampaigns/{campaignId}/sendTest Send an email campaign to your test list
SibApiV3Sdk.EmailCampaignsApi updateCampaignStatus PUT /emailCampaigns/{campaignId}/status Update an email campaign status
SibApiV3Sdk.EmailCampaignsApi updateEmailCampaign PUT /emailCampaigns/{campaignId} Update an email campaign
SibApiV3Sdk.EmailCampaignsApi uploadImageToGallery POST /emailCampaigns/images Upload an image to your account's image gallery
SibApiV3Sdk.FilesApi crmFilesGet GET /crm/files Get all files
SibApiV3Sdk.FilesApi crmFilesIdDataGet GET /crm/files/{id}/data Get file details
SibApiV3Sdk.FilesApi crmFilesIdDelete DELETE /crm/files/{id} Delete a file
SibApiV3Sdk.FilesApi crmFilesIdGet GET /crm/files/{id} Download a file
SibApiV3Sdk.FilesApi crmFilesPost POST /crm/files Upload a file
SibApiV3Sdk.InboundParsingApi getInboundEmailAttachment GET /inbound/attachments/{downloadToken} Retrieve inbound attachment with download token.
SibApiV3Sdk.InboundParsingApi getInboundEmailEvents GET /inbound/events Get the list of all the events for the received emails.
SibApiV3Sdk.InboundParsingApi getInboundEmailEventsByUuid GET /inbound/events/{uuid} Fetch all events history for one particular received email.
SibApiV3Sdk.MasterAccountApi corporateMasterAccountGet GET /corporate/masterAccount Get the details of requested master account
SibApiV3Sdk.MasterAccountApi corporateSubAccountGet GET /corporate/subAccount Get the list of all the sub-accounts of the master account.
SibApiV3Sdk.MasterAccountApi corporateSubAccountIdDelete DELETE /corporate/subAccount/{id} Delete a sub-account
SibApiV3Sdk.MasterAccountApi corporateSubAccountIdGet GET /corporate/subAccount/{id} Get sub-account details
SibApiV3Sdk.MasterAccountApi corporateSubAccountIdPlanPut PUT /corporate/subAccount/{id}/plan Update sub-account plan
SibApiV3Sdk.MasterAccountApi corporateSubAccountPost POST /corporate/subAccount Create a new sub-account under a master account.
SibApiV3Sdk.MasterAccountApi corporateSubAccountSsoTokenPost POST /corporate/subAccount/ssoToken Generate SSO token to access Sendinblue
SibApiV3Sdk.NotesApi crmNotesGet GET /crm/notes Get all notes
SibApiV3Sdk.NotesApi crmNotesIdDelete DELETE /crm/notes/{id} Delete a note
SibApiV3Sdk.NotesApi crmNotesIdGet GET /crm/notes/{id} Get a note
SibApiV3Sdk.NotesApi crmNotesIdPatch PATCH /crm/notes/{id} Update a note
SibApiV3Sdk.NotesApi crmNotesPost POST /crm/notes Create a note
SibApiV3Sdk.ProcessApi getProcess GET /processes/{processId} Return the informations for a process
SibApiV3Sdk.ProcessApi getProcesses GET /processes Return all the processes for your account
SibApiV3Sdk.ResellerApi addCredits POST /reseller/children/{childIdentifier}/credits/add Add Email and/or SMS credits to a specific child account
SibApiV3Sdk.ResellerApi associateIpToChild POST /reseller/children/{childIdentifier}/ips/associate Associate a dedicated IP to the child
SibApiV3Sdk.ResellerApi createChildDomain POST /reseller/children/{childIdentifier}/domains Create a domain for a child account
SibApiV3Sdk.ResellerApi createResellerChild POST /reseller/children Creates a reseller child
SibApiV3Sdk.ResellerApi deleteChildDomain DELETE /reseller/children/{childIdentifier}/domains/{domainName} Delete the sender domain of the reseller child based on the childIdentifier and domainName passed
SibApiV3Sdk.ResellerApi deleteResellerChild DELETE /reseller/children/{childIdentifier} Delete a single reseller child based on the child identifier supplied
SibApiV3Sdk.ResellerApi dissociateIpFromChild POST /reseller/children/{childIdentifier}/ips/dissociate Dissociate a dedicated IP to the child
SibApiV3Sdk.ResellerApi getChildAccountCreationStatus GET /reseller/children/{childIdentifier}/accountCreationStatus Get the status of a reseller's child account creation, whether it is successfully created (exists) or not based on the identifier supplied
SibApiV3Sdk.ResellerApi getChildDomains GET /reseller/children/{childIdentifier}/domains Get all sender domains for a specific child account
SibApiV3Sdk.ResellerApi getChildInfo GET /reseller/children/{childIdentifier} Get a child account's details
SibApiV3Sdk.ResellerApi getResellerChilds GET /reseller/children Get the list of all children accounts
SibApiV3Sdk.ResellerApi getSsoToken GET /reseller/children/{childIdentifier}/auth Get session token to access Sendinblue (SSO)
SibApiV3Sdk.ResellerApi removeCredits POST /reseller/children/{childIdentifier}/credits/remove Remove Email and/or SMS credits from a specific child account
SibApiV3Sdk.ResellerApi updateChildAccountStatus PUT /reseller/children/{childIdentifier}/accountStatus Update info of reseller's child account status based on the childIdentifier supplied
SibApiV3Sdk.ResellerApi updateChildDomain PUT /reseller/children/{childIdentifier}/domains/{domainName} Update the sender domain of reseller's child based on the childIdentifier and domainName passed
SibApiV3Sdk.ResellerApi updateResellerChild PUT /reseller/children/{childIdentifier} Update info of reseller's child based on the child identifier supplied
SibApiV3Sdk.SMSCampaignsApi createSmsCampaign POST /smsCampaigns Creates an SMS campaign
SibApiV3Sdk.SMSCampaignsApi deleteSmsCampaign DELETE /smsCampaigns/{campaignId} Delete an SMS campaign
SibApiV3Sdk.SMSCampaignsApi getSmsCampaign GET /smsCampaigns/{campaignId} Get an SMS campaign
SibApiV3Sdk.SMSCampaignsApi getSmsCampaigns GET /smsCampaigns Returns the information for all your created SMS campaigns
SibApiV3Sdk.SMSCampaignsApi requestSmsRecipientExport POST /smsCampaigns/{campaignId}/exportRecipients Export an SMS campaign's recipients
SibApiV3Sdk.SMSCampaignsApi sendSmsCampaignNow POST /smsCampaigns/{campaignId}/sendNow Send your SMS campaign immediately
SibApiV3Sdk.SMSCampaignsApi sendSmsReport POST /smsCampaigns/{campaignId}/sendReport Send an SMS campaign's report
SibApiV3Sdk.SMSCampaignsApi sendTestSms POST /smsCampaigns/{campaignId}/sendTest Send a test SMS campaign
SibApiV3Sdk.SMSCampaignsApi updateSmsCampaign PUT /smsCampaigns/{campaignId} Update an SMS campaign
SibApiV3Sdk.SMSCampaignsApi updateSmsCampaignStatus PUT /smsCampaigns/{campaignId}/status Update a campaign's status
SibApiV3Sdk.SendersApi createSender POST /senders Create a new sender
SibApiV3Sdk.SendersApi deleteSender DELETE /senders/{senderId} Delete a sender
SibApiV3Sdk.SendersApi getIps GET /senders/ips Get all the dedicated IPs for your account
SibApiV3Sdk.SendersApi getIpsFromSender GET /senders/{senderId}/ips Get all the dedicated IPs for a sender
SibApiV3Sdk.SendersApi getSenders GET /senders Get the list of all your senders
SibApiV3Sdk.SendersApi updateSender PUT /senders/{senderId} Update a sender
SibApiV3Sdk.TasksApi crmTasksGet GET /crm/tasks Get all tasks
SibApiV3Sdk.TasksApi crmTasksIdDelete DELETE /crm/tasks/{id} Delete a task
SibApiV3Sdk.TasksApi crmTasksIdGet GET /crm/tasks/{id} Get a task
SibApiV3Sdk.TasksApi crmTasksIdPatch PATCH /crm/tasks/{id} Update a task
SibApiV3Sdk.TasksApi crmTasksPost POST /crm/tasks Create a task
SibApiV3Sdk.TasksApi crmTasktypesGet GET /crm/tasktypes Get all task types
SibApiV3Sdk.TransactionalEmailsApi blockNewDomain POST /smtp/blockedDomains Add a new domain to the list of blocked domains
SibApiV3Sdk.TransactionalEmailsApi createSmtpTemplate POST /smtp/templates Create an email template
SibApiV3Sdk.TransactionalEmailsApi deleteBlockedDomain DELETE /smtp/blockedDomains/{domain} Unblock an existing domain from the list of blocked domains
SibApiV3Sdk.TransactionalEmailsApi deleteHardbounces POST /smtp/deleteHardbounces Delete hardbounces
SibApiV3Sdk.TransactionalEmailsApi deleteScheduledEmailById DELETE /smtp/email/{identifier} Delete scheduled emails by batchId or messageId
SibApiV3Sdk.TransactionalEmailsApi deleteSmtpTemplate DELETE /smtp/templates/{templateId} Delete an inactive email template
SibApiV3Sdk.TransactionalEmailsApi getAggregatedSmtpReport GET /smtp/statistics/aggregatedReport Get your transactional email activity aggregated over a period of time
SibApiV3Sdk.TransactionalEmailsApi getBlockedDomains GET /smtp/blockedDomains Get the list of blocked domains
SibApiV3Sdk.TransactionalEmailsApi getEmailEventReport GET /smtp/statistics/events Get all your transactional email activity (unaggregated events)
SibApiV3Sdk.TransactionalEmailsApi getScheduledEmailByBatchId GET /smtp/emailStatus/{batchId} Fetch scheduled emails by batchId
SibApiV3Sdk.TransactionalEmailsApi getScheduledEmailByMessageId GET /smtp/emailStatus/{messageId} Fetch scheduled email by messageId
SibApiV3Sdk.TransactionalEmailsApi getSmtpReport GET /smtp/statistics/reports Get your transactional email activity aggregated per day
SibApiV3Sdk.TransactionalEmailsApi getSmtpTemplate GET /smtp/templates/{templateId} Returns the template information
SibApiV3Sdk.TransactionalEmailsApi getSmtpTemplates GET /smtp/templates Get the list of email templates
SibApiV3Sdk.TransactionalEmailsApi getTransacBlockedContacts GET /smtp/blockedContacts Get the list of blocked or unsubscribed transactional contacts
SibApiV3Sdk.TransactionalEmailsApi getTransacEmailContent GET /smtp/emails/{uuid} Get the personalized content of a sent transactional email
SibApiV3Sdk.TransactionalEmailsApi getTransacEmailsList GET /smtp/emails Get the list of transactional emails on the basis of allowed filters
SibApiV3Sdk.TransactionalEmailsApi sendTestTemplate POST /smtp/templates/{templateId}/sendTest Send a template to your test list
SibApiV3Sdk.TransactionalEmailsApi sendTransacEmail POST /smtp/email Send a transactional email
SibApiV3Sdk.TransactionalEmailsApi smtpBlockedContactsEmailDelete DELETE /smtp/blockedContacts/{email} Unblock or resubscribe a transactional contact
SibApiV3Sdk.TransactionalEmailsApi smtpLogMessageIdDelete DELETE /smtp/log/{messageId} Delete an SMTP transactional log
SibApiV3Sdk.TransactionalEmailsApi updateSmtpTemplate PUT /smtp/templates/{templateId} Update an email template
SibApiV3Sdk.TransactionalSMSApi getSmsEvents GET /transactionalSMS/statistics/events Get all your SMS activity (unaggregated events)
SibApiV3Sdk.TransactionalSMSApi getTransacAggregatedSmsReport GET /transactionalSMS/statistics/aggregatedReport Get your SMS activity aggregated over a period of time
SibApiV3Sdk.TransactionalSMSApi getTransacSmsReport GET /transactionalSMS/statistics/reports Get your SMS activity aggregated per day
SibApiV3Sdk.TransactionalSMSApi sendTransacSms POST /transactionalSMS/sms Send SMS message to a mobile number
SibApiV3Sdk.WebhooksApi createWebhook POST /webhooks Create a webhook
SibApiV3Sdk.WebhooksApi deleteWebhook DELETE /webhooks/{webhookId} Delete a webhook
SibApiV3Sdk.WebhooksApi getWebhook GET /webhooks/{webhookId} Get a webhook details
SibApiV3Sdk.WebhooksApi getWebhooks GET /webhooks Get all webhooks
SibApiV3Sdk.WebhooksApi updateWebhook PUT /webhooks/{webhookId} Update a webhook

Documentation for Models

Documentation for Authorization

api-key

  • Type: API key
  • API key parameter name: api-key
  • Location: HTTP header

partner-key

  • Type: API key
  • API key parameter name: partner-key
  • Location: HTTP header

apiv3-nodejs-library's People

Contributors

aakanksha-sib avatar aayush-sib avatar ekta-slit avatar haydenmacdonald avatar prasantkrsuman avatar shubhamupadhyayinblue avatar skynetsib avatar upadhyayshubham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apiv3-nodejs-library's Issues

sendTransacEmail 'Error: Forbidden'

I'm trying to send a transactional email with my new SendInBlue account and I keep receiving an error that simply says "Forbidden". I followed the example on the docs to write this code:

const SibApiV3Sdk = require('sib-api-v3-sdk');

const defaultClient = SibApiV3Sdk.ApiClient.instance;

// Configure API key authorization: api-key
const apiKey = defaultClient.authentications['api-key'];
apiKey.apiKey = 'xxx';
// Uncomment the following line to set a prefix for the API key, e.g. 'Token' (defaults to null)
//apiKey.apiKeyPrefix = 'Token'

// Configure API key authorization: partner-key
//const partnerKey = defaultClient.authentications['partner-key'];
//partnerKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. 'Token' (defaults to null)
//partnerKey.apiKeyPrefix['partner-key'] = 'Token'

const apiInstance = new SibApiV3Sdk.TransactionalEmailsApi();

const sendSmtpEmail = new SibApiV3Sdk.SendSmtpEmail(); // SendSmtpEmail | Values to send a transactional email

const sendEmail = async (to, subject, htmlBody, textBody) => {

    sendSmtpEmail.to = [{ email: to }];
    sendSmtpEmail.sender = { email: '[email protected]', name: 'Voluntime' };
    sendSmtpEmail.htmlContent = `<html><body style='text-align:center'><strong>Voluntime</strong><br><br><p style='width:90%;padding-left:5%;padding-right:5%'>${htmlBody}</p><br><br>You can update your email preferences for <a href='https://voluntime.mittaldev.com'>Voluntime</a> in the Account page.<br><span style='opacity:0'>${Date.now()}</span></body></html>`;
    sendSmtpEmail.textContent = `Voluntime:\n\n${textBody}\n\nYou can update your email preferences for Voluntime in the Account page.\n\nTimestamp: ${Date.now()}`;
    sendSmtpEmail.subject = `Voluntime - ${subject}`;
    sendSmtpEmail.replyTo = { email: '[email protected]' };

    const result = await apiInstance.sendTransacEmail(sendSmtpEmail);
    console.log(result);
    return result;
};


export { sendEmail };

The apiInstance.sendTransacEmail(sendSmtpEmail) line throws a 403 error that simply says "Forbidden". How do I fix this?

Enhancement request - simplifying API

Per the example kindly provided by @ekta-slit, this is how to send a transactional email:

var SibApiV3Sdk = require('sib-api-v3-sdk');

var defaultClient = SibApiV3Sdk.ApiClient.instance;
var apiKey = defaultClient.authentications['api-key'];
apiKey.apiKey = "YourApiV3Key"

var apiInstance = new SibApiV3Sdk.SMTPApi();

var sendSmtpEmail = new SibApiV3Sdk.SendSmtpEmail(); // SendSmtpEmail | Values to send a transactional email

sendSmtpEmail.to = [{ "email":"[email protected]", "name":"toName"}];
sendSmtpEmail.sender = { "email":"[email protected]", "name":"sender"};
sendSmtpEmail.htmlContent = "This is test content";
sendSmtpEmail.subject = "My Subject";
sendSmtpEmail.headers = {"x-mailin-custom":"myV3Custom" };
sendSmtpEmail.tags = ["myTag1","myTag2"];
sendSmtpEmail.attachment =  [{"url": "https://example.com/ValidimageUrl1.jpg"},{"url": "https://example.com/ValidimageUrl2.jpg"}]

apiInstance.sendTransacEmail(sendSmtpEmail).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Even though this works, there's no obvious connection between SibApiV3Sdk.ApiClient.instance and SibApiV3Sdk.SMTPApi. Also, it seems like there are more steps than there should be.

Here's a mockup of how I'd like the API to work (adapted for NodeJS 10+)...

const sibApi = require('sib-api-v3-sdk');

const sendTransactionalEmailExample = async () => {
   try {
      const apiClientInstance = sibApi.ApiClient.instance;
      apiClientInstance.apiKey = 'REPLACE-WITH-YOUR-API-KEY';
      const data = await apiClientInstance.sendTransactionalEmail({
         to: [{ email: '[email protected]', name: 'toName' }],
         sender: { email: '[email protected]', name: 'sender' },
         headers: { 'x-mailin-custom': 'myV3Custom' };
         htmlContent: 'This is test content',
         subject: 'My Subject',
         tags: ['myTag1', 'myTag2'],
         attachment: [
            { url: 'https://example.com/ValidimageUrl1.jpg' },
            { url: 'https://example.com/ValidimageUrl2.jpg' }
         ]
      });
      return data;
   } catch(err) {
      console.error(err);
      throw err;
   }
}

The main differences are:

  • sendTransacEmail() renamed to sendTransactionalEmail()
  • sendTransactionalEmail() is associated with require('sib-api-v3-sdk').ApiClient.instance
  • The apiKey is a direct property of ApiClient.instance
  • sendTransactionalEmail() provides a constructor - no need to use require('sib-api-v3-sdk').SMTPApi() or .SendSmtpEmail()
  • 4 API statements to send a transactional email vs. 14 in what's needed currently.

How to schedule a email for particular date-time?

How to schedule a email for particular date-time, for example when i schedule it for 2nd Jan at 02PM, that email should send at that time, i did not found in github readme or documentation,

and also if its possible then it is possible to cancel scheduled for that particular time?

Error in sdk

There is an error on the npm package

Error: Cannot find module './model/RequestSmsRecipientExport'

when we install the package on linux with npm the filename is : RequestSMSRecipientExport.js that's why there is an error.

Please exemples

Can you provide usage exemple of this node js sdk? This kind of tool should save time and without exemples it's not the case

Thanks in advance

Send transactional email BAD REQUEST

Hi, I'm unable to send a transactional email, does a complete example exists to do that?
No template.
sib-api-v3-sdk = 6.0.0.

Following the existing example:

        this.sendSmtpEmail.sender = new this.SibApiV3Sdk.SendSmtpEmailSender();
        this.sendSmtpEmail.sender.name = "name";
        this.sendSmtpEmail.sender.email = "[email protected]";

        this.sendSmtpEmail.replyTo = new this.SibApiV3Sdk.SendSmtpEmailReplyTo();
        this.sendSmtpEmail.replyTo.name = "name";
        this.sendSmtpEmail.replyTo.email = "[email protected]";

        this.sendSmtpEmail.subject = "subject";

        this.sendSmtpEmail.htmlContent = '<p>test</p>';
        this.sendSmtpEmail.textContent = 'please, use an email agent that support html';

        this.sendSmtpEmail.to = new this.SibApiV3Sdk.SendSmtpEmailTo();
        this.sendSmtpEmail.to.name = "[email protected]";
        this.sendSmtpEmail.to.email = "[email protected]";


        /*i tried whit this : same error*/
        let body = {"sender":{"name":"nozone","email":def.from},
                    "replyTo":{"email":def.from,"name":"nozone"},
                    "subject":def.subject,
                    "htmlContent":`<p>test</p>`,
                    "textContent":'please, use an email agent that support html',
                    "to":{"email":def.to,"name":def.to}};

            await this.apiInstance.sendTransacEmail(this.sendSmtpEmail); //bad request received

smtpBlacklistSender not working well

Trying to set smtpBlacklistSender = [] or [''] on a contact doesnt re enable a blacklisted user
Also there is no way to see if that property is set via the web ui, nor the api response of getContactInfo...

[BUG] sendTransacSms Always return "Only alphanumeric characters are allowed"

I try to send an SMS with values below : I remove all accent and I also try with +3367023xxxx as recipient number.

{
sender: 'CHERRY C',
recipient: '003367023xxxx',
content: 'Vous avez gagne le concours Cherry Checkout grace a votre Don Connectez vous sur cherrycheckout pour recevoir votre prix',
tag: 'winner'
}

The Api return which error code and message if we have no Sms credits ?

sendSmtpEmail.tags results in both "tag" and "tags" being passed in webhook

Hi,

I am using this API and a SendInBlue webhook to forward events to a MySQL db. When transactional emails are tagged using sendSmtpEmail.tags (via an array of strings), the webhook returns an event that has both tag and tags.

// Configure tag
    let tags = { 
      "subject": 1,
      "theme": "light",
      "greeting": 1,
      "image": 1,
      "phrase": 1
    };

// Assign stringified tags object in array to tags property
sendSmtpEmail.tags = [ JSON.stringify(tags) ];

webhook-tags-twice

I want to just receive the tags array. Is there something I can do to prevent tag from being passed by the webhook?

v 3.1.6 Initialisation error

while using the new version 3.1.6

the module can not be initialized.

Cannot find module './model/RequestSmsRecipientExport' at require (internal/module.js:20:19) at exports.ApiClient (........./sib-api-v3-sdk/src/index.js:23:4527) at Object. (........./sib-api-v3-sdk/src/index.js:25:2)

Module not found: Can't resolve 'ApiClient' in ...\node_modules\sib-api-v3-sdk\src'

Following the basic instructions, after running npm install sib-api-v3-sdk --save and then pasting in `var SibApiV3Sdk = require('sib-api-v3-sdk');

var defaultClient = SibApiV3Sdk.ApiClient.instance;` I get the error mentioned in the title. It seems to me like this is an error within the API, but I could also be doing something wrong. Does anyone have any suggestions?

sendTemplate attributes don't appear to work

sendTransacEmail with the 'params' key works fine. However, using sendTemplate with 'attributes' leaves {{ }} tokens blank in the final email.

Tried: {{ attributes.attributeName }}, {{ params.attributeName }}, {{ attributeName }} and all are left blank.

How to add an attribute when create a new contact

Hi,

I am struggling to add the attribute propriety while I am creating a new contact.

I would like to add the first name while someone subscribing to the newsletter, how can I do that?

I tried to add the attribute in the options and in the body but it did not work,

const options = {
    method: 'POST',
    headers: {
      "accept": 'application/json',
      "content-type": 'application/json',
      "api-key": 'xkeysib-73505412b....'
    },
    attributes : {
      "FNAME" : input.name
    },
    body: '{"listIds":[2],"updateEnabled":false,"emailBlacklisted":true,"smsBlacklisted":false,"email":'+JSON.stringify(input.email)+'}'
  };

Thank you

Raw error dumped on error using sendTransac() - ErrorModel not used.

When one follows the example at https://github.com/sendinblue/APIv3-nodejs-library/blob/master/docs/SMTPApi.md#sendTransacEmail but there is a problem with the request (such as a bad template id, for instance), then the entire error object is dumped in the console.

Apparently, the ErrorModel object is not used; see https://github.com/sendinblue/APIv3-nodejs-library/blob/master/src/api/SMTPApi.js#L655 and https://github.com/sendinblue/APIv3-nodejs-library/blob/master/src/api/SMTPApi.js#L670 which use https://github.com/sendinblue/APIv3-nodejs-library/blob/master/src/ApiClient.js#L471, where the error is simply passed as-is.

By contrast, in the PHP SDK, the conversion seems to be made correctly: https://github.com/sendinblue/APIv3-php-library/blob/master/lib/Api/SMTPApi.php#L2999.

Enhancement request - constructors

Per @ekta-slit, this is an example of how to send a transactional email:

var SibApiV3Sdk = require('sib-api-v3-sdk');

var defaultClient = SibApiV3Sdk.ApiClient.instance;
var apiKey = defaultClient.authentications['api-key'];
apiKey.apiKey = "YourApiV3Key"

var apiInstance = new SibApiV3Sdk.SMTPApi();

var sendSmtpEmail = new SibApiV3Sdk.SendSmtpEmail(); // SendSmtpEmail | Values to send a transactional email

sendSmtpEmail.to = [{ "email":"[email protected]", "name":"toName"}];
sendSmtpEmail.sender = { "email":"[email protected]", "name":"sender"};
sendSmtpEmail.htmlContent = "This is test content";
sendSmtpEmail.subject = "My Subject";
sendSmtpEmail.headers = {"x-mailin-custom":"myV3Custom" };
sendSmtpEmail.tags = ["myTag1","myTag2"];
sendSmtpEmail.attachment =  [{"url": "https://example.com/ValidimageUrl1.jpg"},{"url": "https://example.com/ValidimageUrl2.jpg"}]

apiInstance.sendTransacEmail(sendSmtpEmail).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Would like to request support for a constructors like this:

let sendSmtpEmail =  new SibApiV3Sdk.SendSmtpEmail({
    to: [{ email: '[email protected]', name: 'toName'}],
    sender: { email: '[email protected]', name: 'sender'},
    htmlContent: 'This is test content',
    subject: 'My Subject',
    tags: ['myTag1', 'myTag2']
  });

Thanks,
Nate

Send Template

Hi!

I can not send mail with SendTemplate:

    const apiInstance = new SibApiV3Sdk.SMTPApi();

    apiInstance.sendTemplate(123, {
            emailTo: '[email protected]'
        })

Result:

{"code":"invalid_parameter","message":"valid emailTo is required"}

Of course, I provide a valid mail when I run the process.

Enhancement request - batch sendTransacEmail with specific params

Hello,

We can send transactional email to an array of recipient now. This is really useful to send notification after an event for example.

However I need to provide each recipient a dedicated unsubscribe link. A generic unsubscribe button would unsubscribe then from notification from other event.

To do this I would like to add a param for each target like :
"to":[ { "email":"[email protected]", "name":"Jane Doe", "params": { "unsubscribe": "http://my.domain/api/notification/customTokenForJane", } ],
edited from :

Maybe I missed something but such a feature would be useful in my case.
Thanks

Error type returned not the good one

Hi there,
I got a problem with the error type returned. i used the code below :

apiInstance.createContact(createContact).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.log(error.code);
});

But when i console log the error i got this :

Error: Unsuccessful HTTP response
at S. (bundle.js?ver=1.08:10)
at S.n.emit (bundle.js?ver=1.08:10)
at XMLHttpRequest.e.onreadystatechange (bundle.js?ver=1.08:10)

In your documentation the error code may have a message and a code but here i can't find them.

do you have suggestion to find them ?

Best Regards,

GUERARD Léo

TypeError: Cannot read property 'instance' of undefined

Hi, I'm using the nodejs library for my MeteorJS project. However following the getting started guide gives the following error:

TypeError: Cannot read property 'instance' of undefined

Requiring the package is not the issue, it seems like that apiClient is not recognized and therefore the instance is not available.

Anybody any suggestion, I would really like to switch to sendinblue.

Sendinblue create contact 'TypeError: Failed to fetch' error (using React)

I am trying to implement the Sendinblue API in my React JS application. I have a text input that the user is to enter their email into, and then a button that will add their email to a Sendinblue list. I am using the "Create a contact" reference located here in Node.js, as I am using the JavaScript code for my React app. Sometimes, this code works, as the email is successfully added to the SendinBlue list, however most times the email is not added and I receive the following error:

var request = require("request");

My full code is seen below:

var options = {
  method: 'POST',
  url: 'https://api.sendinblue.com/v3/contacts',
  headers: {
    accept: 'application/json',
    'content-type': 'application/json',
    'api-key': 'My SendinBlue Application API Key'
  },
  body: {updateEnabled: false, email: '[email protected]'},
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

When I test this on the Sendinblue API docs, it successfully adds the email to my contact list every time. I test it with a new email each time to ensure that it does not throw an error because of a duplicate email. I have also tinkered with the value of updateEnabled between true and false however it does not seem to help solve this issue.

I believe that the error may stem from the var request = require("request"); command in the first line, as I am not sure if require is a React method or a Node.js method.

If anyone has any ideas on how I could fix this, your help would be greatly appreciated. Thank you.

Error: unable to get local issuer certificate

I use sendTransacEmail, but i got only

{ Error: unable to get local issuer certificate at TLSSocket.<anonymous> (_tls_wrap.js:1116:38) at emitNone (events.js:106:13) at TLSSocket.emit (events.js:208:7) at TLSSocket._finishInit (_tls_wrap.js:643:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38) code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY', response: undefined }

There is nothing in the official documentation about this problem, nor about certificates.
Why can there be a problem?

Add inline images complete example in Node.js - SMTP SendEmail

Everything works just fine for the sending email functionality but the documentation is clearly lacking some strong, and complete examples, a good one would be how to add inline-images inside an email. The example here, from the sendinblue apidocs is solid, but unfortunately it's for an older version. And doesn't seem to work in v3.

What interests me most is to add images with their base64 encodings.
Similar to:

"html" : "This is the <h1>HTML</h1>
	This is inline image 1.<br/>
	<img src=\"{myinlineimage1.png}\" alt=\"image1\" border=\"0\"><br/>		Some text<br/>		This is inline image 2.<br/>		<img src=\"{myinlineimage2.jpg}\" alt=\"image2\" border=\"0\"><br/>
	Some more text<br/>
	Re-used inline image 1.<br/>
	<img src=\"{myinlineimage1.png}\" alt=\"image3\" border=\"0\">",
"attachment" : {"myfilename.pdf":"your_pdf_files_base64_encoded_chunk_data"},
"headers" : {"Content-Type": "text/html;charset=iso-8859-1","X-param1": "value1", "X-param2": "value2","X-Mailin-custom":"my custom value", "X-Mailin-IP": "102.102.1.2", "X-Mailin-Tag" : "My tag"},
"inline_image" : {"myinlineimage1.png" : "your_png_files_base64_encoded_chunk_data","myinlineimage2.jpg" : "your_jpg_files_base64_encoded_chunk_data"}

but in this version, and make use of content property. from the SibApiV3Sdk.SendSmtpEmail.

Types missing for APIv3-nodejs-library

Having a completely pathetic experience first time implementing it with node.js.
Not sufficient documentation available anywhere.
I'd be please if you add @types for entire repo rather than .md files for APIs.

We shouldn't have to tweak Webpack to get the lib to work

Hi guys,
That new version of your SDK looks neat! I've got one problem though: why do I have to tweak my Webpack config to get it to work?
The name of the lib is APIv3-nodejs-library, so I don't really understand why you wouldn't just use require in your code, instead of the (outdated) headers you've added to each files.

I was lucky enough not to get into troubles when I added your workaround to my Webpack config, but I'm pretty not everyone out there will be as lucky.

Please let me know if you had other constraints when writing this lib, and if you'd be willing to find a solution to this problem :-)

Invalid smtpBlacklistSender format error

Hello,

I'm getting an error when I try to update a contact with new attributes only.

If I don't set smtpBlacklistSender to [''] manually, SB API returns:

// 400 BAD REQUEST
{ 
  "code":"invalid_parameter",
  "message":"Invalid smtpBlacklistSender format"
}

I'm using sib-api-v3-sdk version 4.0.1.

"sender is missing" on sendTransacEmail with template

I'm trying to send a transactional email based on a template. My template ID is # 1, and I am able to view the template by using:

    const apiInstance = new SibApiV3Sdk.SMTPApi();

    apiInstance.getSmtpTemplate(1).then(function(data) {
        console.log(data);
      }, function(error) {
        console.error(error);
      });

However, when trying to send using sendTransacEmail, I get an error: {"code":"missing_parameter","message":"sender is missing"}. Here is the code:

    const apiInstance = new SibApiV3Sdk.SMTPApi();

    const sendSmtpEmail = new SibApiV3Sdk.SendSmtpEmail({
        to: [{
            email: '[email protected]'
        }],
        templateId: 1,
        params: {
            ...
        }
    });
    const sendMail = await apiInstance.sendTransacEmail(sendSmtpEmail).then(
        data => data
    ).catch(err => {
        console.error(err)
    });

This gives the error:

{ Error: Bad Request
    at Request.callback (...\node_modules\sib-api-v3-sdk\node_modules\superagent\lib\node\index.js:688:13)
    at ...\node_modules\sib-api-v3-sdk\node_modules\superagent\lib\node\index.js:891:18
    at IncomingMessage.<anonymous> (...\node_modules\sib-api-v3-sdk\node_modules\superagent\lib\node\parsers\json.js:17:7)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1129:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  status: 400,
  response:
   Response {...
     res:
      IncomingMessage {...
        text: '{"code":"missing_parameter","message":"sender is missing"}' },
     request:
      Request {...
        method: 'POST',
        url: 'https://api.sendinblue.com/v3/smtp/email',
        ...
        protocol: 'https:',
        host: 'api.sendinblue.com',},
...

According to the API, I think using a templateId means that a sender does not need to be set. I have even tried to explicitly set a sender, but I still get the same error message.

Is this an error with the node package, the API, with my sendinblue setup, or something else?

Import a List of contacts with the API

Hi,
We are using :

var createContact = new SibApiV3Sdk.CreateContact();

but we need to import a list of contacts with one API CALL, is this possible?

Thanks

[BUG] API doesn't return explicit error messages.

I've been implementing creating a new Contact on my Node API and I've found some strange kind of bug with SMS.

When I create a new contact with SMS<6 characters length returns this error message:

{
    "error": "Error: Bad Request\n    at Request.callback ...node_modules\\superagent\\lib\\node\\index.js:688:13)\n    at ...node_modules\\superagent\\lib\\node\\index.js:891:18\n    at IncomingMessage.<anonymous> ...node_modules\\superagent\\lib\\node\\parsers\\json.js:17:7)\n    at IncomingMessage.emit (events.js:194:15)\n    at endReadableNT (_stream_readable.js:1125:12)\n    at process._tickCallback (internal/process/next_tick.js:63:19)"
} 

But when I create a new one with SMS>6 characters length it creates ok. It seems to be in your superagent dependency. Or if you're validating SMS length (that I didn't find it in the repo) it will be better if the API error message will be something like 'Invalid SMS length' or so.

P.D.: I'm creating a new contact with that:

const SibApiV3Sdk = require('sib-api-v3-sdk');
const sendinblueClient = SibApiV3Sdk.ApiClient.instance;
const apiKey = sendinblueClient.authentications['api-key'];
apiKey.apiKey = process.env.SENDINBLUE_API_KEY;

const apiInstance = new SibApiV3Sdk.ContactsApi();
try {
  let createContact = new SibApiV3Sdk.CreateContact();

  createContact['email'] = p_body.email;
  createContact['attributes'] = {
    firstname: p_body.name,
    sms: p_body.sms
  };

  await apiInstance.createContact(createContact);
  return resolve(okmsg)
}
catch(err) {
  return reject(err);
}

data.map is not a function.

While retrieving ContactInfo with:

    apiInstance.getContactInfo(email)

I fall into a bug:

TypeError: data.map is not a function
    at Function.exports.convertToType ([project]/node_modules/sib-api-v3-sdk/src/ApiClient.js:503:23)
    at Function.exports.constructFromObject ([project]/node_modules/sib-api-v3-sdk/src/model/GetExtendedContactDetailsStatistics.js:77:40)
    at Function.exports.constructFromObject ([project]/node_modules/sib-api-v3-sdk/src/model/GetExtendedContactDetails.js:76:65)
    at Function.exports.convertToType ([project]/node_modules/sib-api-v3-sdk/src/ApiClient.js:498:23)
    at exports.deserialize ([project]/node_modules/sib-api-v3-sdk/src/ApiClient.js:347:20)
    at [project]/node_modules/sib-api-v3-sdk/src/ApiClient.js:444:30
    at Request.callback ([project]/node_modules/superagent/lib/node/index.js:668:14)
    at [project]/node_modules/superagent/lib/node/index.js:883:18
    at IncomingMessage.<anonymous> ([project]/node_modules/superagent/lib/node/parsers/json.js:16:7)
    at IncomingMessage.emit (events.js:165:20)
    at endReadableNT (_stream_readable.js:1101:12)
    at process._tickCallback (internal/process/next_tick.js:152:19) 'data.map is not a function'

I added some debug log in [project]/node_modules/sib-api-v3-sdk/src/ApiClient.js:503:

          // for array type like: ['String']
          var itemType = type[0];
          console.log(type, data);   /// <=====
          return data.map(function(item) {
            return exports.convertToType(item, itemType);
          });

3 elements are printed:

[ 'Number' ] [ 4 ]
[ { [Function: exports] constructFromObject: [Function] } ] [ { campaignId: 16, eventTime: '2017-04-28T17:13:52.000+02:00' } ]
[ { [Function: exports] constructFromObject: [Function] } ] { campaignId: 16, eventTime: '2017-04-28T17:14:32.099+02:00' }

Cordialy.

Remove contact from automation workflow

Is there an API endpoint to remove a contact from an automation workflow without deleting the contact?

I have an automation that seeds from a contact list. I tried removing the contact from the seed list mid-flow, but that looked to leave the user in the automation flow.

As a fix, I added a condition between each step in the automation that checks if the contact is still in the seed list, if so continue, if no do nothing. This works but seems suboptimal.

Would be nice to be able to remove user from the flow directly through API.

Thanks.

Bad request when setting 'content' of SendSmtpEmailAttachment

Hello everyone,

The present documentation for SendSmtpEmailAttachment (used in SendTransacEmail) says the 'content' variable should be set to a 'Blob'. There is no such type in Node.js, so I assumed it was a base64 string, but the api answer with a Bad request error (working fine if I use url instead of content). Related code :


 const pdfBuffer = await generatePdf(statementHash);
  const blob = pdfBuffer.toString('base64');

  var apiInstance = new SibApiV3Sdk.SMTPApi();
  var sendSmtpEmail = new SibApiV3Sdk.SendSmtpEmail(); // SendSmtpEmail | Values to send a transactional email
  var attachment = new SibApiV3Sdk.SendSmtpEmailAttachment();
  attachment.name = "crypto-constat.pdf";
  attachment.content = blob;
  //attachment.url = "https://docs.n26.com/legal/04+FR/06+Black/fr/03_1black-allianz-insurance-tncs-Nov16-Sept17-fr.pdf";
  var recipient = new SibApiV3Sdk.SendSmtpEmailTo();
  recipient.name = "Thibaut Dumont";
  recipient.email = "[email protected]";
  sendSmtpEmail.templateId = 1;
  sendSmtpEmail.attachment = [attachment];
  sendSmtpEmail.to = [recipient];

  var data = await apiInstance.sendTransacEmail(sendSmtpEmail);

pdfBuffer is a buffer object. Did anyone successfully send content on the fly with this API ? Any help would be welcomed !

Issue updating a contact

Hi there,

Got an issue updating a contact, api return an error : "Bad request". Don't know if I miss something or anything else...
Here's my code :

const SibApiV3Sdk = require('sib-api-v3-sdk')
const defaultClient = SibApiV3Sdk.ApiClient.instance
const apiKey = defaultClient.authentications['api-key']
apiKey.apiKey = 'xxxxxxxxx'
let toSIDInfos = {
      'NOM': userInfos.lastName,
      'PRENOM': userInfos.firstName
    }
    const apiInstance = new SibApiV3Sdk.ContactsApi()
    let updateContact = new SibApiV3Sdk.UpdateContact()
    updateContact.attributes = toSIDInfos
    updateContact.listIds = [5, 10, 11]
    if (env === 'prod') {
      apiInstance.updateContact(encodeURI(userInfos.email), updateContact).then(function () {
        console.log('SENDINBLUE: API called successfully.')
      }, function (error) {
        console.error('SENDINBLUE_ERROR :' + error)
      })
    }

Of course my userInfos object return right datas.

Any idea ?

Thank you

"Please provide Email or SMS attribute value to create user"

I want to CreateContact but I have this error.
"Please provide Email or SMS attribute value to create user"
The documentation is very poor to the function 's properties

  // if not exsits, create new client sendinblue newsletter
            let newSendInBlueClient = { 
              "listIds": [ '2' ], 
              "email": req.body.email, 
              "updateEnabled": true, 
              "attributes": {
                "FIRST_NAME": req.body.firstname,
                "LAST_NAME": req.body.lastname,
                "SMS": req.body.mobilephone,
              } 
            }
            let apiInstance = new SibApiV3Sdk.ContactsApi();
            let createContact = new SibApiV3Sdk.CreateContact(newSendInBlueClient); // CreateContact | Values to create a client sendinblue           
            apiInstance.createContact(createContact).then((data) => {
              console.log('API called successfully. Returned data: ' + data);
            }, (error) => {
              console.error(error);
            });

status: 400, text: '{"code":"missing_parameter","message":"Please provide Email or SMS attribute value to create user"}', method: 'POST', path: '/v3/contacts' },

Empty params throw an error, even though docs list them as optional

We have a template that doesn't use any params. When attempting to send an email with no params, which the docs list as optional here, it fails with "status":400,"text":"{\"code\":\"missing_parameter\",\"message\":\"params is blank\"}.

Adding a bogus param fixes the issue, so either the docs should be updated, or params actually made optional.

Unable to include the module on Ubuntu

At app start on Ubuntu in a node application, I see following error:

screen shot 2018-02-01 at 11 18 51 am

The model file is named RequestSMSRecipientExport (note SMS all caps). However it is included as RequestSmsRecipientExport.

some symbols in docs are unreadable

So far docs have been a pleasure to read, but on this page https://github.com/sendinblue/APIv3-nodejs-library/blob/master/docs/CreateContact.md the description of some properties are encoded funny.

Example:

Properties

Name Type Description Notes
email String Email address of the user. Mandatory if &quot;SMS&quot; field is not passed in &quot;attributes&quot; parameter. Mobile Number in &quot;SMS&quot; field should be passed with proper country code. For example {&quot;SMS&quot;:&quot;+91xxxxxxxxxx&quot;} or {&quot;SMS&quot;:&quot;0091xxxxxxxxxx&quot;} [optional]
attributes Object Pass the set of attributes and their values. These attributes must be present in your SendinBlue account. For eg. {&quot;FNAME&quot;:&quot;Elly&quot;, &quot;LNAME&quot;:&quot;Roger&quot;} [optional]

(The table continues on the page.)

Transactional Emails API limit

Hi,

I am getting the following Bad Request error returned from the API when I try to set the limit option in getEmailEventReport(opts) in TransactionalEmailsApi:

text: '{"code":"out_of_range","message":"Limit exceeds max value"}'

The documentation here notes the default value of limit is 50, but does not say what the max value is. What is the max value of limit for this function?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.