Skip to content

Merge does not send variables to API properly #1

@paulsaccount

Description

@paulsaccount

Summary

Using current version of ElasticEmailWebApiClient on PyPI, it seems like merge tags are not getting translated to the correct format required by the V2 API. I confirmed this locally and I have some sample code that exhibits this behavior.

Setup Steps

  • You have the latest published version: pip install ElasticEmailWebApiClient==1.0.5
  • Ensure you have set ELASTIC_EMAIL_API_KEY as an environmental variable.
  • Create a template and replace the template_id with the one from ElasticEmail.
  • Ensure you have a template in ElasticEmail with {inviter} and {invite_url}.

Repo Steps

import os
from ElasticEmailClient import ApiClient, Email

ApiClient.apiKey = os.getenv('ELASTIC_EMAIL_API_KEY')
template_id = '58095'
to_email = 'support@elasticemail.com'
inviter_email = 'inviter@yopmail.com'
invite_url = 'https://www.google.com'

Email.Send(to=[to_email],
               template=template_id,
               merge={'merge_inviter': inviter_email, 'merge_invite_url': invite_url},
               isTransactional=True)

Actual behavior

Email sends, but does NOT replace merge variables.

Expected behavior

Email sends, but replaces merge variables.

Root Cause

It appears that other ElasticEmail libraries for other languages specifically break out "merge" and it put in the correct URL parameters. See your PHP library for example

It actually looks like this repository has a call to fix this, but this function is missing in the published version on PyPI. See this line in ElasticEmailClient.py and compare that with the code you download from PyPI for ElasticEmailWebApiClient

Also it actually looks like the repository is out of sync from PyPI. Can you please submit the latest version for this library to PyPI?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions