This quick guide aims to help you start with Infobip Moments API. After reading it, you should know how to use Moments.
The first step is to prepare Configuration object for handling authentication.
var configuration = new Configuration()
{
BasePath = "<put your base URL here prefixed by https://>",
ApiKey = "<put your API key here>"
};You can now create an instance of FlowApi which allows you to manage your flows.
var flowApi = new FlowApi(configuration);To add participants to a flow, you can use the following code:
var campaignId = 200000000000001L;
var request = new FlowAddFlowParticipantsRequest(
participants: new List<FlowParticipant>
{
new FlowParticipant(
identifyBy: new FlowPersonUniqueField(
identifier: "test@example.com",
type: FlowPersonUniqueFieldType.Email
),
variables: new Dictionary<string, object>
{
{ "orderNumber", 1167873391 }
}
)
},
notifyUrl: "https://example.com"
);
var response = flowApi.AddFlowParticipants(campaignId, request);To fetch a report to confirm that all persons have been successfully added to the flow, you can use the following code:
var givenOperationId = "03f2d474-0508-46bf-9f3d-d8e2c28adaea";
var response = flowApi.GetFlowParticipantsAddedReport(campaignId, givenOperationId);To remove a person from a flow, you can use the following code:
var externalId = "8edb24b5-0319-48cd-a1d9-1e8bc5d577ab";
flowApi.RemovePeopleFromFlow(campaignId, externalId);You can now create an instance of FormsApi which allows you to manage your forms.
var formsApi = new FormsApi(configuration);To get all forms, you can use the following code:
var formsResponse = formsApi.GetForms();To get a specific form by ID, you can use the following code:
var formId = "cec5dfd2-4238-48e0-933b-9acbdb2e6f5f";
var formsResponse = formsApi.GetForm(formId);To increase the view counter of a specific form, you can use the following code:
var formsResponse = formsApi.IncrementViewCount(formId);To submit data to a specific form, you can use the following code:
var formDataRequest = new Dictionary<string, object>
{
{ "first_name", "John" },
{ "last_name", "Doe" },
{ "company", "Infobip" },
{ "email", "info@example.com" }
};
var status = formsApi.SubmitFormData(formId, formDataRequest);