SEND whatspp message Gupshup with template

Hi guys,

I’m needing do a integration with API Gupshup using template, so above I’ll paste my original code by C#. I’m doing migration of Function from C# to BUBBLE.

var client = new RestClient(“http://api.gupshup.io/sm/api/v1/template/msg”);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader(“apikey”, “MY-KEY”);
request.AddHeader(“Content-Type”, “application/x-www-form-urlencoded”);
request.AddParameter(“source”, “5511xxxxxxx”);
request.AddParameter(“destination”, “5511yyyyyyy”);
var template = “{“id”:“MY-TEMPLATE”,“params”: [“MY-FIRST-PARAM”,“MY-SECOND-PARAM”]}”;
request.AddParameter(“template”, “{“id”:“MY-TEMPLATE”,“params”: [“MY-FIRST-PARAM”,“MY-SECOND-PARAM”]}”);

        IRestResponse response = client.Execute(request);
        if (response.IsSuccessful)
        {   
          //RETURN OK
      } else {
        //RETURNO ERROR
      }

Could someone help me with this?

It using POSTMAN it work correct, under exemple Code Snippet:

var client = new RestClient(“http://api.gupshup.io/sm/api/v1/template/msg”);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader(“apikey”, “MY-KEY”);
request.AddHeader(“Content-Type”, “application/x-www-form-urlencoded”);
request.AddParameter(“source”, “5511xxxxxxx”);
request.AddParameter(“destination”, “5511yyyyyy”);
request.AddParameter(“template”, “{“id”: “MY-CODE-TEMPLATE”, “params” : [“MY-FIRST-PARAM”, “MY-SECOND-PARAM”]}”);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

:sleepy:

Thanks