View Source AtEx.Gateway.Iot.PublishData (AtEx v0.20.23)

This module allows you to make an HTTP POST to publish messages to your remote devices.

Summary

Functions

Process results from calling the gateway

This function makes a POST request to to publish messages to your remote devices through the Africa's talking IOT endpoint The function accepts a map of parameters.

Functions

Process results from calling the gateway

This function makes a POST request to to publish messages to your remote devices through the Africa's talking IOT endpoint The function accepts a map of parameters.

Parameters

attrs: - a map containing:

  • deviceGroup - The device group to which the message is to be sent
  • topic - The messaging channel to which the message is to be sent. In the form <username>/<device-group>/<the-topic>
  • payload - The message packet to be sent to the subscribed devices.

Example

iex> AtEx.Gateway.Iot.PublishData.publish(%{
...>   deviceGroup: "CrazyCats",
...>   topic: "any-topic",
...>   payload: "take me to your leader"
...> })
{:ok, %{ "status" => true, "description" => "Message processed successfully"}}