SendGrid
We have partnered with SendGrid for sending Email Notifications and hence you need to set up an account on SendGrid before you start using the extension.Get your SendGrid API Key
- Log in to your SendGrid account.
- In the left navigation pane, go to Settings and select API Keys.
- If you don’t have an API Key yet, click on Create API Key.
- Give a name to your API Key and select Full Access to get started.
- Make a note of the API key for later use.
Create an email template
- Log in to your SendGrid account.
- In the left navigation pane, go to Email API and select Dynamic Templates.
- Click on “Create a Dynamic Template” and give a name to your template.
- In the Template listing, expand your template and click on “Add Version”.
- Under the “Your Email Designs” tab, select Blank Template.
- As we have the following HTML template ready for you, select the “Code Editor” option.
- Paste the code for the email template. You should be able to see the Preview in the Right pane.
- Click on Settings on the Left to expand the Settings drawer.
- Enter the Version name and the value for Subject as
{{subject}}
and hit “Save”. - You have now successfully created a Template with a version.
- From the Dynamic Templates listing page, expand your Template and make a note of the Template ID for later use.
- The payload sent by the extension to SendGrid is as follows:
- The email template recommended by us is as follows. Replace “https://www.YOURSITE.com” with your website’s URL in the below template.
Add an unsubscribe group
An unsubscribe group will allow your users to unsubscribe to only chat email notifications and will allow you to continue to send other emails to that user via SendGrid.- In the left pane, go to Suppressions and select Unsubscribe Groups.
- Click on “Create New Group” and give it a name and proper description.
- Save your new group and make a note of the Unsubscribe Group ID for later use.
Store contact details
Store the Email IDs of your users by using our Update Contact details API.Enable Email notifications

- Login to CometChat dashboard and select your app.
- Navigate to Notifications > Notifications in the left-hand menu.
- Enable Email notifications feature.
Save the SendGrid credentials

- SendGrid API key
- SendGrid Template ID
- SendGrid Unsubscribe Group ID
- Sender’s name
- Sender’s email
The domain used in Sender’s Email needs to be Authenticated. Refer to SendGrid’s documentation on Domain Authentication for more details. Use the complete authenticated domain in the sender’s email address. For eg, if your domain is example.com and the authenticated domain is em1235.example.com, then the sender’s email address should be sender@em1235.example.com and not sender@example.com
Save user’s timezone
A user’s timezone is required to allow them to set a schedule for receiving notifications. In case the timezone is not registered, the default timezone for- For US region: EST
- For EU region: GMT
- For IN region: Asia/Kolkata
updateTimezone()
method of CometChatNotifications
class.
This functionality is available in the following SDK versions:
- Android SDK version 4.0.9 and above
- iOS SDK version 4.0.51 and above
- Web SDK version 4.0.8 and above
- React Native SDK version 4.0.10 and above
- Ionic Cordova SDK version 4.0.8 and above
- Flutter SDK version 4.0.15 and above
Receive notifications

Configure email replies
In the SendGrid provider settings, enable the email replies. Optionally, you can set a different sender’s email address. Only ensure that the it doesn’t contain any ”+” symbol in it. Copy the Replies webhook URL as that will be required for Inbound parse configuration on SendGrid’s end. Follow the SendGrid’s Inbound parse webhook steps. Before saving the Inbound Host and URL:- Uncheck Spam Check checkbox.
- Uncheck Send Raw checkbox.
Custom Email provider
Custom provider allows you to make use of providers apart from SendGrid for triggering Email notifications. This is implemented using webhook URL which gets all the required details that can be used to trigger Email notifications.Pre-requisite
- Your webhook endpoint must be accessible over
HTTPS
. This is essential to ensure the security and integrity of data transmission. - This URL should be publicly accessible from the internet.
- Ensure that your endpoint supports the
HTTP POST
method. Event payloads will be delivered viaHTTP POST
requests inJSON
format. - Configure your endpoint to respond immediately to the CometChat server with a 200 OK response. The response should be sent within 2 seconds of receiving the request.
- For security, it is recommended to set up Basic Authentication that is usually used for server-to-server calls. This requires you to configure a username and password. Whenever your webhook URL is triggered, the HTTP Header will contain:
Add credentials
- Click on the ”+ Add Credentials” button.
- Enable the provider.
- Enter the publically accessible Webhook URL.
- It is recommended to enable Basic Authentication.
- Enter the username and password.
- Enabling the “Trigger only if email address is stored with CometChat” setting requires users’ email addresses to be stored with CometChat using the Update Contact details API. When enabled, the webhook is triggered only for those users. If this setting is disabled, the webhook triggers regardless of whether users’ email addresses are stored with CometChat.
- Save the credentials.
