使用 SendGrid 同步联系人
Made by Twilio
使 Firestore 联系人数据集合与 SendGrid Marketing Campaign 联系人列表保持同步
此扩展程序的运作方式
Use this extension to add, update, or remove contacts from your SendGrid Marketing Campaigns contact list based on information added to a specified Cloud Firestore collection.
Adding a document triggers this extension to add a contact to the Marketing Campaigns contact list. Updating a document will update the contact's data and deleting the document will trigger its removal from the contact list in SendGrid.
Here's an example document that would trigger this extension:
admin.firestore().collection('contacts').add({
email: 'someone@example.com',
first_name: 'Bob',
last_name: 'Bobson'
});
In the document you can add any of the following fields to your document and they will be applied to your contact:
Field | type | |
---|---|---|
email
|
string | required |
alternate_emails
|
Array
|
|
first_name
|
string | |
last_name
|
string | |
address_line_1
|
string | |
address_line_2
|
string | |
city
|
string | |
postal_code
|
string | |
state_province_region
|
string | |
country
|
string | |
phone_number
|
string | |
whatsapp
|
string | |
line
|
string | |
facebook
|
string | |
unique_name
|
string | |
custom_fields
|
Map
|
custom_fields
must be defined within your SendGrid account and are a map of the custom field's ID to the content.
Additional setup
Before installing this extension, make sure:
- You have set up a Cloud Firestore database in your Firebase project
- You have signed up for a Twilio SendGrid Marketing Campaigns account
- You have created a SendGrid API Key with access to the Marketing APIs
Billing
To install an extension, your project must be on the Blaze (pay as you go) plan
- You will be charged a small amount (typically around $0.01/month) for the Firebase resources required by this extension (even if it is not used).
- This extension uses other Firebase and Google Cloud Platform services, which have associated charges if you exceed the service’s free tier:
- Cloud Firestore
- Cloud Functions (Node.js 10+ runtime. See FAQs )
- Cloud Secret Manager
Usage of this extension also requires you to have a Twilio SendGrid account and credentials in order to use the Twilio SendGrid API for marketing campaigns. You are responsible for any associated costs with your usage of Twilio SendGrid.
如何安装此扩展程序
使用 Firebase CLI
要安装和管理扩展程序,您还可以使用 Firebase CLI:
步骤 1 :运行以下 npm 命令来安装 CLI 或将 CLI 更新到最新版本。
npm install -g firebase-tools不能运行?请参阅 Firebase CLI 参考文档 或者更改您的 npm 权限 。
第 2 步 : 设置一个新的 Firebase 项目目录 或转到现有目录
第 3 步 :将此扩展程序添加到 扩展程序清单 中
firebase ext:install twilio/sendgrid-sync-contacts --local --project=projectId_or_alias
Step 4 (Optional): Test this extension locally with the Firebase Emulator Suite
firebase emulators:start
第 5 步 :将清单中的扩展程序 部署 到项目中
firebase deploy --only extensions --project=projectId_or_alias