docs/platform/integrations/sms/gupshup.mdx
You can use the Gupshup provider to send SMS messages to your customers using the Novu Platform with a single API to create multi-channel experiences.
To use the Gupshup provider in the SMS channel, the first step is to create a Gupshup account and add the Account User Id and Password to the Gupshup integration on the Novu platform.
User Id : The account number provided by the Enterprise SMS GupShup.Password : Password is provided by Gupshup for authentication of user id. The password must be the same as used to log on to the Enterprise SMS GupShup website.User id.Password.primary using Primary Integration toggle.Now it is possible to send SMS notifications using Gupshup in Novu.
Novu has its own SMS editor for writing SMS template. To use premade Gupshup templates, providers overrides can be used.
<Note> Sending `customData` field in overrides to send Gupshup template will work only in following cases:firstName, lastName, phone, etc as same overrides will be applied
to all subscribers.
</Note>
const novu = new Novu({ secretKey: "<NOVU_SECRET_KEY>" });
await novu.trigger({ workflowId: "WORKFLOW_ID", to: { subscriberId: "SUBSCRIBER_ID", }, payload: { "key": "value" }, overrides: { "providers": { "gupshup": { "principalEntityId": "principal-entity-id", "dltTemplateId": "dlt-template-id" } } }, });
</Tab>
<Tab title="Python">
```python
import os
import novu_py
from novu_py import Novu
with Novu(secret_key=os.getenv("NOVU_SECRET_KEY", "")) as novu:
novu.trigger(trigger_event_request_dto=novu_py.TriggerEventRequestDto(
workflow_id="WORKFLOW_ID",
to={"subscriber_id": "SUBSCRIBER_ID"},
payload={
"key": "value"
},
overrides={
"providers": {
"gupshup": {
"principalEntityId": "principal-entity-id",
"dltTemplateId": "dlt-template-id"
}
}
},
))
novugo "github.com/novuhq/novu-go"
"github.com/novuhq/novu-go/models/components"
)
s := novugo.New(novugo.WithSecurity(os.Getenv("NOVU_SECRET_KEY")))
res, err := s.Trigger(context.Background(), components.TriggerEventRequestDto{ WorkflowID: "WORKFLOW_ID", To: components.CreateToSubscriberPayloadDto(components.SubscriberPayloadDto{ SubscriberID: "SUBSCRIBER_ID", }), Payload: map[string]any{ "key": "value" }, Overrides: map[string]any{ "providers": { "gupshup": { "principalEntityId": "principal-entity-id", "dltTemplateId": "dlt-template-id" } } }, }, nil)
</Tab>
<Tab title="PHP">
```php
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()->setSecurity('<NOVU_SECRET_KEY>')->build();
$sdk->trigger(
triggerEventRequestDto: new Components\TriggerEventRequestDto(
workflowId: 'WORKFLOW_ID',
to: new Components\SubscriberPayloadDto(subscriberId: 'SUBSCRIBER_ID'),
payload: {
"key": "value"
},
overrides: {
"providers": {
"gupshup": {
"principalEntityId": "principal-entity-id",
"dltTemplateId": "dlt-template-id"
}
}
},
),
);
var sdk = new NovuSDK(secretKey: "<NOVU_SECRET_KEY>");
await sdk.TriggerAsync(triggerEventRequestDto: new TriggerEventRequestDto() { WorkflowId = "WORKFLOW_ID", To = To.CreateSubscriberPayloadDto(new SubscriberPayloadDto() { SubscriberId = "SUBSCRIBER_ID" }), Payload = { "key": "value" }, Overrides = { "providers": { "gupshup": { "principalEntityId": "principal-entity-id", "dltTemplateId": "dlt-template-id" } } }, });
</Tab>
<Tab title="Java">
```java
import co.novu.Novu;
import co.novu.models.components.*;
Novu novu = Novu.builder().secretKey("<NOVU_SECRET_KEY>").build();
novu.trigger()
.body(TriggerEventRequestDto.builder()
.workflowId("WORKFLOW_ID")
.to(To2.of(SubscriberPayloadDto.builder().subscriberId("SUBSCRIBER_ID").build()))
.payload({
"key": "value"
})
.overrides({
"providers": {
"gupshup": {
"principalEntityId": "principal-entity-id",
"dltTemplateId": "dlt-template-id"
}
}
})
.build())
.call();