Conversation

How do I send a message with an attachment via the API?

  • 23 November 2022
  • 1 reply
  • 9 views

Userlevel 2
Badge

Hello, 

Sometimes there is a need to send an email with attachments to contacts. While doing this with the help of the system is really easy, performing this action via the API is not so obvious..

What is the best way to do this in this case?


1 reply

Userlevel 5

Hi,

We use the methods for this: 
/api/email/sendWithAttachment

https://docs.salesmanago.com/?_ga=2.51225641.1484148345.1669219206-746681212.1660818022#sending-email-with-attachment

1. You first need to set the headers.
2. Then you add the attachment in the body.
3. Add a request.
{
      "clientId": "XXXXX",
      "apiKey": "XXXXX",
      "requestTime": 1666890297831,
      "sha": "XXXXX",
      "user": "useremail@gmail.com",
      "emailId": "8d9ecae8-7707-4cf6-ae4a-7c2822ab1911",
      "contacts": [
        {
          "addresseeType" : "EMAIL",
          "email": "example@salesmanago.com"}
      ],
      "date": 1666900288634,
      "subject": "Sample API subject"
    }
* Date should be given in millisecond format: https://currentmillis.com/.
* emailId is taken from the url in the email edit. This must be the ID of an email existing in SALESmanago.

Reply