有没有办法通过Mautic API发送带有自己属性的电子邮件?示例:我想向客户端发送带有订单摘要的流程电子邮件。所以我想和ex一起准备电子邮件模板。{special:orderId},{special:orderPrice},...想要做这样的事情
$api->send(emailId, contactId, [
special => [
'orderId' => 123,
'orderPrice' => 1000
]
]);
一些额外的-客户有一些我们的电子商店类别在他的最爱,我想发送基本的通讯与“新的在你最喜欢的类别”…只需选择已创建的电子邮件模板并使用参数发送
$parameters = [
1 => [
'name' => 'Product name',
'price' => 123,
'imgPath' => 'http://pathToImage'
...
],
...
]
有什么方法可以做到这一点吗?我是毛蒂亚语的初学者,但我认为它是为这些特色菜设计的,但不知道如何做到这一点…
非常感谢您的回复。Mautic v2.4
发布于 2018-02-27 01:02:54
可以,您可以在电子邮件中使用自定义令牌。然而,API库并不直接支持这一点。您需要将值放入数组结构中,并直接调用makeRequest()
函数。这是因为API库sendToContact()
函数没有可选数据的第三个参数。它将一个空数组传递给makeRequest()
/**
* Send email to a specific contact
*
* @param int $id
* @param int $contactId
*
* @return array|mixed
*/
public function sendToContact($id, $contactId)
{
return $this->makeRequest($this->endpoint.'/'.$id.'/contact/'.$contactId.'/send', array(), 'POST');
}
所以你必须这样称呼它:
$emailApi = $api->newApi("emails", $auth, $apiUrl);
$data = array(
'tokens' => array(
'{custom_token}' => 'My Custom Token'
)
);
$email = $emailApi->makeRequest('emails/'.$email_id.'/contact/'.$contact_id.'/send', $data, 'POST');
然后,您可以在电子邮件中使用{custom_token}。
或者,您可以使用sendToContact方法。只需将上面的最后一行替换为:
$email = $emailApi->sendToContact($email_id, $contact_id, $data);
发布于 2017-03-03 23:11:18
我认为这样的事情是不可能的,但这是一个好主意,你可以在这里提交一个功能请求:https://github.com/mautic/mautic/issues
为了实现这一点,你必须添加联系人自定义字段,如orderId和orderPrice,调用API以更新联系人的最新订单,然后将带有{contactfield=orderId}
和{contactfield=orderPrice}
令牌的预定义电子邮件发送给联系人,Mautic将为您替换令牌。
https://stackoverflow.com/questions/42402272
复制相似问题