Use Cases Integrations
api marketing
May 17, 2023
Sending an Email Campaign
One of E-goi's most popular features is the ability to send email campaigns. Our API allows you to both create an email campaign and send it.

Requirements

Scenario

You want to send out an email newsletter to your customers.

1. Creating the Campaign

Let’s use the Create New Email Campaign Method. Be sure to set your content (eg. the email’s HTML code) and your sender_id (to identify the message sender). The sender should have been already added and confirmed in your E-goi account.

This method uses E-goi Public API Server https://api.egoiapp.com/campaigns/email route and has the following payload, which will produce a campaign hash.


NOTE!

You will need the campaign hash later, so we recommend saving it.

If you need to consult your campaign hash any time, you can use the Get All Campaign method.


Payload Example:

{
  "list_id": 1,
  "internal_name": "Campaign internal name",
  "subject": "Campaign subject",
  "content": {
    "type": "html",
    "body": "string",
    "plain_text": "string",
    "snippet": "string"
  },
  "sender_id": 1,
  "reply_to": 1,
  "header_footer": {
    "id": 1,
    "header_links": {
      "forward": false,
      "view_web": false,
      "unsubscribe": false,
      "edit": false,
      "social_share": false,
      "facebook_share": false,
      "twitter_share": false
    },
    "footer_links": {
      "forward": false,
      "view_web": false,
      "unsubscribe": false,
      "edit": false,
      "social_share": false,
      "facebook_share": false,
      "twitter_share": false
    }
  }
}

Answer Payload Example:

{
  "result": "success"
}

2. Sending the Campaign

Now you can post your Send Email Message request using the campaign hash you got when you Create New Email Campaign Method.

This means replacing {campaign_hash} in https://api.egoiapp.com/campaigns/email/{campaign_hash}/actions/send with the campaign hash you’ve been provided.

To send the campaign, you’ll also need to select the contact list it’ll be sent to. You can choose to send it “immediately” or “schedule” it for later.

Email Campaign Schedule

You can then either send the message to your entire list or to a segment of it (eg, customers from a certain city only). If you go for the latter, specify the segment ID. The segment must have been previously created in the contact list.